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 /git/repo/base.py | |
parent | 14582df679a011e8c741eb5dcd8126f883e1bc71 (diff) | |
download | gitpython-ac4f7d34f8752ab78949efcaa9f0bd938df33622.tar.gz |
Rewrite unnecessary dict/list/tuple calls as literals
Diffstat (limited to 'git/repo/base.py')
-rw-r--r-- | git/repo/base.py | 16 |
1 files changed, 8 insertions, 8 deletions
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 |