Skip to content

Commit

Permalink
wack-a-mole typing updates after eth-account version upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
fselmo committed Jul 23, 2021
1 parent cea04e9 commit 95cee49
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions web3/middleware/signing.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
Any,
Callable,
Collection,
Dict,
Iterable,
NoReturn,
Tuple,
TypeVar,
Union,
)
Expand Down Expand Up @@ -77,10 +76,10 @@ def is_eth_key(value: Any) -> bool:
@to_dict
def gen_normalized_accounts(
val: Union[_PrivateKey, Collection[_PrivateKey]]
) -> Iterable[Dict[ChecksumAddress, Account]]:
) -> Iterable[Tuple[ChecksumAddress, LocalAccount]]:
if isinstance(val, (list, tuple, set,)):
for i in val:
account: Account = to_account(i)
account: LocalAccount = to_account(i)
yield account.address, account
else:
account = to_account(val)
Expand All @@ -89,7 +88,7 @@ def gen_normalized_accounts(


@singledispatch
def to_account(val: Any) -> NoReturn:
def to_account(val: Any) -> LocalAccount:
raise TypeError(
"key must be one of the types: "
"eth_keys.datatype.PrivateKey, eth_account.signers.local.LocalAccount, "
Expand All @@ -102,7 +101,7 @@ def _(val: T) -> T:
return val


def private_key_to_account(val: _PrivateKey) -> Account:
def private_key_to_account(val: _PrivateKey) -> LocalAccount:
normalized_key = key_normalizer(val)
return Account.from_key(normalized_key)

Expand Down

0 comments on commit 95cee49

Please sign in to comment.