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
Conversation
5bc7acf
to
9b21121
Compare
if TYPE_CHECKING: | ||
from mypy_extensions import DefaultArg | ||
BlockHeadersCallable = Callable[ | ||
[BaseExchangeHandler, int, int, DefaultArg(int, 'skip'), DefaultArg(int, 'reverse')], |
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.
SUPER FANCY!
|
||
|
||
if TYPE_CHECKING: | ||
from mypy_extensions import DefaultArg |
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.
@carver why didn't we need to install mypy_extensions
in order for this to work?
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.
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.
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.
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!) ;)
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 ofBaseChainPeer
How was it fixed?
Rope-a-dope with mypy, plus a crucial assist from cburgdorf.
Replaced
HeaderRequestingPeer
withBaseChainPeer
, and resolve the mypy fallout.Cute Animal Picture