File tree 1 file changed +8
-0
lines changed 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -65,13 +65,19 @@ def _accepts_units(convert_x, convert_y):
65
65
def decorator (func ):
66
66
def wrapper (* args , ** kwargs ):
67
67
axes = args [0 ]
68
+ # Bind the incoming arguments to the function signature
68
69
bound_args = inspect .signature (func ).bind (* args , ** kwargs )
70
+ # Get the original arguments - these will be modified later
69
71
arguments = bound_args .arguments
72
+ # Check for data kwarg
70
73
has_data = (('data' in arguments ) and
71
74
(arguments ['data' ] is not None ))
72
75
if has_data :
73
76
data = arguments ['data' ]
74
77
78
+ # Loop through each argument to be converted, update the axis
79
+ # unit info, convert argument, and replace in *arguments* with
80
+ # converted values
75
81
for arg in convert_x :
76
82
if has_data and arguments [arg ] in data :
77
83
data_arg = arguments [arg ]
@@ -100,8 +106,10 @@ def wrapper(*args, **kwargs):
100
106
101
107
if has_data :
102
108
arguments ['data' ] = data
109
+ # Update the arguments with converted values
103
110
bound_args .arguments = arguments
104
111
112
+ # Give updated values to the original function
105
113
args = bound_args .args
106
114
kwargs = bound_args .kwargs
107
115
return func (* args , ** kwargs )
You can’t perform that action at this time.
0 commit comments