From 95cee4927ec94c1cf6b2c06fb5e780f08bde4ac3 Mon Sep 17 00:00:00 2001 From: Felipe Selmo Date: Thu, 22 Jul 2021 18:10:25 -0600 Subject: [PATCH] wack-a-mole typing updates after eth-account version upgrade --- web3/middleware/signing.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/web3/middleware/signing.py b/web3/middleware/signing.py index 84180d423d..4ed76a9830 100644 --- a/web3/middleware/signing.py +++ b/web3/middleware/signing.py @@ -7,9 +7,8 @@ Any, Callable, Collection, - Dict, Iterable, - NoReturn, + Tuple, TypeVar, Union, ) @@ -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) @@ -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, " @@ -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)