Skip to content
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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Conversation

jorgensd
Copy link
Member

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.

@jorgensd jorgensd requested a review from IgorBaratta February 23, 2025 16:38
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:
Copy link
Member Author

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?

Copy link
Member

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

@coveralls
Copy link

coveralls commented Feb 23, 2025

Coverage Status

coverage: 82.058% (+0.1%) from 81.955%
when pulling dd830f1 on dokken/typing-p1
into bb5bbbf on main.

@jorgensd jorgensd requested a review from mscroggs March 18, 2025 09:36
@@ -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],
Copy link
Member

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 |?

Copy link
Member Author

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).

Copy link
Member

@mscroggs mscroggs left a 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

jorgensd and others added 2 commits March 19, 2025 09:27
Co-authored-by: Matthew Scroggs <matthew.w.scroggs@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants