-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add mypy #291
Add mypy #291
Conversation
some problems (accumulated so far):
|
With this PR we introduce mypy via pre-commit. This would be a further check which developers need to control.
|
I'm also fine with closing #181, since Mypy will actually run. Or keeping it open, as a reminder to incrementally adopt types. In any case, this is something that won't finish ever, since types will always be optional, no matter what (unless we ban |
here Lines 23 to 24 in 9484666
we should replace int with Literal[3,4,5,6]
|
Ah, yeah, it could be stricter, but I didn't bother in restricting too much. However, pay attention that from typing import Literal
def subtract(n: int, m: int) -> int:
return n - m
flavor: Literal[3,4,5,6] = subtract(7, 2) flags the following error:
i.e. |
Co-authored-by: Alessandro Candido <candido.ale@gmail.com>
I would fix the problem with unit tests before merging, worst case ignoring them (fixing banana is definitely a better alternative). |
@alecandido it seems pylint does not consider |
I'm sorry for it, but it is more of a Pylint problem, since the If you wish, you could also add a return hint, by using |
Note that mypy detected the bug of missing |
# in the eko scales are squared | ||
q2block_per_nf = {nf: np.power(q2s, 2) for nf, q2s in q2block_per_nf.items()} |
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 removal is a very suspicious change ... because I introduced it in #391 (d5f63fe to be specific) and unit tests were passing - but I have to remove it here to make the unit tests pass and I can not see how the other changes here would change that ...
Closes #178
Current state is
- see CIFound 63 errors in 17 files (checked 287 source files)