-
Notifications
You must be signed in to change notification settings - Fork 650
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
Fix mypy tests for eth
package
#1362
Conversation
@@ -74,7 +74,8 @@ class ByzantiumVM(SpuriousDragonVM): | |||
compute_difficulty = staticmethod(compute_byzantium_difficulty) | |||
configure_header = configure_byzantium_header | |||
make_receipt = staticmethod(make_byzantium_receipt) | |||
get_uncle_reward = staticmethod(get_uncle_reward(EIP649_BLOCK_REWARD)) | |||
get_uncle_reward = get_uncle_reward(EIP649_BLOCK_REWARD) | |||
get_uncle_reward = staticmethod(get_uncle_reward) |
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 actually don't understand why it works...
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.
by works you mean why mypy
is ok with it or why it works in the context of python.
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.
For mypy
.
The previous error message was:
eth/vm/forks/byzantium/__init__.py:77: error: Incompatible types in assignment (expression has type "staticmethod", base class "BaseVM" defined the type as "Callable[[int, BaseBlock], int]")
eth/vm/forks/constantinople/__init__.py:34: error: Incompatible types in assignment (expression has type "staticmethod", base class "BaseVM" defined the type as "Callable[[int, BaseBlock], int]")
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.
Yeah, that's weird. This deserves a comment explaining why, and maybe a minute checking the mypy
github issues to see if this is a known bug/deficiency.
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.
Looks like a bug of mypy
: python/mypy#5530
@pipermerriam do you think it's better to keep this current fix + comment the issue, or add # type: ignore
+ comment?
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.
fix + comment seems best.
@@ -74,7 +74,8 @@ class ByzantiumVM(SpuriousDragonVM): | |||
compute_difficulty = staticmethod(compute_byzantium_difficulty) | |||
configure_header = configure_byzantium_header | |||
make_receipt = staticmethod(make_byzantium_receipt) | |||
get_uncle_reward = staticmethod(get_uncle_reward(EIP649_BLOCK_REWARD)) | |||
get_uncle_reward = get_uncle_reward(EIP649_BLOCK_REWARD) | |||
get_uncle_reward = staticmethod(get_uncle_reward) |
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.
by works you mean why mypy
is ok with it or why it works in the context of python.
@@ -1,4 +1,4 @@ | |||
from hashlib import blake2b | |||
from hashlib import blake2b # type: ignore |
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.
Can you add a comment explaining why we have to type: ignore
this.
What was wrong?
Mypy tests were not being triggered for
eth
module.How was it fixed?
Cute Animal Picture