Repository navigation
refactor: adding type hints to result.py - #4133
Merged
Merged
Conversation
Collaborator
Author
|
@pyansys-ci-bot LGTM. |
…g-type-hints-to-result.py
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds comprehensive type hints and updates documentation for the result.py file, improving code maintainability and developer experience. The changes include adding TypeAlias definitions for commonly used types, enhancing method signatures with proper type annotations, and updating docstrings to follow numpydoc conventions.
Key changes include:
- Addition of type aliases for common parameter types like
Rnum,Nodes,Elements, andReturnData - Comprehensive type hints for all methods and properties
- Enhanced docstrings with proper parameter and return type documentation
Comments suppressed due to low confidence (2)
src/ansys/mapdl/core/reader/result.py:47
- [nitpick] The type alias 'Rnum' is ambiguous and doesn't clearly indicate what it represents. Consider a more descriptive name like 'ResultNumber' or 'ResultIndex'.
Rnum: TypeAlias = Union[int, float, Iterable[int], Iterable[float], None]
src/ansys/mapdl/core/reader/result.py:947
- [nitpick] The variable name 'entity_type_' with trailing underscore is unclear. Consider a more descriptive name like 'normalized_entity_type' or 'formatted_entity_type'.
entity_type_ = entity_type.title() # Sanity check
…hub.com/ansys/pymapdl into refactor/adding-type-hints-to-result.py
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4133 +/- ##
==========================================
- Coverage 91.35% 91.32% -0.03%
==========================================
Files 189 189
Lines 15650 15667 +17
==========================================
+ Hits 14297 14308 +11
- Misses 1353 1359 +6 🚀 New features to boost your workflow:
|
…type specifications in result.py.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
As the title. Adding type hints and checking numpydoc.
Issue linked
NA
Checklist
draftif it is not ready to be reviewed yet.feat: adding new MAPDL command)