Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 52ee6c1

Browse filesBrowse files
committed
Merge branch 'fix/deepsource-issues' of https://github.com/imkaka/GitPython into imkaka-fix/deepsource-issues
2 parents 553500a + 9932e64 commit 52ee6c1
Copy full SHA for 52ee6c1

8 files changed

+19-16Lines changed: 19 additions & 16 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎AUTHORS‎

Copy file name to clipboardExpand all lines: AUTHORS
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Contributors are:
3434
-Stefan Stancu <stefan.stancu _at_ gmail.com>
3535
-César Izurieta <cesar _at_ caih.org>
3636
-Arthur Milchior <arthur _at_ milchior.fr>
37+
-Anil Khatri <anil.soccer.khatri _at_ gmail.com>
3738
-JJ Graham <thetwoj _at_ gmail.com>
3839
-Ben Thayer <ben _at_ benthayer.com>
3940

Collapse file

‎git/cmd.py‎

Copy file name to clipboardExpand all lines: git/cmd.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ def readlines(self, size=-1):
503503
# END readline loop
504504
return out
505505

506+
# skipcq: PYL-E0301
506507
def __iter__(self):
507508
return self
508509

Collapse file

‎git/diff.py‎

Copy file name to clipboardExpand all lines: git/diff.py
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -432,13 +432,14 @@ def _index_from_patch_format(cls, repo, proc):
432432
text = b''.join(text)
433433
index = DiffIndex()
434434
previous_header = None
435-
for header in cls.re_header.finditer(text):
435+
header = None
436+
for _header in cls.re_header.finditer(text):
436437
a_path_fallback, b_path_fallback, \
437438
old_mode, new_mode, \
438439
rename_from, rename_to, \
439440
new_file_mode, deleted_file_mode, copied_file_name, \
440441
a_blob_id, b_blob_id, b_mode, \
441-
a_path, b_path = header.groups()
442+
a_path, b_path = _header.groups()
442443

443444
new_file, deleted_file, copied_file = \
444445
bool(new_file_mode), bool(deleted_file_mode), bool(copied_file_name)
@@ -449,7 +450,7 @@ def _index_from_patch_format(cls, repo, proc):
449450
# Our only means to find the actual text is to see what has not been matched by our regex,
450451
# and then retro-actively assign it to our index
451452
if previous_header is not None:
452-
index[-1].diff = text[previous_header.end():header.start()]
453+
index[-1].diff = text[previous_header.end():_header.start()]
453454
# end assign actual diff
454455

455456
# Make sure the mode is set if the path is set. Otherwise the resulting blob is invalid
@@ -468,7 +469,8 @@ def _index_from_patch_format(cls, repo, proc):
468469
rename_to,
469470
None, None, None))
470471

471-
previous_header = header
472+
previous_header = _header
473+
header = _header
472474
# end for each header we parse
473475
if index:
474476
index[-1].diff = text[header.end():]
Collapse file

‎git/exc.py‎

Copy file name to clipboardExpand all lines: git/exc.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66
""" Module containing all exceptions thrown throughout the git package, """
77

8-
from gitdb.exc import * # NOQA @UnusedWildImport
8+
from gitdb.exc import * # NOQA @UnusedWildImport skipcq: PYL-W0401, PYL-W0614
99
from git.compat import UnicodeMixin, safe_decode, string_types
1010

1111

Collapse file

‎git/objects/submodule/base.py‎

Copy file name to clipboardExpand all lines: git/objects/submodule/base.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ def remove(self, module=True, force=False, configuration=True, dry_run=False):
846846
# have to manually delete references as python's scoping is
847847
# not existing, they could keep handles open ( on windows this is a problem )
848848
if len(rrefs):
849-
del(rref)
849+
del(rref) # skipcq: PYL-W0631
850850
# END handle remotes
851851
del(rrefs)
852852
del(remote)
Collapse file

‎git/refs/log.py‎

Copy file name to clipboardExpand all lines: git/refs/log.py
+6-7Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def message(self):
8484
return self[4]
8585

8686
@classmethod
87-
def new(self, oldhexsha, newhexsha, actor, time, tz_offset, message):
87+
def new(cls, oldhexsha, newhexsha, actor, time, tz_offset, message): # skipcq: PYL-W0621
8888
""":return: New instance of a RefLogEntry"""
8989
if not isinstance(actor, Actor):
9090
raise ValueError("Need actor instance, got %s" % actor)
@@ -121,7 +121,7 @@ def from_line(cls, line):
121121
# END handle missing end brace
122122

123123
actor = Actor._from_string(info[82:email_end + 1])
124-
time, tz_offset = parse_date(info[email_end + 2:])
124+
time, tz_offset = parse_date(info[email_end + 2:]) # skipcq: PYL-W0621
125125

126126
return RefLogEntry((oldhexsha, newhexsha, actor, (time, tz_offset), msg))
127127

@@ -216,10 +216,9 @@ def entry_at(cls, filepath, index):
216216
all other lines. Nonetheless, the whole file has to be read if
217217
the index is negative
218218
"""
219-
fp = open(filepath, 'rb')
220-
if index < 0:
221-
return RefLogEntry.from_line(fp.readlines()[index].strip())
222-
else:
219+
with open(filepath, 'rb') as fp:
220+
if index < 0:
221+
return RefLogEntry.from_line(fp.readlines()[index].strip())
223222
# read until index is reached
224223
for i in xrange(index + 1):
225224
line = fp.readline()
@@ -228,7 +227,7 @@ def entry_at(cls, filepath, index):
228227
# END abort on eof
229228
# END handle runup
230229

231-
if i != index or not line:
230+
if i != index or not line: # skipcq:PYL-W0631
232231
raise IndexError
233232
# END handle exception
234233

Collapse file

‎git/test/test_docs.py‎

Copy file name to clipboardExpand all lines: git/test/test_docs.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def test_references_and_objects(self, rw_dir):
349349
# The index contains all blobs in a flat list
350350
assert len(list(index.iter_blobs())) == len([o for o in repo.head.commit.tree.traverse() if o.type == 'blob'])
351351
# Access blob objects
352-
for (path, _stage), entry in index.entries.items():
352+
for (_path, _stage), entry in index.entries.items():
353353
pass
354354
new_file_path = os.path.join(repo.working_tree_dir, 'new-file-name')
355355
open(new_file_path, 'w').close()
Collapse file

‎git/util.py‎

Copy file name to clipboardExpand all lines: git/util.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def join_path(a, *p):
133133
'/' instead of possibly '\' on windows."""
134134
path = a
135135
for b in p:
136-
if len(b) == 0:
136+
if not b:
137137
continue
138138
if b.startswith('/'):
139139
path += b[1:]
@@ -386,7 +386,7 @@ def _parse_progress_line(self, line):
386386
# Compressing objects: 100% (2/2)
387387
# Compressing objects: 100% (2/2), done.
388388
self._cur_line = line = line.decode('utf-8') if isinstance(line, bytes) else line
389-
if len(self.error_lines) > 0 or self._cur_line.startswith(('error:', 'fatal:')):
389+
if self.error_lines or self._cur_line.startswith(('error:', 'fatal:')):
390390
self.error_lines.append(self._cur_line)
391391
return
392392

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.