From 4664b4353cd93c72e92d7d0fc7188b264db556a2 Mon Sep 17 00:00:00 2001 From: Reid 'arrdem' McKenzie Date: Mon, 30 Aug 2021 00:43:58 -0600 Subject: [PATCH] Lint headway --- projects/damm/test/python/test_damm.py | 8 ++++---- projects/proquint/test/python/test_hypothesis.py | 8 ++++---- .../public-dns/src/python/arrdem/updater/__main__.py | 10 +++++----- projects/reqman/src/python/reqman/__main__.py | 9 +++++---- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/projects/damm/test/python/test_damm.py b/projects/damm/test/python/test_damm.py index d33005e..323d44b 100644 --- a/projects/damm/test/python/test_damm.py +++ b/projects/damm/test/python/test_damm.py @@ -3,10 +3,10 @@ import pytest @pytest.mark.parametrize("num", [ - "0", # 0 itself is the start Damm state - "37", # [0, 3] => 7 - "92", # [0, 9] => 2 - "1234", # Amusingly, this is a 0-product. + "0", # 0 itself is the start Damm state + "37", # [0, 3] => 7 + "92", # [0, 9] => 2 + "1234", # Amusingly, this is a 0-product. ]) def test_num_verifies(num): """Assert that known-good Damm checks pass.""" diff --git a/projects/proquint/test/python/test_hypothesis.py b/projects/proquint/test/python/test_hypothesis.py index d930643..c459e20 100644 --- a/projects/proquint/test/python/test_hypothesis.py +++ b/projects/proquint/test/python/test_hypothesis.py @@ -5,25 +5,25 @@ from hypothesis.strategies import integers import proquint -@given(integers(min_value=0, max_value=1 << 16)) +@given(integers(min_value=0, max_value=1<<16)) def test_round_trip_16(val): assert proquint.Proquint.decode( proquint.Proquint.encode(val, 16)) == val -@given(integers(min_value=0, max_value=1 << 32)) +@given(integers(min_value=0, max_value=1<<32)) def test_round_trip_32(val): assert proquint.Proquint.decode( proquint.Proquint.encode(val, 32)) == val -@given(integers(min_value=0, max_value=1 << 64)) +@given(integers(min_value=0, max_value=1<<64)) def test_round_trip_64(val): assert proquint.Proquint.decode( proquint.Proquint.encode(val, 64)) == val -@given(integers(min_value=0, max_value=1 << 512)) +@given(integers(min_value=0, max_value=1<<512)) def test_round_trip_512(val): assert proquint.Proquint.decode( proquint.Proquint.encode(val, 512)) == val diff --git a/projects/public-dns/src/python/arrdem/updater/__main__.py b/projects/public-dns/src/python/arrdem/updater/__main__.py index aefb0f1..0e326f8 100644 --- a/projects/public-dns/src/python/arrdem/updater/__main__.py +++ b/projects/public-dns/src/python/arrdem/updater/__main__.py @@ -14,11 +14,11 @@ import yaml RECORD_LINE_PATTERN = re.compile( - "^(?P\S+)\s+" - "(?P\S+)\s+" - "IN\s+" - "(?P\S+)\s+" - "(?P.+)$" + r"^(?P\S+)\s+" + r"(?P\S+)\s+" + r"IN\s+" + r"(?P\S+)\s+" + r"(?P.+)$" ) diff --git a/projects/reqman/src/python/reqman/__main__.py b/projects/reqman/src/python/reqman/__main__.py index 13c92b0..a18f93a 100644 --- a/projects/reqman/src/python/reqman/__main__.py +++ b/projects/reqman/src/python/reqman/__main__.py @@ -39,6 +39,7 @@ SHITLIST = [ "setuptools", ] + def req_name(requirement: str) -> str: requirement = requirement.lower() match = re.match(REQ_PATTERN, requirement) @@ -58,9 +59,9 @@ def _bq(query): """Enumerate the PyPi package names from a Bazel query.""" unused = subprocess.check_output(["bazel", "query", query, "--output=package"]).decode("utf-8") - for l in unused.split("\n"): - if l: - yield l.replace("@arrdem_source_pypi//pypi__", "") + for line in unused.split("\n"): + if line: + yield line.replace("@arrdem_source_pypi//pypi__", "") def _unused(): @@ -75,7 +76,7 @@ def _load(fname): with open(fname, "r") as reqfile: # FIXME (arrdem 2021-08-03): # Return a parse, not just lines. - return list(l.strip() for l in reqfile) + return list(line.strip() for line in reqfile) def _write(fname, reqs):