Skip to content

Fix pyright issue #30147 #30192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed

Conversation

sanleo-wq
Copy link

Description

This PR fixes issue #30147 by resolving the Pyright errors in the src/openvino/utils/types.py file.

Changes made

  • Added explicit cast import from the typing library
  • Updated as_node function to use proper type casting with isinstance checks instead of issubclass(type())
  • Fixed the return type in as_nodes function using cast for proper list typing

Testing

  • Removed src/openvino/utils/types.py from the exclusions in pyproject.toml
  • Ran Pyright which now reports no errors:

@sanleo-wq sanleo-wq requested a review from a team as a code owner April 17, 2025 14:07
@github-actions github-actions bot added the category: Python API OpenVINO Python bindings label Apr 17, 2025
@sys-openvino-ci sys-openvino-ci added the ExternalPR External contributor label Apr 17, 2025
@mlukasze
Copy link
Contributor

linter failed, please fix

@mlukasze mlukasze linked an issue Apr 18, 2025 that may be closed by this pull request


def as_nodes(*input_values: NodeInput, name: Optional[str] = None) -> List[Node]:
"""Return input values as nodes. Scalars will be converted to Constant nodes."""
return [as_node(input_value, name=name) for input_value in input_values]
return cast(List[Node], [as_node(input_value, name=name) for input_value in input_values])
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix for failing flake8 check

Suggested change
return cast(List[Node], [as_node(input_value, name=name) for input_value in input_values])
return cast(List[Node], [as_node(input_value, name=name) for input_value in input_values])

@p-wysocki
Copy link
Contributor

Thank you for the investigation! The tasks for fixing pyright seemed straightforward, but when reviewing the PRs we decided that it's a much more difficult issue than we expected and, combined with the task priority, we decided to move fixes for pyright checks back as an internal OpenVINO team effort. It's no longer an open Good First Issue - we apologize for closing the task you were working on, your contribution helped us investigate that issue.

@p-wysocki p-wysocki closed this Apr 25, 2025
@sanleo-wq sanleo-wq deleted the fix-30147 branch April 28, 2025 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: Python API OpenVINO Python bindings ExternalPR External contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Good First Issue]: Fix pyright in: src/openvino/utils/types.py
4 participants