Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 665b399

Browse files
committed
Add some comments
1 parent 09fcae4 commit 665b399

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/matplotlib/units.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,19 @@ def _accepts_units(convert_x, convert_y):
6565
def decorator(func):
6666
def wrapper(*args, **kwargs):
6767
axes = args[0]
68+
# Bind the incoming arguments to the function signature
6869
bound_args = inspect.signature(func).bind(*args, **kwargs)
70+
# Get the original arguments - these will be modified later
6971
arguments = bound_args.arguments
72+
# Check for data kwarg
7073
has_data = (('data' in arguments) and
7174
(arguments['data'] is not None))
7275
if has_data:
7376
data = arguments['data']
7477

78+
# Loop through each argument to be converted, update the axis
79+
# unit info, convert argument, and replace in *arguments* with
80+
# converted values
7581
for arg in convert_x:
7682
if has_data and arguments[arg] in data:
7783
data_arg = arguments[arg]
@@ -100,8 +106,10 @@ def wrapper(*args, **kwargs):
100106

101107
if has_data:
102108
arguments['data'] = data
109+
# Update the arguments with converted values
103110
bound_args.arguments = arguments
104111

112+
# Give updated values to the original function
105113
args = bound_args.args
106114
kwargs = bound_args.kwargs
107115
return func(*args, **kwargs)

0 commit comments

Comments
 (0)