diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2020-05-18 19:05:05 +0300 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2020-05-20 16:54:36 +0300 |
commit | 513ad0fab28255496b9ba40803c87880edeb70b0 (patch) | |
tree | b59c2daaad575c48975730b6f7c5d2c2391170be | |
parent | b11ef2ffff507e3e132891b29bfc83fc737d6981 (diff) |
Mark unused variable in uses of os.walk()
B007 Loop control variable 'subdirs' not used within the loop body. If this is intended, start the name with an underscore.
-rw-r--r-- | calm/dedupsrc.py | 4 | ||||
-rw-r--r-- | calm/find-duplicates.py | 2 | ||||
-rw-r--r-- | calm/fix-annotate-perl-hint.py | 2 | ||||
-rw-r--r-- | calm/fix-skip-only-hint.py | 4 | ||||
-rw-r--r-- | calm/hint-migrate.py | 2 | ||||
-rwxr-xr-x | calm/package.py | 2 | ||||
-rwxr-xr-x | test/test_calm.py | 6 |
7 files changed, 11 insertions, 11 deletions
diff --git a/calm/dedupsrc.py b/calm/dedupsrc.py index 4bf48ea..5f84aea 100644 --- a/calm/dedupsrc.py +++ b/calm/dedupsrc.py @@ -55,7 +55,7 @@ def hint_file_write(fn, hints): # def invent_sdesc(path, vr): - for (dirpath, subdirs, files) in os.walk(path): + for (dirpath, _subdirs, files) in os.walk(path): # debuginfo packages never have a good sdesc if 'debuginfo' in dirpath: continue @@ -170,7 +170,7 @@ def dedup(archive, relarea): # adjust external-source in .hint for all subpackages for arch in ['x86', 'x86_64']: - for (dirpath, subdirs, files) in os.walk(os.path.join(relarea, arch, path)): + for (dirpath, _subdirs, files) in os.walk(os.path.join(relarea, arch, path)): subpkg = os.path.basename(dirpath) filename = subpkg + '-' + vr + '.hint' if filename in files: diff --git a/calm/find-duplicates.py b/calm/find-duplicates.py index ec850a4..7e49219 100644 --- a/calm/find-duplicates.py +++ b/calm/find-duplicates.py @@ -131,7 +131,7 @@ def compare_archives(f1, f2): def find_duplicates(args): basedir = os.path.join(args.rel_area, common_constants.ARCHES[0], 'release') - for (dirpath, subdirs, files) in os.walk(basedir): + for (dirpath, _subdirs, files) in os.walk(basedir): relpath = os.path.relpath(dirpath, basedir) otherdir = os.path.join(args.rel_area, common_constants.ARCHES[1], 'release', relpath) diff --git a/calm/fix-annotate-perl-hint.py b/calm/fix-annotate-perl-hint.py index d3cf1cf..0f2679a 100644 --- a/calm/fix-annotate-perl-hint.py +++ b/calm/fix-annotate-perl-hint.py @@ -64,7 +64,7 @@ def fix_one_hint(dirpath, hintfile): def fix_hints(relarea): - for (dirpath, subdirs, files) in os.walk(relarea): + for (dirpath, _subdirs, files) in os.walk(relarea): for f in files: if f.endswith('.hint'): fix_one_hint(dirpath, f) diff --git a/calm/fix-skip-only-hint.py b/calm/fix-skip-only-hint.py index 4ea0b1b..d25387a 100644 --- a/calm/fix-skip-only-hint.py +++ b/calm/fix-skip-only-hint.py @@ -77,7 +77,7 @@ def invent_from_subpackages(path, vr): sdesc_candidates = [] category_candidates = [] - for (dirpath, subdirs, files) in os.walk(path): + for (dirpath, _subdirs, files) in os.walk(path): # debuginfo packages never have a good information if 'debuginfo' in dirpath: continue @@ -180,7 +180,7 @@ def fix_hints(rel_area, mode): skip_only = 0 invented = 0 - for (dirpath, subdirs, files) in os.walk(rel_area): + for (dirpath, _subdirs, files) in os.walk(rel_area): vrs = {} for f in files: match = re.match(r'^.*?-(\d.*).hint$', f) diff --git a/calm/hint-migrate.py b/calm/hint-migrate.py index d4c166e..d7c6f41 100644 --- a/calm/hint-migrate.py +++ b/calm/hint-migrate.py @@ -42,7 +42,7 @@ def hint_migrate(args): for arch in common_constants.ARCHES + ['noarch']: basedir = os.path.join(args.rel_area, arch, 'release') - for (dirpath, subdirs, files) in os.walk(basedir): + for (dirpath, _subdirs, files) in os.walk(basedir): if 'setup.hint' not in files: continue diff --git a/calm/package.py b/calm/package.py index 2790206..e286274 100755 --- a/calm/package.py +++ b/calm/package.py @@ -113,7 +113,7 @@ def read_packages(rel_area, arch): releasedir = os.path.join(rel_area, root) logging.debug('reading packages from %s' % releasedir) - for (dirpath, subdirs, files) in os.walk(releasedir, followlinks=True): + for (dirpath, _subdirs, files) in os.walk(releasedir, followlinks=True): read_package_dir(packages[root], rel_area, dirpath, files) logging.debug("%d packages read from %s" % (len(packages[root]), releasedir)) diff --git a/test/test_calm.py b/test/test_calm.py index 712c7bc..56af515 100755 --- a/test/test_calm.py +++ b/test/test_calm.py @@ -85,7 +85,7 @@ def compare_with_expected_file(test, dirpath, results, basename=None): def capture_dirtree(basedir): tree = {} - for dirpath, dirnames, filenames in os.walk(basedir): + for dirpath, _dirnames, filenames in os.walk(basedir): tree[os.path.relpath(dirpath, basedir)] = sorted(filenames) return tree @@ -131,7 +131,7 @@ class CalmTest(unittest.TestCase): self.maxDiff = None basedir = 'testdata/relarea' - for (dirpath, subdirs, files) in os.walk(basedir): + for (dirpath, _subdirs, files) in os.walk(basedir): relpath = os.path.relpath(dirpath, basedir) for f in files: expected = os.path.join('testdata/hints', relpath) @@ -183,7 +183,7 @@ class CalmTest(unittest.TestCase): compare_with_expected_file(self, 'testdata/htdocs.expected', dirlist, 'dirtree') # compare the output files with expected - for (dirpath, subdirs, files) in os.walk(htdocs): + for (dirpath, _subdirs, files) in os.walk(htdocs): relpath = os.path.relpath(dirpath, htdocs) for f in files: with self.subTest(file=os.path.join(relpath, f)): |