mdanalysis
mdanalysis copied to clipboard
Type hints for lib module
Fixes #
Changes made in this Pull Request:
PR Checklist
- [ ] Tests?
- [ ] Docs?
- [ ] CHANGELOG updated?
- [ ] Issue raised/referenced?
Hello @umak1106! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
- In the file
package/MDAnalysis/__init__.py:
Line 182:80: E501 line too long (81 > 79 characters)
- In the file
package/MDAnalysis/lib/mdamath.py:
Line 164:80: E501 line too long (80 > 79 characters) Line 249:80: E501 line too long (86 > 79 characters) Line 312:80: E501 line too long (98 > 79 characters)
- In the file
package/MDAnalysis/lib/pkdtree.py:
Line 101:80: E501 line too long (88 > 79 characters)
Comment last updated at 2022-09-12 07:29:38 UTC
Regarding the stp() function if i set the arguments as arraylike i get this error Argument 1 to "cross" has incompatible type "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"; expected "Union[SupportsArray[dtype[bool]], _NestedSequence[SupportsArray[dtype[bool]]], bool, _NestedSequence[bool]]"
And if i set it as NDArray I still get an error Argument 1 to "stp" has incompatible type "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"; expected "ndarray[Any, dtype[Any]]"
The same error above shows for normal()
Codecov Report
Base: 94.31% // Head: 94.30% // Decreases project coverage by -0.00% :warning:
Coverage data is based on head (
afbf3ca) compared to base (0788165). Patch coverage: 91.89% of modified lines in pull request are covered.
Additional details and impacted files
@@ Coverage Diff @@
## develop #3729 +/- ##
===========================================
- Coverage 94.31% 94.30% -0.01%
===========================================
Files 192 192
Lines 24782 24795 +13
Branches 3341 3344 +3
===========================================
+ Hits 23372 23382 +10
- Misses 1362 1365 +3
Partials 48 48
| Impacted Files | Coverage Δ | |
|---|---|---|
| package/MDAnalysis/lib/pkdtree.py | 91.91% <82.35%> (-2.59%) |
:arrow_down: |
| package/MDAnalysis/__init__.py | 92.30% <100.00%> (ø) |
|
| package/MDAnalysis/lib/NeighborSearch.py | 96.77% <100.00%> (+0.34%) |
:arrow_up: |
| package/MDAnalysis/lib/mdamath.py | 100.00% <100.00%> (ø) |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
actually typing module is introduced in numpy from 1.20.0 and the gh-ci.yaml file has numpy = 1.19.0 which is why i think the tests are failing
@IAlibay plans on bumping the minimal version of numpy to 1.20.0. It means we'll have to wait for the bump to happen before we merge, but you can proceed and ignore the failing pipeline.
@umak1106 just a quick note, I am adding type hints to a lot of distances.py as part of #3730, you can probably leave that one to me for now.
ok
Errors am facing : MDAnalysis/lib/pkdtree.py:141: error: Incompatible types in assignment (expression has type "Optional[float]", variable has type "None") MDAnalysis/lib/pkdtree.py:184: error: Unsupported operand types for > ("float" and "None") MDAnalysis/lib/pkdtree.py:234: error: Unsupported operand types for > ("float" and "None") MDAnalysis/lib/pkdtree.py:290: error: Unsupported operand types for > ("float" and "None")
It looks like you are still using npt.NDArray in pkdtree.
It looks like you are still using
npt.NDArrayin pkdtree.
Yes actually after i faced mypy errors there i didn't push my code
Now that #3787 is merged into develop, the develop branch should be merged in here.
Wooo! 🎉 Only one mypy error left! With the last few comment addressed we should be good to go 😁
Making those changes in pkdtree raises errors like unresolved reference to self
Making those changes in pkdtree raises errors like unresolved reference to self
Can you paste the full error message please? It is difficult to figure out what can go wrong without it.
Making those changes in pkdtree raises errors like unresolved reference to self
Can you paste the full error message please? It is difficult to figure out what can go wrong without it.
It got fixed . There are no mypy errors in this module now .
Congratulations on that PR being merged!
Congratulations on that PR being merged!
Thanks