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

Allow passing seconds/nanoseconds to VideoFrameReference archetype #7833

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented Oct 18, 2024

What

Also, passing a float directly will trigger a warning now.

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!
  • If have noted any breaking changes to the log API in CHANGELOG.md and the migration guide

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

@Wumpf Wumpf added this to the Next patch release milestone Oct 18, 2024
Copy link
Member

@abey79 abey79 left a comment

Choose a reason for hiding this comment

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

Nice API improvement

elif seconds is not None or nanoseconds is not None:
raise ValueError("Cannot specify both `timestamp` and `seconds`/`nanoseconds`.")
elif isinstance(timestamp, float):
_send_warning_or_raise("Cannot timestamp can't be specified as a float, use `seconds` instead.")
Copy link
Member

@abey79 abey79 Oct 21, 2024

Choose a reason for hiding this comment

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

Typo. Also, I'm slightly surprised by this branch. To start with, it covers a case that's outside of what is "allowed" by typing annotations (not that the latter protect from anything, but may warrant a comment?). Also, why is this "only" a warning? Isn't that that a strongly failing condition?

Suggested change
_send_warning_or_raise("Cannot timestamp can't be specified as a float, use `seconds` instead.")
_send_warning_or_raise("Timestamp can't be specified as a float, use `seconds` instead.")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VideoFrameReference should have an extension constructor for seconds=
2 participants