Add Type Hints to MDAnalysis.analysis.rms #5179
Open
+91
−28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds comprehensive type hints to the
MDAnalysis.analysis.rmsmodule as part of the ongoing effort to improve type safety, code documentation, and developer experience in MDAnalysis.Changes Made
New Imports
typingimports:Optional,Union,List,Dict,Any,Sequence,Tuple,TYPE_CHECKINGnumpy.typing.NDArrayfor array type hintsTYPE_CHECKINGguard forAtomGroupandUniverseimports to avoid circular import issues at runtimeFunction
rmsd()a: NDArray,b: NDArray- coordinate arraysweights: Optional[NDArray]- optional weight arraycenter: bool,superposition: bool- boolean flags-> floatFunction
process_selection()selectparameter:Union[str, Tuple[str, str], Dict[str, str]]-> Dict[str, Any]Class
RMSDatomgroup,reference,groupselections,weightsweights_groupselections,tol_mass,ref_frame__init__()parameters including complex union types_prepare()and_single_frame()methods:-> Nonemypywith type inference in complex control flowClass
RMSF__init__()parameters_prepare(),_single_frame(), and_conclude()methods:-> NoneConfiguration
mypy.inito enable type checking forMDAnalysis.analysis.rmsmodulePR Checklist
package/CHANGELOGfile updated?package/AUTHORS?Developers Certificate of Origin
I certify that I can submit this code contribution as described in the Developer Certificate of Origin, under the MDAnalysis LICENSE.
📚 Documentation preview 📚: https://mdanalysis--5179.org.readthedocs.build/en/5179/