File tree 5 files changed +14
-16
lines changed
Filter options
5 files changed +14
-16
lines changed
Original file line number Diff line number Diff line change @@ -212,10 +212,7 @@ def format_value(value):
212
212
# Get argspec of wrapped function
213
213
base_func = getattr (Axes , func )
214
214
has_data = 'data' in inspect .signature (base_func ).parameters
215
- if hasattr (base_func , '__wrapped__' ):
216
- work_func = base_func .__wrapped__
217
- else :
218
- work_func = base_func
215
+ work_func = inspect .unwrap (base_func )
219
216
220
217
args , varargs , varkw , defaults = inspect .getargspec (work_func )
221
218
Original file line number Diff line number Diff line change @@ -1603,23 +1603,24 @@ def param(func):
1603
1603
else :
1604
1604
python_has_signature = True
1605
1605
else :
1606
- signature = inspect .signature
1607
- Parameter = inspect .Parameter
1606
+ if python_has_signature :
1607
+ signature = inspect .signature
1608
+ Parameter = inspect .Parameter
1608
1609
1609
1610
if not python_has_signature :
1610
1611
arg_spec = inspect .getargspec (func )
1611
1612
_arg_names = arg_spec .args
1612
- _has_no_varargs = arg_spec .varargs is None
1613
+ _has_varargs = arg_spec .varargs is not None
1613
1614
_has_varkwargs = arg_spec .keywords is not None
1614
1615
else :
1615
1616
sig = signature (func )
1616
- _has_no_varargs = True
1617
+ _has_varargs = False
1617
1618
_has_varkwargs = False
1618
1619
_arg_names = []
1619
1620
params = list (sig .parameters .values ())
1620
1621
for p in params :
1621
1622
if p .kind is Parameter .VAR_POSITIONAL :
1622
- _has_no_varargs = False
1623
+ _has_varargs = True
1623
1624
elif p .kind is Parameter .VAR_KEYWORD :
1624
1625
_has_varkwargs = True
1625
1626
else :
@@ -1638,7 +1639,7 @@ def param(func):
1638
1639
# positional args can end up in **kwargs, so only *varargs make
1639
1640
# problems.
1640
1641
# http://stupidpythonideas.blogspot.de/2013/08/arguments-and-parameters.html
1641
- if _has_no_varargs :
1642
+ if not _has_varargs :
1642
1643
# all args are "named", so no problem
1643
1644
# remove the first "ax" / self arg
1644
1645
arg_names = _arg_names [1 :]
Original file line number Diff line number Diff line change @@ -5641,15 +5641,15 @@ def pcolorfast(self, *args, **kwargs):
5641
5641
self .autoscale_view (tight = True )
5642
5642
return ret
5643
5643
5644
- # @unpack_labeled_data() # takes 2d data :-(
5644
+ @unpack_labeled_data ()
5645
5645
def contour (self , * args , ** kwargs ):
5646
5646
if not self ._hold :
5647
5647
self .cla ()
5648
5648
kwargs ['filled' ] = False
5649
5649
return mcontour .QuadContourSet (self , * args , ** kwargs )
5650
5650
contour .__doc__ = mcontour .QuadContourSet .contour_doc
5651
5651
5652
- # @unpack_labeled_data() # takes 2d data :-(
5652
+ @unpack_labeled_data ()
5653
5653
def contourf (self , * args , ** kwargs ):
5654
5654
if not self ._hold :
5655
5655
self .cla ()
Original file line number Diff line number Diff line change 15
15
import matplotlib
16
16
17
17
from matplotlib import cbook
18
- from matplotlib .cbook import _string_to_bool , iterable , get_index_y , get_label
18
+ from matplotlib .cbook import _string_to_bool , iterable , index_of , get_label
19
19
from matplotlib import docstring
20
20
import matplotlib .colors as mcolors
21
21
import matplotlib .lines as mlines
31
31
import matplotlib .image as mimage
32
32
from matplotlib .offsetbox import OffsetBox
33
33
from matplotlib .artist import allow_rasterization
34
- from matplotlib .cbook import iterable , get_index_y
34
+ from matplotlib .cbook import iterable , index_of
35
35
from matplotlib .rcsetup import cycler
36
36
37
37
rcParams = matplotlib .rcParams
@@ -356,7 +356,7 @@ def _plot_args(self, tup, kwargs):
356
356
x = np .atleast_1d (tup [0 ])
357
357
y = np .atleast_1d (tup [- 1 ])
358
358
else :
359
- x , y = get_index_y (tup [- 1 ])
359
+ x , y = index_of (tup [- 1 ])
360
360
361
361
x , y = self ._xy_from_xy (x , y )
362
362
Original file line number Diff line number Diff line change @@ -2491,7 +2491,7 @@ def pts_to_midstep(x, *args):
2491
2491
'step-mid' : pts_to_midstep }
2492
2492
2493
2493
2494
- def get_index_y (y ):
2494
+ def index_of (y ):
2495
2495
"""
2496
2496
A helper function to get the index of an input to plot
2497
2497
against if x values are not explicitly given.
You can’t perform that action at this time.
0 commit comments