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

Skip to content

Commit 3273673

Browse files
tacaswelljankatins
authored andcommitted
PEP8: line wrapping fixes
1 parent ea3e22d commit 3273673

File tree

1 file changed

+37
-25
lines changed

1 file changed

+37
-25
lines changed

lib/matplotlib/__init__.py

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,8 +1585,8 @@ def param(func):
15851585
# remove the first "ax" / self arg
15861586
arg_names = _arg_names[1:]
15871587
else:
1588-
# in this case we need a supplied list of arguments or we need to replace all variables
1589-
# -> compile time check
1588+
# in this case we need a supplied list of arguments or we need to
1589+
# replace all variables -> compile time check
15901590
if replace_names is None:
15911591
# all argnames should be replaced
15921592
arg_names = None
@@ -1599,8 +1599,9 @@ def param(func):
15991599
# all to be replaced arguments are in the list
16001600
arg_names = _arg_names[1:]
16011601
else:
1602-
msg = "Got unknown 'replace_names' and wrapped function '%s' uses '*args', " \
1603-
"need 'positional_parameter_names'!"
1602+
msg = ("Got unknown 'replace_names' and wrapped function "
1603+
"'%s' uses '*args', need "
1604+
"'positional_parameter_names'!")
16041605
raise AssertionError(msg % func.__name__)
16051606
else:
16061607
if positional_parameter_names is not None:
@@ -1609,11 +1610,14 @@ def param(func):
16091610
if replace_all_args:
16101611
arg_names = []
16111612
else:
1612-
msg = "Got 'replace_names' and wrapped function '%s' uses *args, " \
1613-
"need 'positional_parameter_names' or 'replace_all_args'!"
1613+
msg = ("Got 'replace_names' and wrapped function "
1614+
"'%s' uses *args, need "
1615+
"'positional_parameter_names' or "
1616+
"'replace_all_args'!")
16141617
raise AssertionError(msg % func.__name__)
16151618

1616-
# compute the possible label_namer and label position in positional arguments
1619+
# compute the possible label_namer and label position in positional
1620+
# arguments
16171621
label_pos = 9999 # bigger than all "possible" argument lists
16181622
label_namer_pos = 9999 # bigger than all "possible" argument lists
16191623
if label_namer and arg_names and (label_namer in arg_names):
@@ -1627,12 +1631,12 @@ def param(func):
16271631
# which might surprise the user :-(
16281632
if label_namer and not _has_varkwargs:
16291633
if not arg_names:
1630-
msg = "label_namer '%s' can't be found as the parameter without " \
1631-
"'positional_parameter_names'."
1634+
msg = ("label_namer '%s' can't be found as the parameter "
1635+
"without 'positional_parameter_names'.")
16321636
raise AssertionError(msg % label_namer)
16331637
elif label_namer not in arg_names:
1634-
msg = "label_namer '%s' can't be found in the parameter names " \
1635-
"(known argnames: %s)."
1638+
msg = ("label_namer '%s' can't be found in the parameter "
1639+
"names (known argnames: %s).")
16361640
raise AssertionError(msg % (label_namer, arg_names))
16371641
else:
16381642
# this is the case when the name is in arg_names
@@ -1643,7 +1647,8 @@ def inner(ax, *args, **kwargs):
16431647
data = kwargs.pop('data', None)
16441648
label = None
16451649
if data is not None:
1646-
# save the current label_namer value so that it can be used as a label
1650+
# save the current label_namer value so that it can be used as
1651+
# a label
16471652
if label_namer_pos < len(args):
16481653
label = args[label_namer_pos]
16491654
else:
@@ -1654,23 +1659,30 @@ def inner(ax, *args, **kwargs):
16541659

16551660
if (replace_names is None) or replace_all_args:
16561661
# all should be replaced
1657-
args = tuple(_replacer(data, a) for j, a in enumerate(args))
1662+
args = tuple(_replacer(data, a) for
1663+
j, a in enumerate(args))
16581664
else:
1659-
# An arg is replaced if the arg_name of that position is in replace_names ...
1665+
# An arg is replaced if the arg_name of that position is in
1666+
# replace_names ...
16601667
if len(arg_names) < len(args):
1661-
raise RuntimeError("Got more args than function expects")
1662-
args = tuple(_replacer(data, a) if arg_names[j] in replace_names else a
1668+
raise RuntimeError(
1669+
"Got more args than function expects")
1670+
args = tuple(_replacer(data, a)
1671+
if arg_names[j] in replace_names else a
16631672
for j, a in enumerate(args))
16641673

16651674
if replace_names is None:
1666-
kwargs = dict((k, _replacer(data, v)) for k, v in six.iteritems(kwargs))
1675+
kwargs = dict((k, _replacer(data, v))
1676+
for k, v in six.iteritems(kwargs))
16671677
else:
16681678
# ... or a kwarg of that name in replace_names
1669-
kwargs = dict((k, _replacer(data, v) if k in replace_names else v)
1670-
for k, v in six.iteritems(kwargs))
1679+
kwargs = dict((k, _replacer(data, v)
1680+
if k in replace_names else v)
1681+
for k, v in six.iteritems(kwargs))
16711682

1672-
# replace the label if this func "wants" a label arg and the user didn't set one
1673-
# Note: if the usere puts in "label=None", it does *NOT* get replaced!
1683+
# replace the label if this func "wants" a label arg and the user
1684+
# didn't set one Note: if the usere puts in "label=None", it does
1685+
# *NOT* get replaced!
16741686
user_supplied_label = (
16751687
(len(args) >= label_pos) or # label is included in args
16761688
('label' in kwargs) # ... or in kwargs
@@ -1688,10 +1700,10 @@ def inner(ax, *args, **kwargs):
16881700
kwargs['label'] = label
16891701
else:
16901702
import warnings
1691-
msg = "Tried to set a label via parameter '%s' in " \
1692-
"func '%s' but couldn't find such an argument. \n"\
1693-
"(This is a programming error, please report to the " \
1694-
"matplotlib list!)"
1703+
msg = ("Tried to set a label via parameter '%s' in "
1704+
"func '%s' but couldn't find such an argument. \n"
1705+
"(This is a programming error, please report to "
1706+
"the matplotlib list!)")
16951707
warnings.warn(msg % (label_namer, func.__name__),
16961708
RuntimeWarning, stacklevel=2)
16971709
# raise Exception()

0 commit comments

Comments
 (0)