From 942aab570caf00e1ff4aa7ad6746168d49336607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Klitzing?= Date: Wed, 31 Jul 2019 10:23:12 +0200 Subject: [PATCH] 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. --- patch.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/patch.py b/patch.py index 4b82af0..79b1540 100755 --- a/patch.py +++ b/patch.py @@ -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: @@ -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)) @@ -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