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

Better handle redundant time ranges #6306

Merged
merged 5 commits into from
May 14, 2024

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented May 13, 2024

What

Collateral:

  • generate __hash__ methods for trivial python classes
  • fix issue with pixi run py-test

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested the web demo (if applicable):
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG
  • If applicable, add a new check to the release checklist!

To run all checks from main, comment on the PR with @rerun-bot full-check.

@Wumpf Wumpf added 🐍 Python API Python logging API exclude from changelog PRs with this won't show up in CHANGELOG.md labels May 13, 2024
Copy link

Deployed docs

Commit Link
eef9e8c https://landing-1s0zeak53-rerun.vercel.app/docs

Copy link
Member

@jleibs jleibs left a comment

Choose a reason for hiding this comment

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

Thank you!

Comment on lines +28 to +35
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)
Copy link
Member

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:

Suggested change
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,
)

Copy link
Member Author

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.

@Wumpf Wumpf merged commit 15511fa into main May 14, 2024
42 checks passed
@Wumpf Wumpf deleted the andreas/better-handle-redundant-timeranges branch May 14, 2024 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exclude from changelog PRs with this won't show up in CHANGELOG.md 🐍 Python API Python logging API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Confusing parts of VisibleTimeRange API
2 participants