-
Notifications
You must be signed in to change notification settings - Fork 250
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
Better handle redundant time ranges #6306
Conversation
Deployed docs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
timelines = set() | ||
for range in ranges: | ||
if range.timeline in timelines: | ||
_send_warning_or_raise( | ||
f"Warning: Timeline {range.timeline} is listed twice in the list of visible time ranges. Only the first entry will be used.", | ||
1, | ||
) | ||
timelines.add(range.timeline) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't actually need to make this change, but it's a useful python golf trick:
timelines = set() | |
for range in ranges: | |
if range.timeline in timelines: | |
_send_warning_or_raise( | |
f"Warning: Timeline {range.timeline} is listed twice in the list of visible time ranges. Only the first entry will be used.", | |
1, | |
) | |
timelines.add(range.timeline) | |
for timeline in (t for t, c in collections.Counter(range.timeline for range in ranges).items() if c > 1): | |
_send_warning_or_raise( | |
f"Warning: Timeline {range.timeline} is listed twice in the list of visible time ranges. Only the first entry will be used.", | |
1, | |
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oof. too golfy for me, having a hard time reading this.
What
Collateral:
__hash__
methods for trivial python classespixi run py-test
Checklist
main
build: rerun.io/viewernightly
build: rerun.io/viewerTo run all checks from
main
, comment on the PR with@rerun-bot full-check
.