Skip to content

Fix if else #940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Oct 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion git/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ def __del__(self):
proc.wait() # ensure process goes away
except OSError as ex:
log.info("Ignored error after process had died: %r", ex)
pass # ignore error when process already died
except AttributeError:
# try windows
# for some reason, providing None for stdout/stderr still prints something. This is why
Expand Down
9 changes: 3 additions & 6 deletions git/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,12 @@ def __str__(self):
def u(text):
if PY3:
return text
else:
return text.decode('unicode_escape')
return text.decode('unicode_escape')

def b(data):
if PY3:
return data.encode('latin1')
else:
return data
return data

if PY3:
_unichr = chr
Expand Down Expand Up @@ -282,8 +280,7 @@ def encodefilename(fn):
ch_utf8 = ch.encode('utf-8')
encoded.append(ch_utf8)
return bytes().join(encoded)
else:
return fn.encode(FS_ENCODING, FS_ERRORS)
return fn.encode(FS_ENCODING, FS_ERRORS)

def decodefilename(fn):
return fn.decode(FS_ENCODING, FS_ERRORS)
Expand Down
3 changes: 1 addition & 2 deletions git/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,7 @@ def string_decode(v):

if PY3:
return v.encode(defenc).decode('unicode_escape')
else:
return v.decode('string_escape')
return v.decode('string_escape')
# end
# end

Expand Down
3 changes: 1 addition & 2 deletions git/index/fun.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,7 @@ def entry_key(*entry):
:param entry: One instance of type BaseIndexEntry or the path and the stage"""
if len(entry) == 1:
return (entry[0].path, entry[0].stage)
else:
return tuple(entry)
return tuple(entry)
# END handle entry


Expand Down
3 changes: 1 addition & 2 deletions git/objects/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ def count(self, paths='', **kwargs):
# as the empty paths version will ignore merge commits for some reason.
if paths:
return len(self.repo.git.rev_list(self.hexsha, '--', paths, **kwargs).splitlines())
else:
return len(self.repo.git.rev_list(self.hexsha, **kwargs).splitlines())
return len(self.repo.git.rev_list(self.hexsha, **kwargs).splitlines())

@property
def name_rev(self):
Expand Down
3 changes: 1 addition & 2 deletions git/objects/submodule/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,7 @@ def _config_parser_constrained(self, read_only):
def _module_abspath(cls, parent_repo, path, name):
if cls._need_gitfile_submodules(parent_repo.git):
return osp.join(parent_repo.git_dir, 'modules', name)
else:
return osp.join(parent_repo.working_tree_dir, path)
return osp.join(parent_repo.working_tree_dir, path)
# end

@classmethod
Expand Down
3 changes: 1 addition & 2 deletions git/refs/head.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,7 @@ def checkout(self, force=False, **kwargs):
self.repo.git.checkout(self, **kwargs)
if self.repo.head.is_detached:
return self.repo.head
else:
return self.repo.active_branch
return self.repo.active_branch

#{ Configuration
def _config_parser(self, read_only):
Expand Down
7 changes: 3 additions & 4 deletions git/refs/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ def __repr__(self):
res = self.format()
if PY3:
return res
else:
# repr must return a string, which it will auto-encode from unicode using the default encoding.
# This usually fails, so we encode ourselves
return res.encode(defenc)
# repr must return a string, which it will auto-encode from unicode using the default encoding.
# This usually fails, so we encode ourselves
return res.encode(defenc)

def format(self):
""":return: a string suitable to be placed in a reflog file"""
Expand Down
3 changes: 1 addition & 2 deletions git/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ def to_progress_instance(progress):
return RemoteProgress()

# assume its the old API with an instance of RemoteProgress.
else:
return progress
return progress


class PushInfo(object):
Expand Down
9 changes: 3 additions & 6 deletions git/repo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,7 @@ def commit(self, rev=None):
:return: ``git.Commit``"""
if rev is None:
return self.head.commit
else:
return self.rev_parse(text_type(rev) + "^0")
return self.rev_parse(text_type(rev) + "^0")

def iter_trees(self, *args, **kwargs):
""":return: Iterator yielding Tree objects
Expand All @@ -501,8 +500,7 @@ def tree(self, rev=None):
operations might have unexpected results."""
if rev is None:
return self.head.commit.tree
else:
return self.rev_parse(text_type(rev) + "^{tree}")
return self.rev_parse(text_type(rev) + "^{tree}")

def iter_commits(self, rev=None, paths='', **kwargs):
"""A list of Commit objects representing the history of a given ref/commit
Expand Down Expand Up @@ -601,8 +599,7 @@ def _get_alternates(self):
with open(alternates_path, 'rb') as f:
alts = f.read().decode(defenc)
return alts.strip().splitlines()
else:
return []
return []

def _set_alternates(self, alts):
"""Sets the alternates
Expand Down
5 changes: 2 additions & 3 deletions git/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,8 @@ def _from_string(cls, string):
m = cls.name_only_regex.search(string)
if m:
return Actor(m.group(1), None)
else:
# assume best and use the whole string as name
return Actor(string, None)
# assume best and use the whole string as name
return Actor(string, None)
# END special case name
# END handle name/email matching

Expand Down