diff options
| author | Kostis Anagnostopoulos <ankostis@gmail.com> | 2016-10-25 15:03:00 +0200 |
|---|---|---|
| committer | Kostis Anagnostopoulos <ankostis@gmail.com> | 2016-10-27 23:55:16 +0200 |
| commit | 6e5e30877899ca0d503ce082eab780956259e191 (patch) | |
| tree | ba118980822564494068759507c3c30f36fdcbeb /gitdb/util.py | |
| parent | a566e1189f2aa118728e7b1dc49bcd4dbb3e3c6f (diff) | |
| download | gitdb-6e5e30877899ca0d503ce082eab780956259e191.tar.gz | |
fix(io): BREAKING, wrap more out-stream usages
+ chrore(deps): depend on *contextlib2* for `ExitStack` in PY2.
+ refact(util): BREAKING API move consts out of utils.
+ style(pep8): fixe all sources.
Diffstat (limited to 'gitdb/util.py')
| -rw-r--r-- | gitdb/util.py | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/gitdb/util.py b/gitdb/util.py index 0a77ea2..d994790 100644 --- a/gitdb/util.py +++ b/gitdb/util.py @@ -19,11 +19,6 @@ from smmap import ( SlidingWindowMapBuffer ) -from gitdb.const import ( - NULL_BIN_SHA, - NULL_HEX_SHA -) - # initialize our global memory manager instance # Use it to free cached (and unused) resources. @@ -33,24 +28,6 @@ else: mman = SlidingWindowMapManager() # END handle mman - -try: - from struct import unpack_from -except ImportError: - from struct import unpack, calcsize - __calcsize_cache = dict() - - def unpack_from(fmt, data, offset=0): - try: - size = __calcsize_cache[fmt] - except KeyError: - size = calcsize(fmt) - __calcsize_cache[fmt] = size - # END exception handling - return unpack(fmt, data[offset: offset + size]) - # END own unpack_from implementation - - #{ Aliases hex_to_bin = binascii.a2b_hex @@ -78,8 +55,6 @@ fsync = os.fsync is_win = (os.name == 'nt') is_darwin = (os.name == 'darwin') -# Backwards compatibility imports - #} END Aliases log = logging.getLogger(__name__) @@ -136,7 +111,7 @@ def rmtree(path): try: func(path) # Will scream if still not possible to delete. - except Exception as ex: + except Exception: raise return shutil.rmtree(path, False, onerror) @@ -149,7 +124,7 @@ def make_sha(source=''.encode("ascii")): try: return hashlib.sha1(source) except NameError: - import sha + import sha # @UnresolvedImport sha1 = sha.sha(source) return sha1 |
