Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Update mypy and fix type hints #506

Merged
merged 2 commits into from
Apr 17, 2019

Conversation

pipermerriam
Copy link
Member

What was wrong?

  • New eth-utils functions that I want to use that were ported from the trinity codebase.
  • New mypy version that is faster and fixes some things
  • Bugfix in eth-utils for preserving type safety when using to_dict or to_ordered_dict

How was it fixed?

Updated the two dependencies and addressed the various typing issues that mypy yelled about.

Cute Animal Picture

dims vetstreet com

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))
Copy link
Contributor

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?

Copy link
Member Author

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, ...]:
Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Member Author

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.

@pipermerriam pipermerriam merged commit 185bcb8 into ethereum:master Apr 17, 2019
@pipermerriam pipermerriam deleted the piper/update-eth-utils branch April 17, 2019 20:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants