Skip to content

Update docs to match exclusive end_time implementation #1286

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

Conversation

rdumas01
Copy link
Contributor

@rdumas01 rdumas01 commented Dec 5, 2024

Changelog

None

Docs

  • Updated the Python docstrings for the MCAP readers to label the end_time parameter as an exclusive bound
  • The documentation on this page will also be updated

Description

According to the documentation here, the iterator should exclude messages that were logged before start_time or after end_time (i.e. both inclusive bounds). However, the implementation also excludes messages published at the same time as end_time (making it an exclusive bound). The documentation has been updated to match the implementation.

This discrepancy in the Python package is only happening in python/mcap/mcap/reader.py where iter_message() and iter_decoded_message() are defined. In all of the other files where those functions are called, end_time is described as an exclusive bound:

  • python/mcap-protobuf-support/mcap_protobuf/reader.py
  • python/mcap-ros1-support/mcap_ros1/reader.py
  • python/mcap-ros2-support/mcap_ros2/reader.py

This motivated updating the documentation rather than modifying the implementation (which would also have been a breaking change). In addition, this follows the typical Python convention of using inclusive-start and exclusive-end bounds (list[start:end], array[start:end], range(start, end), numpy.arange(start, end), etc...).

BeforeAfter
Documentation end_time is inclusive end_time is exclusive
Implementation end_time is exclusive end_time is exclusive

Fixes: FG-9583

@james-rms james-rms enabled auto-merge (squash) December 11, 2024 23:27
@james-rms james-rms merged commit 5db8c69 into foxglove:main Dec 11, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants