@@ -157,7 +157,7 @@ def _generic_time_based_sampler(
157157 # None means "begining", which may not always be 0
158158 sampling_range_start : Optional [float ],
159159 sampling_range_end : Optional [float ], # interval is [start, end).
160- policy : str = "repeat_last" ,
160+ policy : Literal [ "repeat_last" , "wrap" , "error" ] = "repeat_last" ,
161161) -> FrameBatch :
162162 # Note: *everywhere*, sampling_range_end denotes the upper bound of where a
163163 # clip can start. This is an *open* upper bound, i.e. we will make sure no
@@ -227,7 +227,7 @@ def clips_at_random_timestamps(
227227 # None means "begining", which may not always be 0
228228 sampling_range_start : Optional [float ] = None ,
229229 sampling_range_end : Optional [float ] = None , # interval is [start, end).
230- policy : str = "repeat_last" ,
230+ policy : Literal [ "repeat_last" , "wrap" , "error" ] = "repeat_last" ,
231231) -> FrameBatch :
232232 return _generic_time_based_sampler (
233233 kind = "random" ,
@@ -251,7 +251,7 @@ def clips_at_regular_timestamps(
251251 # None means "begining", which may not always be 0
252252 sampling_range_start : Optional [float ] = None ,
253253 sampling_range_end : Optional [float ] = None , # interval is [start, end).
254- policy : str = "repeat_last" ,
254+ policy : Literal [ "repeat_last" , "wrap" , "error" ] = "repeat_last" ,
255255) -> FrameBatch :
256256 return _generic_time_based_sampler (
257257 kind = "regular" ,
@@ -306,13 +306,13 @@ def clips_at_regular_timestamps(
306306 timestamps, so the ``policy`` parameter defines how to replace those
307307 frames, with valid sampling timestamps:
308308
309- - "repeat ": repeats the last valid frame of the clip. We would get
310- frames sampled at timestamps [10.5, 10.7, 10.9, 10.9, 10.9].
309+ - "repeat_last ": repeats the last valid frame of the clip. We would
310+ get frames sampled at timestamps [10.5, 10.7, 10.9, 10.9, 10.9].
311311 - "wrap": wraps around to the beginning of the clip. We would get
312312 frames sampled at timestamps [10.5, 10.7, 10.9, 10.5, 10.7].
313313 - "error": raises an error.
314314
315- Default is "repeat ". Note that when ``sampling_range_end=None``
315+ Default is "repeat_last ". Note that when ``sampling_range_end=None``
316316 (default), this policy parameter is unlikely to be relevant.
317317
318318 {return_docs}
0 commit comments