Drop compatibility replacement for unpack_from.
authorJelmer Vernooij <jelmer@samba.org>
Tue, 3 Dec 2013 01:01:07 +0000 (01:01 +0000)
committerJelmer Vernooij <jelmer@samba.org>
Tue, 3 Dec 2013 01:01:07 +0000 (01:01 +0000)
dulwich/_compat.py
dulwich/pack.py

index 61eef3deee57dd48a68061deb24b28cd3c23eff4..e83c24a215a8e4bd8f069d728b8e5c4476400a9b 100644 (file)
@@ -37,8 +37,6 @@ except ImportError:
     SEEK_CUR = 1
     SEEK_END = 2
 
-import struct
-
 
 def make_sha(source=''):
     """A python2.4 workaround for the sha/hashlib module fiasco."""
@@ -49,15 +47,6 @@ def make_sha(source=''):
         return sha1
 
 
-def unpack_from(fmt, buf, offset=0):
-    """A python2.4 workaround for struct missing unpack_from."""
-    try:
-        return struct.unpack_from(fmt, buf, offset)
-    except AttributeError:
-        b = buf[offset:offset+struct.calcsize(fmt)]
-        return struct.unpack(fmt, b)
-
-
 try:
     all = all
 except NameError:
index 1bfcb41d7006a1a2673a536d3cee3476a2992b89..77ede844e4cbca2bc109968c2529238cec9296f0 100644 (file)
@@ -53,10 +53,7 @@ else:
     has_mmap = True
 import os
 import struct
-try:
-    from struct import unpack_from
-except ImportError:
-    from dulwich._compat import unpack_from
+from struct import unpack_from
 import sys
 import warnings
 import zlib