Skip to content
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

Use BaseChainPeer instead of HeaderRequestingPeer #1361

Merged
merged 1 commit into from Oct 5, 2018

Conversation

carver
Copy link
Contributor

@carver carver commented Oct 4, 2018

What was wrong?

I hadn't had a good tussle with mypy for a while, and I like punishment.

HeaderRequestingPeer was an old "poor coder's" version of BaseChainPeer

How was it fixed?

Rope-a-dope with mypy, plus a crucial assist from cburgdorf.

Replaced HeaderRequestingPeer with BaseChainPeer, and resolve the mypy fallout.

Cute Animal Picture

put a cute animal picture link inside the parentheses

if TYPE_CHECKING:
from mypy_extensions import DefaultArg
BlockHeadersCallable = Callable[
[BaseExchangeHandler, int, int, DefaultArg(int, 'skip'), DefaultArg(int, 'reverse')],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUPER FANCY!

@carver carver merged commit 4752846 into ethereum:master Oct 5, 2018
@carver carver deleted the prefer-base-chain-peer branch October 5, 2018 19:02


if TYPE_CHECKING:
from mypy_extensions import DefaultArg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@carver why didn't we need to install mypy_extensions in order for this to work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDK for sure, but it seems to come for free with mypy. I'm trusting that CI would have caught any problems. Since it doesn't matter in production, it basically only matters in CI and dev machines, I didn't put more thought into it.

Copy link
Contributor

@cburgdorf cburgdorf Oct 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed on a fresh docker install:

$ docker run -it python:3.6 /bin/bash
root@d674c8cd17f2:/# pip install mypy
Collecting mypy
  Downloading https://files.pythonhosted.org/packages/32/8c/a668527fe2ea69f3a03fc4d895e12b6cb2eb1bb62d61cfe8ff4142395d3a/mypy-0.630-py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 809kB/s 
Collecting mypy-extensions<0.5.0,>=0.4.0 (from mypy)
  Downloading https://files.pythonhosted.org/packages/4d/72/8d54e2b296631b9b14961d583e56e90d9d7fba8a240d5ce7f1113cc5e887/mypy_extensions-0.4.1-py2.py3-none-any.whl
Collecting typed-ast<1.2.0,>=1.1.0 (from mypy)
  Downloading https://files.pythonhosted.org/packages/35/69/94dd92985792df90cf3b544d33315e60a95cc1c7ce0518f73b4cc11f106e/typed_ast-1.1.0-cp36-cp36m-manylinux1_x86_64.whl (724kB)
    100% |████████████████████████████████| 727kB 871kB/s 
Installing collected packages: mypy-extensions, typed-ast, mypy
Successfully installed mypy-0.630 mypy-extensions-0.4.1 typed-ast-1.1.0

That actually is awesome news because the mypy_extensions do have some goodies that I felt like using in the past but then was unsure if we want to buy in this extra dependency. But if it comes bundled anyway we may sneak in some futuristic things here and there (Like you already did!) ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants