Skip to content
Open
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
Fix some issues found by lgtm.com
* This import of module shutil is redundant, as it was previously imported on line 35.
* Testing for None should use the 'is' operator.
* The value assigned to local variable 'hno' is never used.
  • Loading branch information
misery committed Jul 31, 2019
commit 942aab570caf00e1ff4aa7ad6746168d49336607
4 changes: 1 addition & 3 deletions patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def lineno(self):
header.append(fe.line)
fe.next()
if fe.is_empty:
if p == None:
if p is None:
debug("no patch data found") # error is shown later
self.errors += 1
else:
Expand Down Expand Up @@ -941,7 +941,6 @@ def apply(self, strip=0, root=None):
if exists(backupname):
warning("can't backup original file to %s - aborting" % backupname)
else:
import shutil
shutil.move(filename, backupname)
if self.write_hunks(backupname, filename, p.hunks):
info("successfully patched %d/%d:\t %s" % (i+1, total, filename))
Expand Down Expand Up @@ -1005,7 +1004,6 @@ class NoMatch(Exception):

lineno = 1
line = fp.readline()
hno = None
try:
for hno, h in enumerate(hunks):
# skip to first line of the hunk
Expand Down