From d55221ea0e7d3ce4f24099d2c7e1be196c649ed3 Mon Sep 17 00:00:00 2001 From: cyc60 Date: Tue, 20 Aug 2024 15:13:52 +0300 Subject: [PATCH] Add missed annotations Signed-off-by: cyc60 --- src/common/contracts.py | 2 +- src/config/settings.py | 4 ++-- src/eigenlayer/contracts.py | 6 +++--- src/eigenlayer/generator.py | 9 +++++---- src/eigenlayer/typings.py | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/common/contracts.py b/src/common/contracts.py index 9f144cca..ae34df06 100644 --- a/src/common/contracts.py +++ b/src/common/contracts.py @@ -327,7 +327,7 @@ async def aggregate( class EigenPodOwnerContract(ContractWrapper): abi_path = 'abi/IEigenPodOwner.json' - def __init__(self, address): + def __init__(self, address: ChecksumAddress) -> None: self._address = address @property diff --git a/src/config/settings.py b/src/config/settings.py index eeba3df7..961f5354 100644 --- a/src/config/settings.py +++ b/src/config/settings.py @@ -253,11 +253,11 @@ def is_genesis_vault(self) -> bool: return self.vault == settings.network_config.GENESIS_VAULT_CONTRACT_ADDRESS @property - def is_auto_registration_mode(self): + def is_auto_registration_mode(self) -> bool: return settings.validators_registration_mode == ValidatorsRegistrationMode.AUTO @property - def is_api_registration_mode(self): + def is_api_registration_mode(self) -> bool: return settings.validators_registration_mode == ValidatorsRegistrationMode.API diff --git a/src/eigenlayer/contracts.py b/src/eigenlayer/contracts.py index 79298bd6..d6c56645 100644 --- a/src/eigenlayer/contracts.py +++ b/src/eigenlayer/contracts.py @@ -11,7 +11,7 @@ class EigenPodContract(ContractWrapper): abi_path = '../eigenlayer/abi/IEigenPod.json' - def __init__(self, address): + def __init__(self, address: ChecksumAddress) -> None: self._address = address @property @@ -66,7 +66,7 @@ async def get_delayed_withdrawal_router(self, block_number: BlockNumber) -> Chec class DelayedWithdrawalRouterContract(ContractWrapper): abi_path = '../eigenlayer/abi/IDelayedWithdrawalRouter.json' - def __init__(self, address): + def __init__(self, address: ChecksumAddress) -> None: self._address = address @property @@ -112,7 +112,7 @@ async def get_pod_shares(self, pod_owner: ChecksumAddress, block_number: BlockNu class BeaconChainOracleContract(ContractWrapper): abi_path = '../eigenlayer/abi/IBeaconChainOracle.json' - def __init__(self, address): + def __init__(self, address: ChecksumAddress) -> None: self._address = address @property diff --git a/src/eigenlayer/generator.py b/src/eigenlayer/generator.py index ef5bbf1a..bb91b90c 100644 --- a/src/eigenlayer/generator.py +++ b/src/eigenlayer/generator.py @@ -20,10 +20,10 @@ def __init__(self, slot: int, chain_id: int): self.files: set[str] = set() - def __enter__(self): + def __enter__(self) -> 'ProofsGenerationWrapper': return self - def __exit__(self, exc_type, exc_val, exc_tb): + def __exit__(self, exc_type, exc_val, exc_tb): # type: ignore for file in self.files: self._cleanup_file(file) @@ -216,11 +216,12 @@ def binary_filename(self) -> str: return resource_path(filename) -def resource_path(relative_path): +def resource_path(relative_path: str) -> str: """Get absolute path to resource, works for dev and for PyInstaller""" try: # PyInstaller creates a temp folder and stores path in _MEIPASS - base_path = sys._MEIPASS # pylint: disable=no-member,protected-access + # pylint: disable-next=no-member,protected-access + base_path = sys._MEIPASS # type: ignore except BaseException: base_path = os.path.abspath('.') + '/bin' diff --git a/src/eigenlayer/typings.py b/src/eigenlayer/typings.py index 0b2fcebb..99173e31 100644 --- a/src/eigenlayer/typings.py +++ b/src/eigenlayer/typings.py @@ -57,7 +57,7 @@ class QueuedWithdrawal: withdrawal_root: bytes | None = None @property - def block_number(self): + def block_number(self) -> BlockNumber: return self.start_block @property