-
Notifications
You must be signed in to change notification settings - Fork 85
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
Fixes Typing errors for points at infinity (NoneTypes) #89
Conversation
py_ecc/fields/field_elements.py
Outdated
@@ -201,7 +201,7 @@ class FQP(object): | |||
|
|||
def __init__(self, | |||
coeffs: Sequence[IntOrFQ], | |||
modulus_coeffs: Sequence[IntOrFQ] = None) -> None: | |||
modulus_coeffs: Sequence[IntOrFQ] = []) -> None: |
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.
This is to handle a separate error where len(modulus_coeffs)
is called in line 208 below. This is not possible with None
as it has no __len__
. The reason for having a default argument here is for simple type(self)
calls.
@@ -64,8 +65,8 @@ | |||
bls12_381_FQ2, | |||
bls12_381_FQ12, | |||
) | |||
Point2D = Tuple[Field, Field] | |||
Point3D = Tuple[Field, Field, Field] | |||
Point2D = Optional[Tuple[Field, Field]] # Point at infinity is encoded as a None |
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.
This is the meat of this PR and addresses 48 type errors.
Side note, should extended type checking be a part of CI on this repo? I feel like it should.
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 opened issue #95 for this.
Co-authored-by: Hsiao-Wei Wang <[email protected]>
What was wrong?
The point at infinity on any given curve is encoded as
None
. MyPy was not informed.How was it fixed?
I told MyPy.
Cute Animal Picture