Skip to content

Fix/deepsource issues #952

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 13 commits into from
Oct 29, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion git/objects/submodule/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ def remove(self, module=True, force=False, configuration=True, dry_run=False):
# have to manually delete references as python's scoping is
# not existing, they could keep handles open ( on windows this is a problem )
if len(rrefs):
del(rref) # skipcq:PYL-W0631
del(rref) # skipcq: PYL-W0631
# END handle remotes
del(rrefs)
del(remote)
Expand Down
45 changes: 22 additions & 23 deletions git/refs/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ def __repr__(self):
def format(self):
""":return: a string suitable to be placed in a reflog file"""
act = self.actor
time = self.time
time_ = self.time_
return u"{} {} {} <{}> {!s} {}\t{}\n".format(self.oldhexsha,
self.newhexsha,
act.name,
act.email,
time[0],
altz_to_utctz_str(time[1]),
time_[0],
altz_to_utctz_str(time_[1]),
self.message)

@property
Expand All @@ -71,7 +71,7 @@ def actor(self):
return self[2]

@property
def time(self):
def time_(self):
"""time as tuple:

* [0] = int(time)
Expand All @@ -84,12 +84,12 @@ def message(self):
return self[4]

@classmethod
def new(cls, oldhexsha, newhexsha, actor, time, tz_offset, message):
def new(cls, oldhexsha, newhexsha, actor, time_, tz_offset, message):
""":return: New instance of a RefLogEntry"""
if not isinstance(actor, Actor):
raise ValueError("Need actor instance, got %s" % actor)
# END check types
return RefLogEntry((oldhexsha, newhexsha, actor, (time, tz_offset), message))
return RefLogEntry((oldhexsha, newhexsha, actor, (time_, tz_offset), message))

@classmethod
def from_line(cls, line):
Expand Down Expand Up @@ -121,9 +121,9 @@ def from_line(cls, line):
# END handle missing end brace

actor = Actor._from_string(info[82:email_end + 1])
time, tz_offset = parse_date(info[email_end + 2:])
time_, tz_offset = parse_date(info[email_end + 2:])

return RefLogEntry((oldhexsha, newhexsha, actor, (time, tz_offset), msg))
return RefLogEntry((oldhexsha, newhexsha, actor, (time_, tz_offset), msg))


class RefLog(list, Serializable):
Expand Down Expand Up @@ -220,21 +220,20 @@ def entry_at(cls, filepath, index):
with open(filepath, 'rb') as fp:
if index < 0:
return RefLogEntry.from_line(fp.readlines()[index].strip())
else:
# read until index is reached
for i in xrange(index + 1):
line = fp.readline()
if not line:
break
# END abort on eof
# END handle runup

if i != index or not line: # skipcq:PYL-W0631
raise IndexError
# END handle exception

return RefLogEntry.from_line(line.strip())
# END handle index
# read until index is reached
for i in xrange(index + 1):
line = fp.readline()
if not line:
break
# END abort on eof
# END handle runup

if i != index or not line: # skipcq:PYL-W0631
raise IndexError
# END handle exception

return RefLogEntry.from_line(line.strip())
# END handle index

def to_file(self, filepath):
"""Write the contents of the reflog instance to a file at the given filepath.
Expand Down