-
Notifications
You must be signed in to change notification settings - Fork 81
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
[WIP] Added type hinting #18
base: main
Are you sure you want to change the base?
Conversation
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.
Just some preliminary review.
py_ecc/bn128/bn128_field_elements.py
Outdated
@@ -119,14 +119,14 @@ def zero(cls): | |||
|
|||
|
|||
# Utility methods for polynomial math | |||
def deg(p): | |||
def deg(p: Tuple[int, int, int]) -> 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.
It may be prudent for us to define a new Point
type for this to add an additional level of type safety.
Point = typing.NewType('Point', Tuple[int, int, int])
This prevents passing just any (int, int, int)
into these functions, requiring us to be explicit about our point abstraction.
And looking at the code, it appears we'd need both a Point2D
and a Point3D
to handle the different dimensionalities that are used.
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.
@pipermerriam can you check this changes e4de2be
PR #19 should fix ^^ above CI failures. |
Looks like ci failures are some small linting errors, and failing due to python 2.7 not supporting type hints. @carver I'm inclined to drop python 2 support. Can you confirm? |
Yeah, the next release can be v2 👍 |
f8b6374
to
3b8e224
Compare
@6ug looks like this needs to be rebased against |
* Added type hints -- removed 12 type annotation * Adding py_ecc module and mypy changes
* Removed lints errors * Fixed 3.4 failures
@pipermerriam our last |
We should drop py3.4 as well, while we're dropping old python versions. Maybe even py3.5 too. |
ping @6ug are you still working on this? |
Fixes #11
Totally fine tuned manually! automated tools not handling dynamic execution.