diff options
author | Hugo <hugovk@users.noreply.github.com> | 2018-03-18 21:33:18 +0200 |
---|---|---|
committer | Hugo <hugovk@users.noreply.github.com> | 2018-03-18 22:26:31 +0200 |
commit | ac4f7d34f8752ab78949efcaa9f0bd938df33622 (patch) | |
tree | 0c7acd1d3c1e0012d26d610c7a9fe81197e28a5e | |
parent | 14582df679a011e8c741eb5dcd8126f883e1bc71 (diff) | |
download | gitpython-ac4f7d34f8752ab78949efcaa9f0bd938df33622.tar.gz |
Rewrite unnecessary dict/list/tuple calls as literals
-rw-r--r-- | git/cmd.py | 8 | ||||
-rw-r--r-- | git/diff.py | 4 | ||||
-rw-r--r-- | git/index/base.py | 32 | ||||
-rw-r--r-- | git/index/fun.py | 6 | ||||
-rw-r--r-- | git/objects/blob.py | 2 | ||||
-rw-r--r-- | git/objects/commit.py | 4 | ||||
-rw-r--r-- | git/objects/fun.py | 10 | ||||
-rw-r--r-- | git/objects/submodule/base.py | 4 | ||||
-rw-r--r-- | git/objects/submodule/root.py | 4 | ||||
-rw-r--r-- | git/objects/tree.py | 2 | ||||
-rw-r--r-- | git/objects/util.py | 6 | ||||
-rw-r--r-- | git/refs/head.py | 2 | ||||
-rw-r--r-- | git/refs/log.py | 2 | ||||
-rw-r--r-- | git/refs/reference.py | 2 | ||||
-rw-r--r-- | git/refs/symbolic.py | 2 | ||||
-rw-r--r-- | git/refs/tag.py | 2 | ||||
-rw-r--r-- | git/remote.py | 2 | ||||
-rw-r--r-- | git/repo/base.py | 16 | ||||
-rw-r--r-- | git/test/performance/test_odb.py | 4 | ||||
-rw-r--r-- | git/test/performance/test_streams.py | 2 | ||||
-rw-r--r-- | git/test/test_diff.py | 2 | ||||
-rw-r--r-- | git/test/test_index.py | 6 | ||||
-rw-r--r-- | git/test/test_refs.py | 2 | ||||
-rw-r--r-- | git/test/test_remote.py | 4 | ||||
-rw-r--r-- | git/test/test_tree.py | 2 | ||||
-rw-r--r-- | git/util.py | 8 | ||||
-rwxr-xr-x | setup.py | 2 |
27 files changed, 71 insertions, 71 deletions
@@ -485,10 +485,10 @@ class Git(LazyMixin): def readlines(self, size=-1): if self._nbr == self._size: - return list() + return [] # leave all additional logic to our readline method, we just check the size - out = list() + out = [] nbr = 0 while True: line = self.readline() @@ -894,7 +894,7 @@ class Git(LazyMixin): def transform_kwargs(self, split_single_char_options=True, **kwargs): """Transforms Python style kwargs into git command line options.""" - args = list() + args = [] kwargs = OrderedDict(sorted(kwargs.items(), key=lambda x: x[0])) for k, v in kwargs.items(): if isinstance(v, (list, tuple)): @@ -913,7 +913,7 @@ class Git(LazyMixin): return [arg_list.encode(defenc)] return [str(arg_list)] - outlist = list() + outlist = [] for arg in arg_list: if isinstance(arg_list, (list, tuple)): outlist.extend(cls.__unpack_args(arg)) diff --git a/git/diff.py b/git/diff.py index 28c10e49..d7221ac7 100644 --- a/git/diff.py +++ b/git/diff.py @@ -61,7 +61,7 @@ class Diffable(object): :note: Subclasses require a repo member as it is the case for Object instances, for practical reasons we do not derive from Object.""" - __slots__ = tuple() + __slots__ = () # standin indicating you want to diff against the index class Index(object): @@ -106,7 +106,7 @@ class Diffable(object): :note: On a bare repository, 'other' needs to be provided as Index or as as Tree/Commit, or a git command error will occur""" - args = list() + args = [] args.append("--abbrev=40") # we need full shas args.append("--full-index") # get full index paths, not only filenames diff --git a/git/index/base.py b/git/index/base.py index a9e3a3c7..543a357b 100644 --- a/git/index/base.py +++ b/git/index/base.py @@ -121,7 +121,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): ok = True except OSError: # in new repositories, there may be no index, which means we are empty - self.entries = dict() + self.entries = {} return finally: if not ok: @@ -324,7 +324,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): if len(treeish) == 0 or len(treeish) > 3: raise ValueError("Please specify between 1 and 3 treeish, got %i" % len(treeish)) - arg_list = list() + arg_list = [] # ignore that working tree and index possibly are out of date if len(treeish) > 1: # drop unmerged entries when reading our index and merging @@ -471,9 +471,9 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): are at stage 3 will not have a stage 3 entry. """ is_unmerged_blob = lambda t: t[0] != 0 - path_map = dict() + path_map = {} for stage, blob in self.iter_blobs(is_unmerged_blob): - path_map.setdefault(blob.path, list()).append((stage, blob)) + path_map.setdefault(blob.path, []).append((stage, blob)) # END for each unmerged blob for l in mviter(path_map): l.sort() @@ -576,8 +576,8 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): def _preprocess_add_items(self, items): """ Split the items into two lists of path strings and BaseEntries. """ - paths = list() - entries = list() + paths = [] + entries = [] for item in items: if isinstance(item, string_types): @@ -610,7 +610,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): @unbare_repo @git_working_dir def _entries_for_paths(self, paths, path_rewriter, fprogress, entries): - entries_added = list() + entries_added = [] if path_rewriter: for path in paths: if osp.isabs(path): @@ -742,7 +742,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): # automatically # paths can be git-added, for everything else we use git-update-index paths, entries = self._preprocess_add_items(items) - entries_added = list() + entries_added = [] # This code needs a working tree, therefore we try not to run it unless required. # That way, we are OK on a bare repository as well. # If there are no paths, the rewriter has nothing to do either @@ -809,7 +809,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): def _items_to_rela_paths(self, items): """Returns a list of repo-relative paths from the given items which may be absolute or relative paths, entries or blobs""" - paths = list() + paths = [] for item in items: if isinstance(item, (BaseIndexEntry, (Blob, Submodule))): paths.append(self._to_relative_path(item.path)) @@ -858,7 +858,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): been removed effectively. This is interesting to know in case you have provided a directory or globs. Paths are relative to the repository. """ - args = list() + args = [] if not working_tree: args.append("--cached") args.append("--") @@ -897,7 +897,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): :raise ValueError: If only one item was given GitCommandError: If git could not handle your request""" - args = list() + args = [] if skip_errors: args.append('-k') @@ -910,7 +910,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): # first execute rename in dryrun so the command tells us what it actually does # ( for later output ) - out = list() + out = [] mvlines = self.repo.git.mv(args, paths, **kwargs).splitlines() # parse result - first 0:n/2 lines are 'checking ', the remaining ones @@ -1041,9 +1041,9 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): # line contents: stderr = stderr.decode(defenc) # git-checkout-index: this already exists - failed_files = list() - failed_reasons = list() - unknown_lines = list() + failed_files = [] + failed_reasons = [] + unknown_lines = [] endings = (' already exists', ' is not in the cache', ' does not exist at stage', ' is unmerged') for line in stderr.splitlines(): if not line.startswith("git checkout-index: ") and not line.startswith("git-checkout-index: "): @@ -1106,7 +1106,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable): proc = self.repo.git.checkout_index(args, **kwargs) # FIXME: Reading from GIL! make_exc = lambda: GitCommandError(("git-checkout-index",) + tuple(args), 128, proc.stderr.read()) - checked_out_files = list() + checked_out_files = [] for path in paths: co_path = to_native_path_linux(self._to_relative_path(path)) diff --git a/git/index/fun.py b/git/index/fun.py index c01a32b8..c8912dd2 100644 --- a/git/index/fun.py +++ b/git/index/fun.py @@ -187,7 +187,7 @@ def read_cache(stream): * content_sha is a 20 byte sha on all cache file contents""" version, num_entries = read_header(stream) count = 0 - entries = dict() + entries = {} read = stream.read tell = stream.tell @@ -236,7 +236,7 @@ def write_tree_from_cache(entries, odb, sl, si=0): :param sl: slice indicating the range we should process on the entries list :return: tuple(binsha, list(tree_entry, ...)) a tuple of a sha and a list of tree entries being a tuple of hexsha, mode, name""" - tree_items = list() + tree_items = [] tree_items_append = tree_items.append ci = sl.start end = sl.stop @@ -295,7 +295,7 @@ def aggressive_tree_merge(odb, tree_shas): :param tree_shas: 1, 2 or 3 trees as identified by their binary 20 byte shas If 1 or two, the entries will effectively correspond to the last given tree If 3 are given, a 3 way merge is performed""" - out = list() + out = [] out_append = out.append # one and two way is the same for us, as we don't have to handle an existing diff --git a/git/objects/blob.py b/git/objects/blob.py index 322f6992..897f892b 100644 --- a/git/objects/blob.py +++ b/git/objects/blob.py @@ -20,7 +20,7 @@ class Blob(base.IndexObject): file_mode = 0o100644 link_mode = 0o120000 - __slots__ = tuple() + __slots__ = () @property def mime_type(self): diff --git a/git/objects/commit.py b/git/objects/commit.py index f29fbaa2..b7d27d92 100644 --- a/git/objects/commit.py +++ b/git/objects/commit.py @@ -316,7 +316,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable): parent_commits = [repo.head.commit] except ValueError: # empty repositories have no head commit - parent_commits = list() + parent_commits = [] # END handle parent commits else: for p in parent_commits: @@ -450,7 +450,7 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable): readline = stream.readline self.tree = Tree(self.repo, hex_to_bin(readline().split()[1]), Tree.tree_id << 12, '') - self.parents = list() + self.parents = [] next_line = None while True: parent_line = readline() diff --git a/git/objects/fun.py b/git/objects/fun.py index d5b3f902..38dce0a5 100644 --- a/git/objects/fun.py +++ b/git/objects/fun.py @@ -50,7 +50,7 @@ def tree_entries_from_data(data): space_ord = ord(' ') len_data = len(data) i = 0 - out = list() + out = [] while i < len_data: mode = 0 @@ -132,18 +132,18 @@ def traverse_trees_recursive(odb, tree_shas, path_prefix): :param path_prefix: a prefix to be added to the returned paths on this level, set it '' for the first iteration :note: The ordering of the returned items will be partially lost""" - trees_data = list() + trees_data = [] nt = len(tree_shas) for tree_sha in tree_shas: if tree_sha is None: - data = list() + data = [] else: data = tree_entries_from_data(odb.stream(tree_sha).read()) # END handle muted trees trees_data.append(data) # END for each sha to get data for - out = list() + out = [] out_append = out.append # find all matching entries and recursively process them together if the match @@ -193,7 +193,7 @@ def traverse_tree_recursive(odb, tree_sha, path_prefix): * [1] mode as int * [2] path relative to the repository :param path_prefix: prefix to prepend to the front of all returned paths""" - entries = list() + entries = [] data = tree_entries_from_data(odb.stream(tree_sha).read()) # unpacking/packing is faster than accessing individual items diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py index b53ce3ec..f37da34a 100644 --- a/git/objects/submodule/base.py +++ b/git/objects/submodule/base.py @@ -60,7 +60,7 @@ class UpdateProgress(RemoteProgress): CLONE, FETCH, UPDWKTREE = [1 << x for x in range(RemoteProgress._num_op_codes, RemoteProgress._num_op_codes + 3)] _num_op_codes = RemoteProgress._num_op_codes + 3 - __slots__ = tuple() + __slots__ = () BEGIN = UpdateProgress.BEGIN @@ -139,7 +139,7 @@ class Submodule(IndexObject, Iterable, Traversable): try: return type(self).list_items(item.module()) except InvalidGitRepositoryError: - return list() + return [] # END handle intermediate items @classmethod diff --git a/git/objects/submodule/root.py b/git/objects/submodule/root.py index fbd658d7..f2035e5b 100644 --- a/git/objects/submodule/root.py +++ b/git/objects/submodule/root.py @@ -22,7 +22,7 @@ class RootUpdateProgress(UpdateProgress): 1 << x for x in range(UpdateProgress._num_op_codes, UpdateProgress._num_op_codes + 4)] _num_op_codes = UpdateProgress._num_op_codes + 4 - __slots__ = tuple() + __slots__ = () BEGIN = RootUpdateProgress.BEGIN @@ -38,7 +38,7 @@ class RootModule(Submodule): """A (virtual) Root of all submodules in the given repository. It can be used to more easily traverse all submodules of the master repository""" - __slots__ = tuple() + __slots__ = () k_root_name = '__ROOT__' diff --git a/git/objects/tree.py b/git/objects/tree.py index ed7c2435..d6134e30 100644 --- a/git/objects/tree.py +++ b/git/objects/tree.py @@ -189,7 +189,7 @@ class Tree(IndexObject, diff.Diffable, util.Traversable, util.Serializable): def _get_intermediate_items(cls, index_object): if index_object.type == "tree": return tuple(index_object._iter_convert_to_object(index_object._cache)) - return tuple() + return () def _set_cache_(self, attr): if attr == "_cache": diff --git a/git/objects/util.py b/git/objects/util.py index 5c085aec..f630f966 100644 --- a/git/objects/util.py +++ b/git/objects/util.py @@ -153,7 +153,7 @@ def parse_date(string_date): offset = utctz_to_altz(offset) # now figure out the date and time portion - split time - date_formats = list() + date_formats = [] splitter = -1 if ',' in string_date: date_formats.append("%a, %d %b %Y") @@ -248,7 +248,7 @@ class Traversable(object): into one direction. Subclasses only need to implement one function. Instances of the Subclass must be hashable""" - __slots__ = tuple() + __slots__ = () @classmethod def _get_intermediate_items(cls, item): @@ -344,7 +344,7 @@ class Traversable(object): class Serializable(object): """Defines methods to serialize and deserialize objects from and into a data stream""" - __slots__ = tuple() + __slots__ = () def _serialize(self, stream): """Serialize the data of this object into the given data stream diff --git a/git/refs/head.py b/git/refs/head.py index 9ad890db..4b0abb06 100644 --- a/git/refs/head.py +++ b/git/refs/head.py @@ -20,7 +20,7 @@ class HEAD(SymbolicReference): HEAD reference.""" _HEAD_NAME = 'HEAD' _ORIG_HEAD_NAME = 'ORIG_HEAD' - __slots__ = tuple() + __slots__ = () def __init__(self, repo, path=_HEAD_NAME): if path != self._HEAD_NAME: diff --git a/git/refs/log.py b/git/refs/log.py index 1c085ef1..ac2fe6ea 100644 --- a/git/refs/log.py +++ b/git/refs/log.py @@ -32,7 +32,7 @@ class RefLogEntry(tuple): """Named tuple allowing easy access to the revlog data fields""" _re_hexsha_only = re.compile('^[0-9A-Fa-f]{40}$') - __slots__ = tuple() + __slots__ = () def __repr__(self): """Representation of ourselves in git reflog format""" diff --git a/git/refs/reference.py b/git/refs/reference.py index 734ed8b9..aaa9b63f 100644 --- a/git/refs/reference.py +++ b/git/refs/reference.py @@ -27,7 +27,7 @@ class Reference(SymbolicReference, LazyMixin, Iterable): """Represents a named reference to any object. Subclasses may apply restrictions though, i.e. Heads can only point to commits.""" - __slots__ = tuple() + __slots__ = () _points_to_commits_only = False _resolve_ref_on_create = True _common_path_default = "refs" diff --git a/git/refs/symbolic.py b/git/refs/symbolic.py index 8efeafc5..a8ca6538 100644 --- a/git/refs/symbolic.py +++ b/git/refs/symbolic.py @@ -444,7 +444,7 @@ class SymbolicReference(object): pack_file_path = cls._get_packed_refs_path(repo) try: with open(pack_file_path, 'rb') as reader: - new_lines = list() + new_lines = [] made_change = False dropped_last_line = False for line in reader: diff --git a/git/refs/tag.py b/git/refs/tag.py index 37ee1240..8f88c522 100644 --- a/git/refs/tag.py +++ b/git/refs/tag.py @@ -17,7 +17,7 @@ class TagReference(Reference): if tagref.tag is not None: print(tagref.tag.message)""" - __slots__ = tuple() + __slots__ = () _common_path_default = "refs/tags" @property diff --git a/git/remote.py b/git/remote.py index 813566a2..947616dc 100644 --- a/git/remote.py +++ b/git/remote.py @@ -663,7 +663,7 @@ class Remote(LazyMixin, Iterable): # lines which are no progress are fetch info lines # this also waits for the command to finish # Skip some progress lines that don't provide relevant information - fetch_info_lines = list() + fetch_info_lines = [] # Basically we want all fetch info lines which appear to be in regular form, and thus have a # command character. Everything else we ignore, cmds = set(FetchInfo._flag_map.keys()) diff --git a/git/repo/base.py b/git/repo/base.py index ba589e11..26c7c7e5 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -519,7 +519,7 @@ class Repo(object): raise ValueError("Please specify at least two revs, got only %i" % len(rev)) # end handle input - res = list() + res = [] try: lines = self.git.merge_base(*rev, **kwargs).splitlines() except GitCommandError as err: @@ -580,7 +580,7 @@ class Repo(object): alts = f.read().decode(defenc) return alts.strip().splitlines() else: - return list() + return [] def _set_alternates(self, alts): """Sets the alternates @@ -664,7 +664,7 @@ class Repo(object): **kwargs) # Untracked files preffix in porcelain mode prefix = "?? " - untracked_files = list() + untracked_files = [] for line in proc.stdout: line = line.decode(defenc) if not line.startswith(prefix): @@ -704,7 +704,7 @@ class Repo(object): should get a continuous range spanning all line numbers in the file. """ data = self.git.blame(rev, '--', file, p=True, incremental=True, stdout_as_string=False, **kwargs) - commits = dict() + commits = {} stream = (line for line in data.split(b'\n') if line) while True: @@ -716,7 +716,7 @@ class Repo(object): if hexsha not in commits: # Now read the next few lines and build up a dict of properties # for this commit - props = dict() + props = {} while True: line = next(stream) if line == b'boundary': @@ -767,8 +767,8 @@ class Repo(object): return self.blame_incremental(rev, file, **kwargs) data = self.git.blame(rev, '--', file, p=True, stdout_as_string=False, **kwargs) - commits = dict() - blames = list() + commits = {} + blames = [] info = None keepends = True @@ -1001,7 +1001,7 @@ class Repo(object): if prefix and 'prefix' not in kwargs: kwargs['prefix'] = prefix kwargs['output_stream'] = ostream - path = kwargs.pop('path', list()) + path = kwargs.pop('path', []) if not isinstance(path, (tuple, list)): path = [path] # end assure paths is list diff --git a/git/test/performance/test_odb.py b/git/test/performance/test_odb.py index 425af84a..8bd614f2 100644 --- a/git/test/performance/test_odb.py +++ b/git/test/performance/test_odb.py @@ -28,11 +28,11 @@ class TestObjDBPerformance(TestBigRepoR): # GET TREES # walk all trees of all commits st = time() - blobs_per_commit = list() + blobs_per_commit = [] nt = 0 for commit in commits: tree = commit.tree - blobs = list() + blobs = [] for item in tree.traverse(): nt += 1 if item.type == 'blob': diff --git a/git/test/performance/test_streams.py b/git/test/performance/test_streams.py index 3909d8ff..2e3772a0 100644 --- a/git/test/performance/test_streams.py +++ b/git/test/performance/test_streams.py @@ -69,7 +69,7 @@ class TestObjDBPerformance(TestBigRepoR): # reading in chunks of 1 MiB cs = 512 * 1000 - chunks = list() + chunks = [] st = time() ostream = ldb.stream(binsha) while True: diff --git a/git/test/test_diff.py b/git/test/test_diff.py index 48a5a641..d21dde62 100644 --- a/git/test/test_diff.py +++ b/git/test/test_diff.py @@ -217,7 +217,7 @@ class TestDiff(TestBase): def test_diff_interface(self): # test a few variations of the main diff routine - assertion_map = dict() + assertion_map = {} for i, commit in enumerate(self.rorepo.iter_commits('0.1.6', max_count=2)): diff_item = commit if i % 2 == 0: diff --git a/git/test/test_index.py b/git/test/test_index.py index ec3c59df..56c7e795 100644 --- a/git/test/test_index.py +++ b/git/test/test_index.py @@ -97,7 +97,7 @@ class TestIndex(TestBase): def _reset_progress(self): # maps paths to the count of calls - self._fprogress_map = dict() + self._fprogress_map = {} def _assert_entries(self, entries): for entry in entries: @@ -141,7 +141,7 @@ class TestIndex(TestBase): if isinstance(tree, str): tree = self.rorepo.commit(tree).tree - blist = list() + blist = [] for blob in tree.traverse(predicate=lambda e, d: e.type == "blob", branch_first=False): assert (blob.path, 0) in index.entries blist.append(blob) @@ -527,7 +527,7 @@ class TestIndex(TestBase): # same index, no parents commit_message = "index without parents" - commit_no_parents = index.commit(commit_message, parent_commits=list(), head=True) + commit_no_parents = index.commit(commit_message, parent_commits=[], head=True) self.assertEqual(commit_no_parents.message, commit_message) self.assertEqual(len(commit_no_parents.parents), 0) self.assertEqual(cur_head.commit, commit_no_parents) diff --git a/git/test/test_refs.py b/git/test/test_refs.py index f885617e..348c3d48 100644 --- a/git/test/test_refs.py +++ b/git/test/test_refs.py @@ -45,7 +45,7 @@ class TestRefs(TestBase): TagReference(self.rorepo, "refs/invalid/tag", check_path=False) def test_tag_base(self): - tag_object_refs = list() + tag_object_refs = [] for tag in self.rorepo.tags: assert "refs/tags" in tag.path assert tag.name diff --git a/git/test/test_remote.py b/git/test/test_remote.py index 35924ca2..7c1711c2 100644 --- a/git/test/test_remote.py +++ b/git/test/test_remote.py @@ -44,8 +44,8 @@ class TestRemoteProgress(RemoteProgress): def __init__(self): super(TestRemoteProgress, self).__init__() - self._seen_lines = list() - self._stages_per_op = dict() + self._seen_lines = [] + self._stages_per_op = {} self._num_progress_messages = 0 def _parse_progress_line(self, line): diff --git a/git/test/test_tree.py b/git/test/test_tree.py index f3376e23..2b2ddb05 100644 --- a/git/test/test_tree.py +++ b/git/test/test_tree.py @@ -61,7 +61,7 @@ class TestTree(TestBase): def test_traverse(self): root = self.rorepo.tree('0.1.6') num_recursive = 0 - all_items = list() + all_items = [] for obj in root.traverse(): if "/" in obj.path: num_recursive += 1 diff --git a/git/util.py b/git/util.py index 688ead39..1186d311 100644 --- a/git/util.py +++ b/git/util.py @@ -369,7 +369,7 @@ class RemoteProgress(object): re_op_relative = re.compile(r"(remote: )?([\w\s]+):\s+(\d+)% \((\d+)/(\d+)\)(.*)") def __init__(self): - self._seen_ops = list() + self._seen_ops = [] self._cur_line = None self.error_lines = [] self.other_lines = [] @@ -392,7 +392,7 @@ class RemoteProgress(object): return [] sub_lines = line.split('\r') - failed_lines = list() + failed_lines = [] for sline in sub_lines: # find escape characters and cut them away - regex will not work with # them as they are non-ascii. As git might expect a tty, it will send them @@ -670,7 +670,7 @@ class Stats(object): """Create a Stat object from output retrieved by git-diff. :return: git.Stat""" - hsh = {'total': {'insertions': 0, 'deletions': 0, 'lines': 0, 'files': 0}, 'files': dict()} + hsh = {'total': {'insertions': 0, 'deletions': 0, 'lines': 0, 'files': 0}, 'files': {}} for line in text.splitlines(): (raw_insertions, raw_deletions, filename) = line.split("\t") insertions = raw_insertions != '-' and int(raw_insertions) or 0 @@ -917,7 +917,7 @@ class Iterable(object): """Defines an interface for iterable items which is to assure a uniform way to retrieve and iterate items within the git repository""" - __slots__ = tuple() + __slots__ = () _id_attribute_ = "attribute that most suitably identifies your instance" @classmethod @@ -45,7 +45,7 @@ class sdist(_sdist): def _stamp_version(filename): - found, out = False, list() + found, out = False, [] try: with open(filename, 'r') as f: for line in f: |