Skip to content

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!

@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.

3 participants