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

Update "fetching_messages" example #115

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
python:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Staying on 22 for now to avoid build errors: https://github.com/foxglove/foxglove-python/actions/runs/12356809802/job/34535840957. Runners have been rolling out 24.04 as "latest" this month.

permissions:
id-token: write
steps:
Expand All @@ -23,6 +23,7 @@ jobs:
- run: pipenv run black --check --diff --color --exclude '.*_pb2.py' .
- run: pipenv run pyright foxglove
- run: pipenv run python -m flake8 foxglove
- run: pipenv run python -m flake8 examples
- run: pipenv run python -m pytest
- run: pipenv run python -m build

Expand Down
1 change: 0 additions & 1 deletion examples/downloading_data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import datetime
from datetime import datetime, timedelta

from foxglove.client import Client
Expand Down
8 changes: 3 additions & 5 deletions examples/fetching_messages.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import datetime
from datetime import datetime, timedelta

from foxglove.client import Client
Expand All @@ -9,10 +8,9 @@

# Make sure you've imported either the mcap-ros1-support or mcap-protobuf-support
# libraries before making this call in order to get decoded messages.
messages = client.get_messages(
for schema, channel, message, decoded_message in client.iter_messages(
device_id=device_id,
Copy link
Member

Choose a reason for hiding this comment

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

Should we do anything with decoded_message in this example?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I started to, but doing anything useful seemed dependent on the data and implementation (per comment above). I could prefix with an underscore to indicate it's unused?

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense. I think it's fine to leave it as is to show it's there

start=datetime.now() - timedelta(hours=3),
end=datetime.now() - timedelta(hours=1),
)

print(f"downloaded {len(messages)} messages")
):
print(f"{message.log_time} | {channel.topic:<24} | {schema.name}")
Loading