From 4015f50d2b914a85ee4dd0aea1dccf9c6aacd1e0 Mon Sep 17 00:00:00 2001 From: Ben Hauser Date: Tue, 20 Apr 2021 17:57:03 +0400 Subject: [PATCH 1/2] chore: bump linter versions, apply changes --- .pre-commit-config.yaml | 9 ++------- brownie/convert/datatypes.py | 2 +- brownie/network/event.py | 2 +- brownie/network/gas/strategies.py | 4 +--- brownie/network/transaction.py | 2 +- brownie/project/compiler/solidity.py | 2 +- brownie/test/plugin.py | 2 +- brownie/utils/docopt.py | 2 +- brownie/utils/toposort.py | 13 ++++++------- setup.cfg | 5 +---- tests/test_expansion.py | 5 ++++- tox.ini | 6 +++--- 12 files changed, 23 insertions(+), 31 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ad248a40b..fcf928315 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,18 +4,13 @@ repos: hooks: - id: check-yaml -- repo: https://github.com/asottile/seed-isort-config - rev: v2.2.0 - hooks: - - id: seed-isort-config - - repo: https://github.com/pre-commit/mirrors-isort - rev: v4.3.21 + rev: v5.8.0 hooks: - id: isort - repo: https://github.com/psf/black - rev: 19.10b0 + rev: 20.8b1 hooks: - id: black name: black diff --git a/brownie/convert/datatypes.py b/brownie/convert/datatypes.py index 494807cf4..24f76e9ff 100644 --- a/brownie/convert/datatypes.py +++ b/brownie/convert/datatypes.py @@ -35,7 +35,7 @@ class Wei(int): * a large float in scientific notation, where direct conversion to int would cause inaccuracy: 8.3e32 * bytes: b'\xff\xff' - * hex strings: "0x330124\"""" + * hex strings: "0x330124\" """ # Known typing error: https://github.com/python/mypy/issues/4290 def __new__(cls, value: Any) -> Any: # type: ignore diff --git a/brownie/network/event.py b/brownie/network/event.py index e5357db65..e4733aa28 100644 --- a/brownie/network/event.py +++ b/brownie/network/event.py @@ -124,7 +124,7 @@ def __init__(self, name: str, address: Optional[str], event_data: List, pos: Tup def __getitem__(self, key: Union[int, str]) -> List: """if key is int: returns the n'th event that was fired with this name if key is str: returns the value of data field 'key' from the 1st event - within the container """ + within the container""" if not isinstance(key, (int, str)): raise TypeError(f"Invalid key type '{type(key)}' - can only use strings or integers") if isinstance(key, int): diff --git a/brownie/network/gas/strategies.py b/brownie/network/gas/strategies.py index a890627af..df22d7bb1 100644 --- a/brownie/network/gas/strategies.py +++ b/brownie/network/gas/strategies.py @@ -98,9 +98,7 @@ class ExponentialScalingStrategy(TimeGasStrategy): Number of seconds between transactions """ - def __init__( - self, initial_gas_price: int, max_gas_price: int, time_duration: int = 30, - ): + def __init__(self, initial_gas_price: int, max_gas_price: int, time_duration: int = 30): super().__init__(time_duration) self.initial_gas_price = initial_gas_price self.max_gas_price = max_gas_price diff --git a/brownie/network/transaction.py b/brownie/network/transaction.py index 86cb72e4a..51648abfa 100644 --- a/brownie/network/transaction.py +++ b/brownie/network/transaction.py @@ -628,7 +628,7 @@ def _confirmed_trace(self, trace: Sequence) -> None: fn = contract.get_method_object(self.input) self._return_value = fn.decode_output(data) - def _reverted_trace(self, trace: Sequence,) -> None: + def _reverted_trace(self, trace: Sequence) -> None: self._modified_state = False if self.contract_address: step = next((i for i in trace if i["op"] == "CODECOPY"), None) diff --git a/brownie/project/compiler/solidity.py b/brownie/project/compiler/solidity.py index 9e4524d3d..a413c521e 100644 --- a/brownie/project/compiler/solidity.py +++ b/brownie/project/compiler/solidity.py @@ -75,7 +75,7 @@ def compile_from_input_json( print(f" EVM Version: {input_json['settings']['evmVersion'].capitalize()}") try: - return solcx.compile_standard(input_json, allow_paths=allow_paths,) + return solcx.compile_standard(input_json, allow_paths=allow_paths) except solcx.exceptions.SolcError as e: raise CompilerError(e, "solc") diff --git a/brownie/test/plugin.py b/brownie/test/plugin.py index cb838c7f0..2b432a9a1 100644 --- a/brownie/test/plugin.py +++ b/brownie/test/plugin.py @@ -60,7 +60,7 @@ def pytest_addoption(parser): help="Only run or skip stateful tests (default: run all tests)", ) parser.addoption( - "--failfast", action="store_true", help="Fail hypothesis tests quickly (no shrinking)", + "--failfast", action="store_true", help="Fail hypothesis tests quickly (no shrinking)" ) parser.addoption( "--network", diff --git a/brownie/utils/docopt.py b/brownie/utils/docopt.py index 954cfdfd7..284025107 100644 --- a/brownie/utils/docopt.py +++ b/brownie/utils/docopt.py @@ -591,7 +591,7 @@ def parse_seq(tokens: Tokens, options: List[Option]) -> List[Pattern]: def parse_atom(tokens: Tokens, options: List[Option]) -> List[Pattern]: """atom ::= '(' expr ')' | '[' expr ']' | 'options' - | longer | shorts | argument | command ; + | longer | shorts | argument | command ; """ token = tokens.current() if not token: diff --git a/brownie/utils/toposort.py b/brownie/utils/toposort.py index 89b6bc692..7cafcf67f 100644 --- a/brownie/utils/toposort.py +++ b/brownie/utils/toposort.py @@ -51,11 +51,10 @@ def __init__(self, data): def toposort(data): """Dependencies are expressed as a dictionary whose keys are items -and whose values are a set of dependent items. Output is a list of -sets in topological order. The first set consists of items with no -dependences, each subsequent set consists of items that depend upon -items in the preceeding sets. -""" + and whose values are a set of dependent items. Output is a list of + sets in topological order. The first set consists of items with no + dependences, each subsequent set consists of items that depend upon + items in the preceeding sets.""" # Special case empty input. if len(data) == 0: @@ -83,8 +82,8 @@ def toposort(data): def toposort_flatten(data, sort=True): """Returns a single list of dependencies. For any set returned by -toposort(), those items are sorted and appended to the result (just to -make the results deterministic).""" + toposort(), those items are sorted and appended to the result (just to + make the results deterministic).""" result = [] for d in toposort(data): diff --git a/setup.cfg b/setup.cfg index 30d9bcd23..e43384c83 100644 --- a/setup.cfg +++ b/setup.cfg @@ -13,9 +13,6 @@ ignore = E203,W503 [tool:isort] force_grid_wrap = 0 include_trailing_comma = True -known_standard_library = tkinter -known_first_party = brownie -known_third_party = _pytest,black,dotenv,ens,eth_abi,eth_account,eth_event,eth_hash,eth_keys,eth_utils,ethpm,hexbytes,hypothesis,mythx_models,prompt_toolkit,psutil,pygments,pygments_lexer_solidity,pytest,pythx,requests,rlp,semantic_version,setuptools,solcast,solcx,tqdm,vvm,vyper,web3,xdist,yaml line_length = 100 multi_line_output = 3 use_parentheses = True @@ -28,7 +25,7 @@ follow_imports = silent follow_imports = skip [tool:pytest] -addopts = +addopts = -p no:pytest-brownie --cov brownie/ --cov-report term diff --git a/tests/test_expansion.py b/tests/test_expansion.py index e7d2632d8..5928bbd4f 100644 --- a/tests/test_expansion.py +++ b/tests/test_expansion.py @@ -25,7 +25,10 @@ def setUp(self): "arr": [{"a": False, "b": False}, {"a": True, "b": "${FOO}"}], } variables = {"FOO": self.v, "NUM": 314} - self.res = expand_posix_vars(self.input, variables,) + self.res = expand_posix_vars( + self.input, + variables, + ) def test_basic_string(self): assert self.res["non"] == "b" diff --git a/tox.ini b/tox.ini index 47ef1a46e..d3ea1bbe4 100644 --- a/tox.ini +++ b/tox.ini @@ -33,9 +33,9 @@ commands = [testenv:lint] deps = - black==19.10b0 - flake8==3.8.3 - isort==4.3.21 + black==20.8b1 + flake8==3.9.1 + isort==5.8.0 mypy==0.720 basepython=python3 extras=linter From 4c520f16c43b4a4d36e2cef448de01c39de4b33e Mon Sep 17 00:00:00 2001 From: Ben Hauser Date: Tue, 20 Apr 2021 18:05:59 +0400 Subject: [PATCH 2/2] chore: update requirements --- requirements-dev.in | 2 +- requirements-dev.txt | 53 ++++++++++++++++++++++++---------------- requirements-windows.txt | 28 +++++++++++++-------- requirements.in | 4 +-- requirements.txt | 24 ++++++++++-------- 5 files changed, 67 insertions(+), 44 deletions(-) diff --git a/requirements-dev.in b/requirements-dev.in index f61897275..b14df2772 100644 --- a/requirements-dev.in +++ b/requirements-dev.in @@ -4,7 +4,7 @@ bumpversion coverage flake8 isort -mypy +mypy==0.720 pip-tools pytest-cov pytest-mock diff --git a/requirements-dev.txt b/requirements-dev.txt index b734eff00..be03f5a71 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -36,7 +36,9 @@ click==7.1.2 # via # -c requirements.txt # pip-tools -coverage==5.2.1 +colorama==0.4.4 + # via twine +coverage==5.5 # via # -r requirements-dev.in # pytest-cov @@ -48,11 +50,12 @@ docutils==0.16 # via # readme-renderer # sphinx + # sphinx-rtd-theme filelock==3.0.12 # via # tox # virtualenv -flake8==3.8.3 +flake8==3.9.1 # via -r requirements-dev.in idna==2.10 # via @@ -60,13 +63,15 @@ idna==2.10 # requests imagesize==1.2.0 # via sphinx -importlib-metadata==3.7.3 - # via keyring +importlib-metadata==4.0.0 + # via + # keyring + # twine iniconfig==1.1.1 # via # -c requirements.txt # pytest -isort==4.3.21 +isort==5.8.0 # via -r requirements-dev.in jeepney==0.6.0 # via @@ -74,14 +79,16 @@ jeepney==0.6.0 # secretstorage jinja2==2.11.3 # via sphinx -keyring==23.0.0 +keyring==23.0.1 # via twine markupsafe==1.1.1 # via jinja2 mccabe==0.6.1 # via flake8 mypy-extensions==0.4.3 - # via mypy + # via + # -c requirements.txt + # mypy mypy==0.720 # via -r requirements-dev.in packaging==20.9 @@ -93,7 +100,7 @@ packaging==20.9 # tox pep517==0.10.0 # via pip-tools -pip-tools==6.0.1 +pip-tools==6.1.0 # via -r requirements-dev.in pkginfo==1.7.0 # via twine @@ -107,11 +114,11 @@ py==1.10.0 # -c requirements.txt # pytest # tox -pycodestyle==2.6.0 +pycodestyle==2.7.0 # via flake8 pycparser==2.20 # via cffi -pyflakes==2.2.0 +pyflakes==2.3.1 # via flake8 pygments==2.8.1 # via @@ -122,9 +129,9 @@ pyparsing==2.4.7 # via # -c requirements.txt # packaging -pytest-cov==2.10.1 +pytest-cov==2.11.1 # via -r requirements-dev.in -pytest-mock==3.3.1 +pytest-mock==3.5.1 # via -r requirements-dev.in pytest==6.2.3 # via @@ -143,6 +150,8 @@ requests==2.25.1 # requests-toolbelt # sphinx # twine +rfc3986==1.4.0 + # via twine secretstorage==3.3.1 # via keyring six==1.15.0 @@ -154,9 +163,9 @@ six==1.15.0 # virtualenv snowballstemmer==2.1.0 # via sphinx -sphinx-rtd-theme==0.5.0 +sphinx-rtd-theme==0.5.2 # via -r requirements-dev.in -sphinx==3.2.1 +sphinx==3.5.4 # via # -r requirements-dev.in # sphinx-rtd-theme @@ -178,29 +187,31 @@ toml==0.10.2 # pep517 # pytest # tox -tox==3.19.0 +tox==3.23.0 # via -r requirements-dev.in -tqdm==4.53.0 +tqdm==4.60.0 # via # -c requirements.txt # twine -twine==3.1.1 +twine==3.4.1 # via -r requirements-dev.in -typed-ast==1.4.2 +typed-ast==1.4.3 # via # -c requirements.txt # mypy typing-extensions==3.7.4.3 - # via mypy + # via + # -c requirements.txt + # mypy urllib3==1.26.4 # via # -c requirements.txt # requests -virtualenv==20.4.3 +virtualenv==20.4.4 # via tox webencodings==0.5.1 # via bleach -wheel==0.35.1 +wheel==0.36.2 # via -r requirements-dev.in zipp==3.4.1 # via importlib-metadata diff --git a/requirements-windows.txt b/requirements-windows.txt index 8b7a99bf8..939de918e 100644 --- a/requirements-windows.txt +++ b/requirements-windows.txt @@ -19,7 +19,6 @@ asttokens==2.0.4 attrs==20.3.0 # via # -r requirements.txt - # black # hypothesis # jsonschema # pytest @@ -31,7 +30,7 @@ bitarray==1.2.2 # via # -r requirements.txt # eth-account -black==19.10b0 +black==20.8b1 # via -r requirements.txt certifi==2020.12.5 # via @@ -64,7 +63,7 @@ eth-account==0.5.4 # web3 eth-event==1.2.3 # via -r requirements.txt -eth-hash[pycryptodome]==0.2.0 +eth-hash[pycryptodome]==0.3.1 # via # -r requirements.txt # eth-event @@ -90,12 +89,13 @@ eth-typing==2.2.2 # eth-keys # eth-utils # web3 -eth-utils==1.9.5 +eth-utils==1.10.0 # via # -r requirements.txt # eth-abi # eth-account # eth-event + # eth-hash # eth-keyfile # eth-keys # eth-rlp @@ -144,6 +144,10 @@ multiaddr==0.0.9 # via # -r requirements.txt # ipfshttpclient +mypy-extensions==0.4.3 + # via + # -r requirements.txt + # black mythx-models==1.9.1 # via # -r requirements.txt @@ -168,9 +172,9 @@ pluggy==0.13.1 # via # -r requirements.txt # pytest -prompt-toolkit==3.0.8 +prompt-toolkit==3.0.18 # via -r requirements.txt -protobuf==3.15.6 +protobuf==3.15.8 # via # -r requirements.txt # web3 @@ -191,7 +195,7 @@ pycryptodome==3.10.1 # eth-hash # eth-keyfile # vyper -pygments-lexer-solidity==0.5.1 +pygments-lexer-solidity==0.7.0 # via -r requirements.txt pygments==2.8.1 # via @@ -231,7 +235,7 @@ pythx==1.6.1 # via -r requirements.txt pyyaml==5.4.1 # via -r requirements.txt -regex==2020.11.13 +regex==2021.4.4 # via # -r requirements.txt # black @@ -277,9 +281,13 @@ toolz==0.11.1 # via # -r requirements.txt # cytoolz -tqdm==4.53.0 +tqdm==4.60.0 # via -r requirements.txt -typed-ast==1.4.2 +typed-ast==1.4.3 + # via + # -r requirements.txt + # black +typing-extensions==3.7.4.3 # via # -r requirements.txt # black diff --git a/requirements.in b/requirements.in index a9a065d40..eacdb0e35 100644 --- a/requirements.in +++ b/requirements.in @@ -1,4 +1,4 @@ -black==19.10b0 +black==20.8b1 eth-abi<3 eth-account<1 eth-event>=1.2.1,<2 @@ -16,7 +16,7 @@ pygments<3 pytest-xdist<2 pytest<7 python-dotenv>=0.16.0,<0.17.0 -pythx<2 +pythx<=1.6.1 pyyaml>=5.3.0,<6 requests>=2.25.0,<3 rlp<2 diff --git a/requirements.txt b/requirements.txt index 3f2c444a6..6c7b678ed 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,7 +12,6 @@ asttokens==2.0.4 # via vyper attrs==20.3.0 # via - # black # hypothesis # jsonschema # pytest @@ -20,7 +19,7 @@ base58==2.1.0 # via multiaddr bitarray==1.2.2 # via eth-account -black==19.10b0 +black==20.8b1 # via -r requirements.in certifi==2020.12.5 # via requests @@ -44,7 +43,7 @@ eth-account==0.5.4 # web3 eth-event==1.2.3 # via -r requirements.in -eth-hash[pycryptodome]==0.2.0 +eth-hash[pycryptodome]==0.3.1 # via # -r requirements.in # eth-event @@ -64,12 +63,13 @@ eth-typing==2.2.2 # eth-keys # eth-utils # web3 -eth-utils==1.9.5 +eth-utils==1.10.0 # via # -r requirements.in # eth-abi # eth-account # eth-event + # eth-hash # eth-keyfile # eth-keys # eth-rlp @@ -104,6 +104,8 @@ lru-dict==1.1.7 # via web3 multiaddr==0.0.9 # via ipfshttpclient +mypy-extensions==0.4.3 + # via black mythx-models==1.9.1 # via pythx netaddr==0.8.0 @@ -116,9 +118,9 @@ pathspec==0.8.1 # via black pluggy==0.13.1 # via pytest -prompt-toolkit==3.0.8 +prompt-toolkit==3.0.18 # via -r requirements.in -protobuf==3.15.6 +protobuf==3.15.8 # via web3 psutil==5.8.0 # via -r requirements.in @@ -136,7 +138,7 @@ pycryptodome==3.10.1 # eth-hash # eth-keyfile # vyper -pygments-lexer-solidity==0.5.1 +pygments-lexer-solidity==0.7.0 # via -r requirements.in pygments==2.8.1 # via @@ -167,7 +169,7 @@ pythx==1.6.1 # via -r requirements.in pyyaml==5.4.1 # via -r requirements.in -regex==2020.11.13 +regex==2021.4.4 # via black requests==2.25.1 # via @@ -205,9 +207,11 @@ toml==0.10.2 # pytest toolz==0.11.1 # via cytoolz -tqdm==4.53.0 +tqdm==4.60.0 # via -r requirements.in -typed-ast==1.4.2 +typed-ast==1.4.3 + # via black +typing-extensions==3.7.4.3 # via black urllib3==1.26.4 # via requests