Repository navigation
♻️ Annotate types in aiida.common.datastructures.orbital (#7755) - #7756
agarwalpranav0711 wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Type validators and Orbital fields src/aiida/common/datastructures/orbital.py |
Validator functions and Orbital fields and methods gain type annotations. The validation and initialization logic remains unchanged. |
RealhydrogenOrbital and mypy coverage src/aiida/common/datastructures/orbital.py, .pre-commit-config.yaml |
RealhydrogenOrbital fields and methods gain type annotations. Its string representation omits the space before @ when no kind name is set. The mypy exclusion for the module is removed. |
Priority:
Estimated code review effort: 2 (Simple) | ~15 minutes
Change: Refactor
Merge Risk: 
Minimal · up to f6f93
-
No actionable merge-blocking risk is identified in the reviewed changes.
Pre-merge checks: 
5
-
Full details: Linked Issues check
-
Explanation
Issue
#7755requirements are implemented. The diff adds annotations to the validators,Orbital,RealhydrogenOrbital,CONVERSION_DICT, and the field specifications. It separatesmatching_orbitals,family_name, andsub_orbitalsinget_name_from_quantum_numbers, soorbital_nameis not reassigned between list and string types. The diff removes the orbital module from the mypy exclusion list, as also stated in the PR evidence. The PR reports thatmypy src/aiida/common/passes with 0 issues and that all 8 orbital tests pass.
Full details: Out of Scope Changes check
-
Explanation
The reviewed changes stay within issue
#7755. TheRealhydrogenOrbital.__str__change is limited to the required return annotation, and the current body preserves the original formatting and key access. The remaining changes add typing or rename local variables to support typing.
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performed
|
Description
Following PR #7672 (
c990648f3),OrbitalandRealhydrogenOrbitalwere relocated tosrc/aiida/common/datastructures/orbital.py. Becauseaiida.common.*is configured under strict type checking, this module was temporarily placed on the.pre-commit-config.yamlmypy exclude list.This PR resolves #7755 by:
src/aiida/common/datastructures/orbital.py(Orbital,RealhydrogenOrbital, and all validator functions).RealhydrogenOrbital.get_name_from_quantum_numberswhereorbital_namewas typed aslist[str]and reassigned tostr._base_fields_requiredand_base_fields_optionalspecifications.src/aiida/common/datastructures/orbital.pyfrom the mypy exclude list in.pre-commit-config.yaml.Verification
uv run mypy src/aiida/common/passes with 0 issues (resolving all 38 previous errors).uv run pytest tests/tools/data/orbital/test_orbitals.pypasses all 8 tests.uv run ruff check .anduv run ruff format --checkpass cleanly.Fixes #7755