File tree 1 file changed +6
-5
lines changed
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,6 @@ class MisType(Warning):
19
19
pass
20
20
21
21
22
-
23
-
24
22
def _typer (raise_mistype = False , custom_types = {}):
25
23
"""
26
24
@@ -45,6 +43,7 @@ def _typer(raise_mistype=False, custom_types={}):
45
43
DESCRIPTION.
46
44
47
45
"""
46
+
48
47
def decorator (func ):
49
48
def force (* args , ** kwargs ):
50
49
_args = list (args )
@@ -54,7 +53,7 @@ def force(*args, **kwargs):
54
53
val = vals [0 ]
55
54
idx = func .__code__ .co_varnames .index (key )
56
55
is_kwargs = key in kwargs .keys ()
57
- if not is_kwargs and idx > len (_args ):
56
+ if not is_kwargs and idx > len (_args ):
58
57
break
59
58
value = kwargs .get (key , None ) if is_kwargs else args [idx ]
60
59
if type (value ) in vals :
@@ -73,13 +72,15 @@ def force(*args, **kwargs):
73
72
if any (val == k for k in custom_types .keys ()):
74
73
exp = custom_types [val ]
75
74
var = args [idx ]
76
- res = exp [' func' ](var ,** exp .get ("kwargs" ,{}))
75
+ res = exp [" func" ](var , ** exp .get ("kwargs" , {}))
77
76
if is_kwargs :
78
77
kwargs [key ] = res
79
78
else :
80
79
_args [idx ] = res
81
80
elif is_kwargs :
82
- kwargs [key ] = var (kwargs [key ]) if var is not list else [kwargs [key ]]
81
+ kwargs [key ] = (
82
+ var (kwargs [key ]) if var is not list else [kwargs [key ]]
83
+ )
83
84
else :
84
85
_args [idx ] = var (args [idx ]) if var is not list else [args [idx ]]
85
86
args = tuple (_args )
You can’t perform that action at this time.
0 commit comments