yta-video-frame-time 0.0.17__py3-none-any.whl → 0.0.19__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- yta_video_frame_time/decorators.py +0 -47
- yta_video_frame_time/interval.py +374 -918
- {yta_video_frame_time-0.0.17.dist-info → yta_video_frame_time-0.0.19.dist-info}/METADATA +1 -1
- yta_video_frame_time-0.0.19.dist-info/RECORD +8 -0
- yta_video_frame_time-0.0.17.dist-info/RECORD +0 -8
- {yta_video_frame_time-0.0.17.dist-info → yta_video_frame_time-0.0.19.dist-info}/WHEEL +0 -0
- {yta_video_frame_time-0.0.17.dist-info → yta_video_frame_time-0.0.19.dist-info}/licenses/LICENSE +0 -0
|
@@ -49,51 +49,4 @@ def parameter_to_time_interval(
|
|
|
49
49
|
|
|
50
50
|
return wrapper
|
|
51
51
|
|
|
52
|
-
return decorator
|
|
53
|
-
|
|
54
|
-
# TODO: Remove when we have everything unified
|
|
55
|
-
def parameter_to_new_time_interval(
|
|
56
|
-
param_name: str
|
|
57
|
-
):
|
|
58
|
-
"""
|
|
59
|
-
Force the parameter with the given `param_name` to
|
|
60
|
-
be a `NewTimeInterval` instance.
|
|
61
|
-
|
|
62
|
-
Values accepted:
|
|
63
|
-
- `NewTimeInterval` instance
|
|
64
|
-
- `tuple[float, float]` that will be `(start, end)`
|
|
65
|
-
"""
|
|
66
|
-
def decorator(
|
|
67
|
-
func
|
|
68
|
-
):
|
|
69
|
-
@wraps(func)
|
|
70
|
-
def wrapper(
|
|
71
|
-
*args,
|
|
72
|
-
**kwargs
|
|
73
|
-
):
|
|
74
|
-
from inspect import signature
|
|
75
|
-
from yta_validation import PythonValidator
|
|
76
|
-
from yta_video_frame_time.interval import NewTimeInterval
|
|
77
|
-
|
|
78
|
-
sig = signature(func)
|
|
79
|
-
bound = sig.bind(*args, **kwargs)
|
|
80
|
-
bound.apply_defaults()
|
|
81
|
-
|
|
82
|
-
value = bound.arguments[param_name]
|
|
83
|
-
|
|
84
|
-
if PythonValidator.is_instance_of(value, NewTimeInterval):
|
|
85
|
-
pass
|
|
86
|
-
elif (
|
|
87
|
-
PythonValidator.is_tuple(value) and
|
|
88
|
-
len(value) == 2
|
|
89
|
-
):
|
|
90
|
-
value = NewTimeInterval(*value)
|
|
91
|
-
bound.arguments[param_name] = value
|
|
92
|
-
else:
|
|
93
|
-
raise Exception(f'The "{param_name}" parameter must be a NewTimeInterval or a tuple[float, float].')
|
|
94
|
-
|
|
95
|
-
return func(*bound.args, **bound.kwargs)
|
|
96
|
-
|
|
97
|
-
return wrapper
|
|
98
|
-
|
|
99
52
|
return decorator
|