Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit52ee6c1

Browse files
committed
Merge branch 'fix/deepsource-issues' ofhttps://github.com/imkaka/GitPython into imkaka-fix/deepsource-issues
2 parents553500a +9932e64 commit52ee6c1

File tree

8 files changed

+19
-16
lines changed

8 files changed

+19
-16
lines changed

‎AUTHORS

Lines 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

‎git/cmd.py

Lines 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
returnout
505505

506+
# skipcq: PYL-E0301
506507
def__iter__(self):
507508
returnself
508509

‎git/diff.py

Lines 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-
forheaderincls.re_header.finditer(text):
435+
header=None
436+
for_headerincls.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
ifprevious_headerisnotNone:
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
ifindex:
474476
index[-1].diff=text[header.end():]

‎git/exc.py

Lines 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-
fromgitdb.excimport*# NOQA @UnusedWildImport
8+
fromgitdb.excimport*# NOQA @UnusedWildImport skipcq: PYL-W0401, PYL-W0614
99
fromgit.compatimportUnicodeMixin,safe_decode,string_types
1010

1111

‎git/objects/submodule/base.py

Lines 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
iflen(rrefs):
849-
del(rref)
849+
del(rref)# skipcq: PYL-W0631
850850
# END handle remotes
851851
del(rrefs)
852852
del(remote)

‎git/refs/log.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def message(self):
8484
returnself[4]
8585

8686
@classmethod
87-
defnew(self,oldhexsha,newhexsha,actor,time,tz_offset,message):
87+
defnew(cls,oldhexsha,newhexsha,actor,time,tz_offset,message):# skipcq: PYL-W0621
8888
""":return: New instance of a RefLogEntry"""
8989
ifnotisinstance(actor,Actor):
9090
raiseValueError("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
returnRefLogEntry((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-
ifindex<0:
221-
returnRefLogEntry.from_line(fp.readlines()[index].strip())
222-
else:
219+
withopen(filepath,'rb')asfp:
220+
ifindex<0:
221+
returnRefLogEntry.from_line(fp.readlines()[index].strip())
223222
# read until index is reached
224223
foriinxrange(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-
ifi!=indexornotline:
230+
ifi!=indexornotline:# skipcq:PYL-W0631
232231
raiseIndexError
233232
# END handle exception
234233

‎git/test/test_docs.py

Lines 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
assertlen(list(index.iter_blobs()))==len([oforoinrepo.head.commit.tree.traverse()ifo.type=='blob'])
351351
# Access blob objects
352-
for (path,_stage),entryinindex.entries.items():
352+
for (_path,_stage),entryinindex.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()

‎git/util.py

Lines 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
forbinp:
136-
iflen(b)==0:
136+
ifnotb:
137137
continue
138138
ifb.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')ifisinstance(line,bytes)elseline
389-
iflen(self.error_lines)>0orself._cur_line.startswith(('error:','fatal:')):
389+
ifself.error_linesorself._cur_line.startswith(('error:','fatal:')):
390390
self.error_lines.append(self._cur_line)
391391
return
392392

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp