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/db | |
| 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/db')
| -rw-r--r-- | gitdb/db/base.py | 3 | ||||
| -rw-r--r-- | gitdb/db/loose.py | 4 | ||||
| -rw-r--r-- | gitdb/db/pack.py | 2 |
3 files changed, 3 insertions, 6 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 |
