Skip to content

Add type hints For eth/utils module #1404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions eth/beacon/aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
pipe
)


from eth_typing import (
Hash32,
)
Expand Down Expand Up @@ -62,7 +61,7 @@ def verify_votes(
def aggregate_votes(bitfield: bytes,
sigs: Iterable[bytes],
voting_sigs: Iterable[bytes],
voting_committee_indices: Iterable[int]) -> Tuple[bytes, Tuple[int]]:
voting_committee_indices: Iterable[int]) -> Tuple[bytes, Tuple[int, int]]:
"""
Aggregate the votes.
"""
Expand Down
13 changes: 11 additions & 2 deletions eth/chains/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@

import logging

from mypy_extensions import (
TypedDict,
)

from eth_typing import (
Address,
BlockNumber,
Expand Down Expand Up @@ -105,11 +109,16 @@
from eth.vm.base import BaseVM # noqa: F401


# Mapping from address to account state.
# 'balance', 'nonce' -> int
# 'code' -> bytes
# 'storage' -> Dict[int, int]
AccountState = Dict[Address, Dict[str, Union[int, bytes, Dict[int, int]]]]
AccountDetails = TypedDict('AccountDetails',
{'balance': int,
'nonce': int,
'code': bytes,
'storage': Dict[int, int]
})
AccountState = Dict[Address, AccountDetails]


class BaseChain(Configurable, ABC):
Expand Down
6 changes: 4 additions & 2 deletions eth/estimators/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import os
from typing import Callable
from typing import (
Any,
)

from eth.utils.module_loading import (
import_string,
)


def get_gas_estimator() -> Callable:
def get_gas_estimator() -> Any:
import_path = os.environ.get(
'GAS_ESTIMATOR_BACKEND_FUNC',
'eth.estimators.gas.binary_gas_search_intrinsic_tolerance',
Expand Down
Loading