From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2201) id 5F3E038930DE; Wed, 17 Jun 2020 14:24:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5F3E038930DE To: cygwin-apps-cvs@sourceware.org Subject: [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20200611-4-g04bd5e1 X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 9820d31f258a099be2ac6638985b2ff7c5da78ce X-Git-Newrev: 04bd5e1f23173972fcb095c6d34167fe55765313 Message-Id: <20200617142405.5F3E038930DE@sourceware.org> Date: Wed, 17 Jun 2020 14:24:05 +0000 (GMT) From: Jon TURNEY X-BeenThere: cygwin-apps-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin-apps git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2020 14:24:05 -0000 https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=04bd5e1f23173972fcb095c6d34167fe55765313 commit 04bd5e1f23173972fcb095c6d34167fe55765313 Author: Jon Turney Date: Thu Jun 11 16:01:27 2020 +0100 Also use flake8-builtins in CI https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=971a99a1ea11874f0cb4e30dc2c24c1d664aaf5a commit 971a99a1ea11874f0cb4e30dc2c24c1d664aaf5a Author: Jon Turney Date: Thu Jun 11 16:06:46 2020 +0100 Avoid shadowing 'dir' builtin A001 "dir" is a python builtin and is being shadowed, consider renaming the variable https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=00aa2d297c2c10942fb7b7aded4927a733350b8b commit 00aa2d297c2c10942fb7b7aded4927a733350b8b Author: Jon Turney Date: Mon May 18 18:11:56 2020 +0100 Avoid shadowing 'object' builtin A002 "object" is used as an argument and thus shadows a python builtin, consider renaming the argument https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=945c5344a60bcdc03483a4c58391dfe385085176 commit 945c5344a60bcdc03483a4c58391dfe385085176 Author: Jon Turney Date: Tue Jun 9 23:08:12 2020 +0100 Avoid shadowing 'type' builtin A001 "type" is a python builtin and is being shadowed, consider renaming the variable Diff: --- .flake8 | 2 +- calm/hint.py | 8 ++++---- calm/pkg2html.py | 12 ++++++------ requirements.txt | 1 + test/test_calm.py | 6 +++--- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.flake8 b/.flake8 index 8b0a9b0..81548f7 100644 --- a/.flake8 +++ b/.flake8 @@ -1,3 +1,3 @@ [flake8] -ignore=E741,E129,W504 +ignore=E741,E129,W504,A003 max-line-length=240 diff --git a/calm/hint.py b/calm/hint.py index 01ef085..5b4935b 100755 --- a/calm/hint.py +++ b/calm/hint.py @@ -224,17 +224,17 @@ def hint_file_parse(fn, kind): if key not in hintkeys[kind]: errors.append('unknown key %s at line %d' % (key, i)) continue - type = hintkeys[kind][key] + valtype = hintkeys[kind][key] # check if the key occurs more than once if key in hints: errors.append('duplicate key %s' % (key)) # check the value meets any key-specific constraints - if (type == 'val') and (len(value) == 0): + if (valtype == 'val') and (len(value) == 0): errors.append('%s has empty value' % (key)) - if (type == 'noval') and (len(value) != 0): + if (valtype == 'noval') and (len(value) != 0): errors.append("%s has non-empty value '%s'" % (key, value)) # validate all categories are in the category list (case-insensitively) @@ -267,7 +267,7 @@ def hint_file_parse(fn, kind): value = value.replace(' ', ' ') # only 'ldesc' and 'message' are allowed a multi-line value - if (type != 'multilineval') and (len(value.splitlines()) > 1): + if (valtype != 'multilineval') and (len(value.splitlines()) > 1): errors.append("key %s has multi-line value" % (key)) # message must have an id and some text diff --git a/calm/pkg2html.py b/calm/pkg2html.py index 3750e81..4840734 100755 --- a/calm/pkg2html.py +++ b/calm/pkg2html.py @@ -408,14 +408,14 @@ def write_arch_listing(args, packages, arch): for p in packages: - dir = os.path.join(base, p) - ensure_dir_exists(args, dir) + dirpath = os.path.join(base, p) + ensure_dir_exists(args, dirpath) # # write .htaccess if needed # - htaccess = os.path.join(dir, '.htaccess') + htaccess = os.path.join(dirpath, '.htaccess') if not os.path.exists(htaccess): if not args.dryrun or args.force: with utils.open_amifc(htaccess) as f: @@ -437,15 +437,15 @@ def write_arch_listing(args, packages, arch): # # for each tarfile, write tarfile listing # - if os.path.exists(dir): - listings = os.listdir(dir) + if os.path.exists(dirpath): + listings = os.listdir(dirpath) listings.remove('.htaccess') else: listings = [] for tn, to in itertools.chain.from_iterable([packages[p].tars[vr].items() for vr in packages[p].tars]): fver = re.sub(r'\.tar.*$', '', tn) - listing = os.path.join(dir, fver) + listing = os.path.join(dirpath, fver) # ... if it doesn't already exist, or --force --force if not os.path.exists(listing) or (args.force > 1): diff --git a/requirements.txt b/requirements.txt index f7e4f65..2363fcf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,7 @@ dirq flake8 flake8-blind-except flake8-bugbear ; python_version >= "3.5" +flake8-builtins flake8-import-order == 0.14.1 lockfile pycodestyle diff --git a/test/test_calm.py b/test/test_calm.py index 8c926bf..b1b82b4 100755 --- a/test/test_calm.py +++ b/test/test_calm.py @@ -96,14 +96,14 @@ def capture_dirtree(basedir): # (a dict, with lines ordered, rather than OrderedDict repr) # -def patched_pprint_ordered_dict(self, object, stream, indent, allowance, context, level): +def patched_pprint_ordered_dict(self, obj, stream, indent, allowance, context, level): write = stream.write write('{') if self._indent_per_level > 1: write((self._indent_per_level - 1) * ' ') - length = len(object) + length = len(obj) if length: - items = list(object.items()) + items = list(obj.items()) self._format_dict_items(items, stream, indent, allowance + 1, context, level) write('}')