-
Notifications
You must be signed in to change notification settings - Fork 146
Update mypy and fix type hints #506
Update mypy and fix type hints #506
Conversation
8fc8f50
to
598b531
Compare
598b531
to
fdec4fa
Compare
def shuffle(values: Sequence[TItem], | ||
seed: Hash32, | ||
shuffle_round_count: int) -> Iterable[TItem]: | ||
shuffle_round_count: int) -> Tuple[TItem, ...]: | ||
return tuple(_shuffle(values, seed, shuffle_round_count)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed because of the weird @to_tuple
mypy bug in we're seeing in eth-utils?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this one. I'll update with a code comment: ethereum/eth-utils#152
@@ -60,7 +59,7 @@ def configure_parser(self, arg_parser: ArgumentParser, subparser: _SubParsersAct | |||
help="Disables the JSON-RPC Server", | |||
) | |||
|
|||
def setup_eth1_modules(self, trinity_config: TrinityConfig) -> Tuple[Eth1ChainRPCModule, ...]: | |||
def setup_eth1_modules(self, trinity_config: TrinityConfig) -> Tuple[BaseRPCModule, ...]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these methods are specifically returning this subset of modules, can't/shouldn't they be Eth1
... modules? Same for beacon below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't actually know. I'll spend a bit more time understanding why we have the two types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking at it, it doesn't appear to matter. Each of these functions return values are fed into RPCServer
which only cares about getting an iterable of BaseRPCModule
.
What was wrong?
eth-utils
functions that I want to use that were ported from the trinity codebase.mypy
version that is faster and fixes some thingseth-utils
for preserving type safety when usingto_dict
orto_ordered_dict
How was it fixed?
Updated the two dependencies and addressed the various typing issues that
mypy
yelled about.Cute Animal Picture