From 73f0093e6006a76ecfc4615fd4450b545a4f6a26 Mon Sep 17 00:00:00 2001 From: Juliya Smith Date: Tue, 29 Oct 2024 10:12:06 -0500 Subject: [PATCH] chore: flake8 type check --- ape_tokens/managers.py | 8 ++++++-- setup.cfg | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ape_tokens/managers.py b/ape_tokens/managers.py index f6de8c8..298423e 100644 --- a/ape_tokens/managers.py +++ b/ape_tokens/managers.py @@ -1,10 +1,14 @@ -from ape.contracts import ContractInstance +from typing import TYPE_CHECKING + from ape.exceptions import ContractNotFoundError from ape.types import ContractType from ape.utils import ManagerAccessMixin, cached_property from eth_utils import to_checksum_address from tokenlists import TokenListManager +if TYPE_CHECKING: + from ape.contracts import ContractInstance + ERC20 = ContractType.model_validate( { "contractName": "ERC20", @@ -114,7 +118,7 @@ def _manager(self) -> TokenListManager: def __repr__(self) -> str: return f"" - def __getitem__(self, symbol: str) -> ContractInstance: + def __getitem__(self, symbol: str) -> "ContractInstance": try: token_info = self._manager.get_token_info( symbol, chain_id=self.network_manager.network.chain_id diff --git a/setup.cfg b/setup.cfg index 15a13f4..1ba5b83 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,8 +1,9 @@ [flake8] max-line-length = 100 -ignore = E704,W503,PYD002 +ignore = E704,W503,PYD002,TC003,TC006 exclude = venv* .tox docs build +type-checking-pydantic-enabled = True