Skip to content

refactor: adding type hints to result.py - #4133

Merged
germa89 merged 7 commits into
mainfrom
refactor/adding-type-hints-to-result.py
Jul 31, 2025
Merged

germa89 merged 7 commits into
mainfrom
refactor/adding-type-hints-to-result.py

Conversation

@germa89

@germa89 germa89 commented Jul 31, 2025

Copy link
Copy Markdown
Collaborator

Description

As the title. Adding type hints and checking numpydoc.

Issue linked

NA

Checklist

Copilot AI review requested due to automatic review settings July 31, 2025 14:13
@germa89
germa89 requested a review from a team as a code owner July 31, 2025 14:13
@germa89 germa89 self-assigned this Jul 31, 2025
@germa89

germa89 commented Jul 31, 2025

Copy link
Copy Markdown
Collaborator Author

@pyansys-ci-bot LGTM.

@github-actions github-actions Bot added the enhancement Improve any current implemented feature label Jul 31, 2025

@pyansys-ci-bot pyansys-ci-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approving this PR because germa89 said so in here 😬

LGTM

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and ReturnData
  • 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

Comment thread src/ansys/mapdl/core/reader/result.py
Comment thread src/ansys/mapdl/core/reader/result.py
Comment thread src/ansys/mapdl/core/reader/result.py Outdated
Comment thread src/ansys/mapdl/core/reader/result.py Outdated
Comment thread src/ansys/mapdl/core/reader/result.py Outdated
Comment thread src/ansys/mapdl/core/reader/result.py Outdated
Comment thread src/ansys/mapdl/core/reader/result.py
@codecov

codecov Bot commented Jul 31, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.62500% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.32%. Comparing base (db31b73) to head (fab2351).
⚠️ Report is 2 commits behind head on main.

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@germa89
germa89 merged commit 1412986 into main Jul 31, 2025
@germa89
germa89 deleted the refactor/adding-type-hints-to-result.py branch July 31, 2025 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improve any current implemented feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants