Skip to content

REFACTOR: Improve type hint in generics#7931

Open
SMoraisAnsys wants to merge 5 commits into
mainfrom
refactor/improve-type-hint-in-generics
Open

REFACTOR: Improve type hint in generics#7931
SMoraisAnsys wants to merge 5 commits into
mainfrom
refactor/improve-type-hint-in-generics

Conversation

@SMoraisAnsys

Copy link
Copy Markdown
Collaborator

Description

As title says, follows #7888.

Issue linked

Related to #5194

Checklist

  • I have tested my changes locally.
  • I have added necessary documentation or updated existing documentation.
  • I have followed the coding style guidelines of this project.
  • I have added appropriate tests (unit, integration, system).
  • I have reviewed my changes before submitting this pull request.
  • I have linked the issue(s) that are solved by the PR if any.
  • I have assigned this PR to myself.
  • I have added the minimum version decorator to any new backend method implemented.
  • I have agreed with the Contributor License Agreement (CLA).

@SMoraisAnsys
SMoraisAnsys requested a review from a team as a code owner July 18, 2026 06:12
@github-actions github-actions Bot added the maintenance Package and maintenance related label Jul 18, 2026

Copilot AI left a comment

Copy link
Copy Markdown

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 refactors several “generic” utilities to improve type-hint accuracy and type-checker compatibility (per #7888 / #5194), adding Protocol-based interfaces for AEDT COM objects and narrowing ambiguous types in common helpers.

Changes:

  • Added new AEDT COM Protocol interfaces (_ODesktop, _ODesign) and refined existing Protocol typing (e.g., _OProject.GetTopDesignList).
  • Updated get_pyaedt_app and other helpers with safer type narrowing (cast, helper parsing functions) and improved optional typing.
  • Refined unit conversion typing/logic in constants.py and adjusted ty exclusions to type-check more of generic/.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/ansys/aedt/core/generic/protocols.py Adds new Protocols for desktop/design COM objects and tightens a project API return type.
src/ansys/aedt/core/generic/design_types.py Adds type-narrowing helpers/casts and refines return typing for get_pyaedt_app.
src/ansys/aedt/core/generic/data_handlers.py Introduces a small helper for regex narrowing and updates type hints for optional args.
src/ansys/aedt/core/generic/constants.py Adds type aliases/helper for callable unit entries and refactors unit_converter branching.
pyproject.toml Narrows tool.ty exclusions from the whole generic/ package to a specific file allowlist.
doc/changelog.d/7931.miscellaneous.md Adds a changelog entry for the generics typing improvements.

Comment thread src/ansys/aedt/core/generic/constants.py
Comment thread src/ansys/aedt/core/generic/constants.py
Comment thread src/ansys/aedt/core/generic/design_types.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Package and maintenance related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants