Lint headway

This commit is contained in:
Reid 'arrdem' McKenzie 2021-08-30 00:43:58 -06:00
parent 651bc8821a
commit 4664b4353c
4 changed files with 18 additions and 17 deletions

View file

@ -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

View file

@ -14,11 +14,11 @@ import yaml
RECORD_LINE_PATTERN = re.compile(
"^(?P<rrset_name>\S+)\s+"
"(?P<rrset_ttl>\S+)\s+"
"IN\s+"
"(?P<rrset_type>\S+)\s+"
"(?P<rrset_values>.+)$"
r"^(?P<rrset_name>\S+)\s+"
r"(?P<rrset_ttl>\S+)\s+"
r"IN\s+"
r"(?P<rrset_type>\S+)\s+"
r"(?P<rrset_values>.+)$"
)

View file

@ -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):