Skip to content

Commit

Permalink
Bump decorator to <6.0 (#1565)
Browse files Browse the repository at this point in the history
* Bump decorator to <6.0

* Update code instrospection logic in decorators
  • Loading branch information
mondeja committed May 18, 2021
1 parent 495948e commit 2947e4a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions moviepy/decorators.py
@@ -1,4 +1,5 @@
"""Decorators used by moviepy."""
import inspect
import os

import decorator
Expand Down Expand Up @@ -81,9 +82,7 @@ def preprocess_args(fun, varnames):
"""Applies fun to variables in varnames before launching the function."""

def wrapper(func, *args, **kwargs):
func_code = func.__code__

names = func_code.co_varnames
names = inspect.getfullargspec(func).args
new_args = [
fun(arg) if (name in varnames) and (arg is not None) else arg
for (arg, name) in zip(args, names)
Expand Down Expand Up @@ -131,9 +130,7 @@ def find_fps(fps):
" the clip's fps with `clip.fps=24`" % func.__name__
)

func_code = func.__code__

names = func_code.co_varnames[1:]
names = inspect.getfullargspec(func).args[1:]

new_args = [
find_fps(arg) if (name == "fps") else arg for (arg, name) in zip(args, names)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -73,7 +73,7 @@ def run_tests(self):

# Define the requirements for specific execution needs.
requires = [
"decorator>=4.0.2,<5.0",
"decorator>=4.0.2,<6.0",
"imageio>=2.5,<3.0",
"imageio_ffmpeg>=0.2.0",
"numpy>=1.17.3,<=1.20",
Expand Down

0 comments on commit 2947e4a

Please sign in to comment.