Lint repo.
This commit is contained in:
parent
87e762bda2
commit
44f4a0aaa8
8 changed files with 15 additions and 14 deletions
|
@ -1,9 +1,8 @@
|
||||||
from damm import Damm
|
from damm import Damm
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('num', [
|
@pytest.mark.parametrize("num", [
|
||||||
"0", # 0 itself is the start Damm state
|
"0", # 0 itself is the start Damm state
|
||||||
"37", # [0, 3] => 7
|
"37", # [0, 3] => 7
|
||||||
"92", # [0, 9] => 2
|
"92", # [0, 9] => 2
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
from damm import Damm
|
from damm import Damm
|
||||||
|
|
||||||
from hypothesis import given
|
from hypothesis import given
|
||||||
from hypothesis.strategies import integers
|
from hypothesis.strategies import integers
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,9 @@
|
||||||
|
|
||||||
import ast
|
import ast
|
||||||
import logging
|
import logging
|
||||||
import sys
|
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
if sys.version_info < (3, 0, 0):
|
if sys.version_info < (3, 0, 0):
|
||||||
builtins = __builtins__
|
builtins = __builtins__
|
||||||
|
@ -115,7 +116,6 @@ class TargetNonlocalFlow(Exception):
|
||||||
"""Base exception class to simulate non-local control flow transfers in
|
"""Base exception class to simulate non-local control flow transfers in
|
||||||
a target application."""
|
a target application."""
|
||||||
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class TargetBreak(TargetNonlocalFlow):
|
class TargetBreak(TargetNonlocalFlow):
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
|
||||||
class Foo(object):
|
class Foo(object):
|
||||||
def bar(self):
|
def bar(self):
|
||||||
return 1
|
return 1
|
||||||
|
@ -17,6 +18,8 @@ print(a.bar())
|
||||||
print(a.baz)
|
print(a.baz)
|
||||||
|
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
|
||||||
for _ in range(10):
|
for _ in range(10):
|
||||||
print(random.randint(0, 1024))
|
print(random.randint(0, 1024))
|
||||||
|
|
||||||
|
@ -25,4 +28,6 @@ def bar(a, b, **bs):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
|
||||||
print(len(requests.get("https://pypi.org/pypi/requests/json").text))
|
print(len(requests.get("https://pypi.org/pypi/requests/json").text))
|
||||||
|
|
|
@ -121,7 +121,7 @@ class Proquint(object):
|
||||||
|
|
||||||
res = 0
|
res = 0
|
||||||
|
|
||||||
for i, c in enumerate([c for c in buffer if c != '-']):
|
for i, c in enumerate([c for c in buffer if c != "-"]):
|
||||||
if (mag := cls._consonant_to_uint(c)) is not None:
|
if (mag := cls._consonant_to_uint(c)) is not None:
|
||||||
res <<= 4
|
res <<= 4
|
||||||
res += mag
|
res += mag
|
||||||
|
@ -131,7 +131,7 @@ class Proquint(object):
|
||||||
res <<= 2
|
res <<= 2
|
||||||
res += mag
|
res += mag
|
||||||
elif i != 5:
|
elif i != 5:
|
||||||
raise ValueError('Bad proquint format')
|
raise ValueError("Bad proquint format")
|
||||||
return res
|
return res
|
||||||
|
|
||||||
# Handy aliases
|
# Handy aliases
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""Tests based off of known examples."""
|
"""Tests based off of known examples."""
|
||||||
|
|
||||||
import proquint
|
import proquint
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,12 +44,12 @@ examples = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('val,width,qint', examples)
|
@pytest.mark.parametrize("val,width,qint", examples)
|
||||||
def test_decode_examples(val, width, qint):
|
def test_decode_examples(val, width, qint):
|
||||||
assert proquint.Proquint.decode(qint) == val, f"qint {qint} did not decode"
|
assert proquint.Proquint.decode(qint) == val, f"qint {qint} did not decode"
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('val,width,qint', examples)
|
@pytest.mark.parametrize("val,width,qint", examples)
|
||||||
def test_encode_examples(val, width, qint):
|
def test_encode_examples(val, width, qint):
|
||||||
encoded_qint = proquint.Proquint.encode(val, width)
|
encoded_qint = proquint.Proquint.encode(val, width)
|
||||||
decoded_val = proquint.Proquint.decode(encoded_qint)
|
decoded_val = proquint.Proquint.decode(encoded_qint)
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
"""Tests based off of round-tripping randomly generated examples."""
|
"""Tests based off of round-tripping randomly generated examples."""
|
||||||
|
|
||||||
import proquint
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
from hypothesis import given
|
from hypothesis import given
|
||||||
from hypothesis.strategies import integers
|
from hypothesis.strategies import integers
|
||||||
|
import proquint
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
@given(integers(min_value=0, max_value=1<<16))
|
@given(integers(min_value=0, max_value=1<<16))
|
||||||
|
|
|
@ -104,7 +104,7 @@ def deps(requirements):
|
||||||
|
|
||||||
|
|
||||||
@cli.command()
|
@cli.command()
|
||||||
@click.option("--no-upgrade/--upgrade", name="upgrade", default=False)
|
@click.option("--no-upgrade/--upgrade", "", "upgrade", default=False)
|
||||||
@click.argument("requirements")
|
@click.argument("requirements")
|
||||||
def install(requirements, upgrade):
|
def install(requirements, upgrade):
|
||||||
"""Install (or upgrade) a dependency.
|
"""Install (or upgrade) a dependency.
|
||||||
|
|
Loading…
Reference in a new issue