From cda4c225bfa442d3c6c948f0ecf66cfeba76d81d Mon Sep 17 00:00:00 2001 From: antazoey Date: Wed, 8 Nov 2023 12:09:53 -0600 Subject: [PATCH] fix: long, ValueError message when list KeyError [APE-1517] (#35) --- .pre-commit-config.yaml | 10 +++++----- ape_tokens/managers.py | 8 ++++---- setup.py | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 89a9b53..b82e384 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-yaml @@ -10,24 +10,24 @@ repos: - id: isort - repo: https://github.com/psf/black - rev: 23.7.0 + rev: 23.10.1 hooks: - id: black name: black - repo: https://github.com/pycqa/flake8 - rev: 6.0.0 + rev: 6.1.0 hooks: - id: flake8 - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.4.1 + rev: v1.6.1 hooks: - id: mypy additional_dependencies: [types-setuptools, pydantic] - repo: https://github.com/executablebooks/mdformat - rev: 0.7.16 + rev: 0.7.17 hooks: - id: mdformat additional_dependencies: [mdformat-gfm, mdformat-frontmatter] diff --git a/ape_tokens/managers.py b/ape_tokens/managers.py index eb6609c..e6cff65 100644 --- a/ape_tokens/managers.py +++ b/ape_tokens/managers.py @@ -4,8 +4,8 @@ from eth_utils import to_checksum_address from tokenlists import TokenListManager -ERC20 = ContractType( - **{ +ERC20 = ContractType.parse_obj( + { "contractName": "ERC20", "abi": [ { @@ -119,8 +119,8 @@ def __getitem__(self, symbol: str) -> ContractInstance: symbol, chain_id=self.network_manager.network.chain_id ) - except ValueError as e: - raise KeyError(f"Symbol '{symbol}' is not a known token symbol") from e + except ValueError as err: + raise KeyError(f"Symbol '{symbol}' is not a known token symbol") from err return self.chain_manager.contracts.instance_at( to_checksum_address(token_info.address), contract_type=ERC20 diff --git a/setup.py b/setup.py index a7e9d98..93fb11c 100644 --- a/setup.py +++ b/setup.py @@ -11,12 +11,12 @@ "hypothesis>=6.2.0,<7.0", # Strategy-based fuzzer ], "lint": [ - "black>=23.7.0,<24", # auto-formatter and linter - "mypy>=0.991", # Static type analyzer + "black>=23.10.1,<24", # auto-formatter and linter + "mypy>=1.6.1,<2", # Static type analyzer "types-setuptools", # Needed due to mypy typeshed - "flake8>=6.0.0,<7", # Style linter + "flake8>=6.1.0,<7", # Style linter "isort>=5.10.1,<6", # Import sorting linter - "mdformat>=0.7.16", # Auto-formatter for markdown + "mdformat>=0.7.17", # Auto-formatter for markdown "mdformat-gfm>=0.3.5", # Needed for formatting GitHub-flavored markdown "mdformat-frontmatter>=0.4.1", # Needed for frontmatters-style headers in issue templates ], @@ -65,7 +65,7 @@ python_requires=">=3.8,<4", install_requires=[ "eth-ape>=0.6.0,<0.7", - "tokenlists>=0.1.3", + "tokenlists>=0.1.5", ], entry_points={ "ape_cli_subcommands": [