diff options
| author | Kostis Anagnostopoulos <ankostis@gmail.com> | 2016-10-24 13:52:45 +0200 |
|---|---|---|
| committer | Kostis Anagnostopoulos <ankostis@gmail.com> | 2016-10-24 15:17:00 +0200 |
| commit | 941b6c7eff72de618bb34eeb5983ed2795988a32 (patch) | |
| tree | 181c59742a70480a992dacd1a8b8938a796c541d /gitdb | |
| parent | fd2eba4079da4bc2b28f975b64c40ce4989711f9 (diff) | |
| download | gitdb-941b6c7eff72de618bb34eeb5983ed2795988a32.tar.gz | |
feat(src): subst `reduce` with `sum` for size calcs
+ fix(loose-db): fix bad-attr in ex-message
Diffstat (limited to 'gitdb')
| -rw-r--r-- | gitdb/db/base.py | 3 | ||||
| -rw-r--r-- | gitdb/db/loose.py | 4 | ||||
| -rw-r--r-- | gitdb/db/pack.py | 2 | ||||
| -rw-r--r-- | gitdb/fun.py | 3 | ||||
| -rw-r--r-- | gitdb/pack.py | 2 |
5 files changed, 5 insertions, 9 deletions
diff --git a/gitdb/db/base.py b/gitdb/db/base.py index 2d7b9fa..6dbee21 100644 --- a/gitdb/db/base.py +++ b/gitdb/db/base.py @@ -16,7 +16,6 @@ from gitdb.exc import ( ) from itertools import chain -from functools import reduce __all__ = ('ObjectDBR', 'ObjectDBW', 'FileDBBase', 'CompoundDB', 'CachingDB') @@ -209,7 +208,7 @@ class CompoundDB(ObjectDBR, LazyMixin, CachingDB): def size(self): """:return: total size of all contained databases""" - return reduce(lambda x, y: x + y, (db.size() for db in self._dbs), 0) + return sum(db.size() for db in self._dbs) def sha_iter(self): return chain(*(db.sha_iter() for db in self._dbs)) diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index 192c524..374cdc7 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -57,7 +57,7 @@ import tempfile import os -__all__ = ('LooseObjectDB', ) +__all__ = ('LooseObjectDB',) class LooseObjectDB(FileDBBase, ObjectDBR, ObjectDBW): @@ -150,7 +150,7 @@ class LooseObjectDB(FileDBBase, ObjectDBR, ObjectDBW): def set_ostream(self, stream): """:raise TypeError: if the stream does not support the Sha1Writer interface""" if stream is not None and not isinstance(stream, Sha1Writer): - raise TypeError("Output stream musst support the %s interface" % Sha1Writer.__name__) + raise TypeError("Output stream must support the %s interface" % Sha1Writer) return super(LooseObjectDB, self).set_ostream(stream) def info(self, sha): diff --git a/gitdb/db/pack.py b/gitdb/db/pack.py index 6b03d83..12ec43a 100644 --- a/gitdb/db/pack.py +++ b/gitdb/db/pack.py @@ -20,8 +20,6 @@ from gitdb.exc import ( from gitdb.pack import PackEntity from gitdb.utils.compat import xrange -from functools import reduce - import os import glob diff --git a/gitdb/fun.py b/gitdb/fun.py index 8ca38c8..cf3ad02 100644 --- a/gitdb/fun.py +++ b/gitdb/fun.py @@ -12,7 +12,6 @@ decompressobj = zlib.decompressobj import mmap from itertools import islice -from functools import reduce from gitdb.const import NULL_BYTE, BYTE_SPACE from gitdb.utils.encoding import force_text @@ -296,7 +295,7 @@ class DeltaChunkList(list): :raise AssertionError: if the size doen't match""" if target_size > -1: assert self[-1].rbound() == target_size - assert reduce(lambda x, y: x + y, (d.ts for d in self), 0) == target_size + assert sum(d.ts for d in self) == target_size # END target size verification if len(self) < 2: diff --git a/gitdb/pack.py b/gitdb/pack.py index 20a4515..cc358c9 100644 --- a/gitdb/pack.py +++ b/gitdb/pack.py @@ -40,7 +40,7 @@ except ImportError: pass # END try c module -from gitdb.base import ( # Amazing ! +from gitdb.base import ( # Amazing ! OInfo, OStream, OPackInfo, |
