-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
Start adding some typing and documentation #751
base: main
Are you sure you want to change the base?
Conversation
for i in all_tensor_factors: | ||
if i.values.shape == sub_tbl.shape and np.allclose(i.values, sub_tbl): | ||
tensor_factors.append(i) | ||
for tensor_factor in all_tensor_factors: |
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.
@IgorBaratta Here i
was redeclared (from line 5.18 enumerate), I assume that was a bug.
Do you agree?
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.
Yes, thanks for the fix
@@ -246,7 +248,7 @@ def _analyze_form( | |||
|
|||
|
|||
def _has_custom_integrals( | |||
o: ufl.integral.Integral | ufl.classes.Form | list | tuple, | |||
o: typing.Union[ufl.integral.Integral, ufl.classes.Form, list, tuple], |
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.
How was this not causing an error previously? Or is 3.9 not running on CI so we just weren't seeing the error?
Is it worth considering bumping the minimun version to 3.10 six months early so we can use |
?
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 think it depends on what functions are typed. Mypy ignores that are typed (if they are within an untyped function signature).
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.
A few minor comments. Otherwise looks good
Co-authored-by: Matthew Scroggs <matthew.w.scroggs@gmail.com>
Start using
typing.Literal
for string-types, as there is so much implicit logic on the expected type.Also add some doc-strings when needed.