mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-17 05:05:14 +03:00
47 lines
1.5 KiB
Diff
47 lines
1.5 KiB
Diff
commit 2ea1de64553d610a2fdd1abe54dba6797a49a5e4
|
|
Author: Daniel Mizyrycki <mzdaniel@glidelink.net>
|
|
Date: Sat Sep 24 16:33:28 2022 -0700
|
|
|
|
Update code introspection logic in decorators
|
|
|
|
diff --git a/moviepy/decorators.py b/moviepy/decorators.py
|
|
index 277276c..3bce1ac 100644
|
|
--- a/moviepy/decorators.py
|
|
+++ b/moviepy/decorators.py
|
|
@@ -2,6 +2,7 @@
|
|
all decorators used in moviepy go there
|
|
"""
|
|
|
|
+import inspect
|
|
import decorator
|
|
|
|
from moviepy.tools import cvsecs
|
|
@@ -76,12 +77,7 @@ def preprocess_args(fun,varnames):
|
|
""" Applies fun to variables in varnames before launching the function """
|
|
|
|
def wrapper(f, *a, **kw):
|
|
- if hasattr(f, "func_code"):
|
|
- func_code = f.func_code # Python 2
|
|
- else:
|
|
- func_code = f.__code__ # Python 3
|
|
-
|
|
- names = func_code.co_varnames
|
|
+ names = inspect.getfullargspec(f).args
|
|
new_a = [fun(arg) if (name in varnames) else arg
|
|
for (arg, name) in zip(a, names)]
|
|
new_kw = {k: fun(v) if k in varnames else v
|
|
@@ -120,12 +116,7 @@ def use_clip_fps_by_default(f, clip, *a, **k):
|
|
" the clip's fps with `clip.fps=24`" % f.__name__)
|
|
|
|
|
|
- if hasattr(f, "func_code"):
|
|
- func_code = f.func_code # Python 2
|
|
- else:
|
|
- func_code = f.__code__ # Python 3
|
|
-
|
|
- names = func_code.co_varnames[1:]
|
|
+ names = inspect.getfullargspec(f).args[1:]
|
|
|
|
new_a = [fun(arg) if (name=='fps') else arg
|
|
for (arg, name) in zip(a, names)]
|
|
|