Open jleibs opened 4 days ago
The constructor of VideoTimestamp
already does the right thing:
def __init__(
self: Any,
*,
nanoseconds: Union[int, None] = None,
seconds: Union[float, None] = None,
):
However, VideoTimestampLike
is defined as VideoTimestampLike = Union[VideoTimestamp, int]
.
I think thius makes sense for VideoTimestampArrayLike
because we want integer arrays to be easily convertible to timestamps (think send_columns
!).
I'd rather not make this asymmetrical. Also, tightening the type is sort-of a breaking change, thus shouldn't go into a patch..?
I think the issue is that for people working with video seconds is way more common than nanoseconds.
Accidentally just doing VideoFrameReferance(timestamp=1.0)
is an annoying footgun.
At a minimum that should produce an error for floats.
The default signature doesn't make it clear:
I would recommend we disallow casting from
int
onVideoTimestampLike
and add optional kwargs such as: