Skip to content
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

Document return type for _read_frame #417

Merged
merged 4 commits into from
Jan 30, 2025

Conversation

janbridley
Copy link
Contributor

@janbridley janbridley commented Jan 28, 2025

Description

The return type of the _read_frame function was added to the Returns docstring block to eliminate a warning raised by type hinters.

Motivation and Context

Python type linters would make the incorrect assumption that __getitem__ from a trajectory always returned a HoomdTrajectoryView, even through __getitem__ with an int returns a gsd frame. This would lead to warnings like Cannot access attribute "particles" for class "_HOOMDTrajectoryView" when attempting to access properties that do not exist in a trajectory view. Updating the return type in the documentation of _read_frame fixes this issue.

How Has This Been Tested?

The warning is no longer raised.

Checklist:

  • I have reviewed the Contributor Guidelines.
  • I agree with the terms of the GSD Contributor Agreement.
  • My name is on the list of contributors (doc/credits.rst) in the pull request source branch.
  • I have added a change log entry to CHANGELOG.rst.

@janbridley janbridley marked this pull request as ready for review January 28, 2025 18:58
@janbridley janbridley requested a review from joaander January 28, 2025 18:58
@janbridley janbridley changed the title Document return type for _read_frame Document return type for _read_frame Jan 28, 2025
Copy link
Member

@joaander joaander left a comment

Choose a reason for hiding this comment

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

Thanks!

CHANGELOG.rst Outdated Show resolved Hide resolved
@joaander joaander merged commit 66590eb into trunk-patch Jan 30, 2025
41 checks passed
@joaander joaander deleted the document-_read_frame-return branch January 30, 2025 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants