Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a5dd4ae

Browse filesBrowse files
committed
Use star-unpacking.
1 parent f021e0d commit a5dd4ae
Copy full SHA for a5dd4ae

File tree

Expand file treeCollapse file tree

3 files changed

+15
-24
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+15
-24
lines changed

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+5-8Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2734,16 +2734,13 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0,
27342734
raise TypeError('stem expected between 1 and 5 positional '
27352735
'arguments, got {}'.format(args))
27362736

2737-
y = np.asarray(args[0])
2738-
args = args[1:]
2739-
2740-
# Try a second one
2741-
if not args:
2737+
if len(args) == 1:
2738+
y, = args
27422739
x = np.arange(len(y))
2740+
args = ()
27432741
else:
2744-
x = y
2745-
y = np.asarray(args[0], dtype=float)
2746-
args = args[1:]
2742+
x, y, *args = args
2743+
27472744
self._process_unit_info(xdata=x, ydata=y)
27482745
x = self.convert_xunits(x)
27492746
y = self.convert_yunits(y)

‎lib/matplotlib/tri/triangulation.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tri/triangulation.py
+2-5Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,9 @@ def get_from_args_and_kwargs(*args, **kwargs):
134134
the possible args and kwargs.
135135
"""
136136
if isinstance(args[0], Triangulation):
137-
triangulation = args[0]
138-
args = args[1:]
137+
triangulation, *args = args
139138
else:
140-
x = args[0]
141-
y = args[1]
142-
args = args[2:] # Consumed first two args.
139+
x, y, *args = args
143140

144141
# Check triangles in kwargs then args.
145142
triangles = kwargs.pop('triangles', None)

‎lib/mpl_toolkits/mplot3d/axes3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/axes3d.py
+8-11Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,8 +1514,7 @@ def plot(self, xs, ys, *args, zdir='z', **kwargs):
15141514
# args[0] is a string matches the behavior of 2D `plot` (via
15151515
# `_process_plot_var_args`).
15161516
if args and not isinstance(args[0], str):
1517-
zs = args[0]
1518-
args = args[1:]
1517+
zs, *args = args
15191518
if 'zs' in kwargs:
15201519
raise TypeError("plot() for multiple values for argument 'z'")
15211520
else:
@@ -1973,12 +1972,12 @@ def plot_trisurf(self, *args, color=None, norm=None, vmin=None, vmax=None,
19731972

19741973
tri, args, kwargs = \
19751974
Triangulation.get_from_args_and_kwargs(*args, **kwargs)
1976-
if 'Z' in kwargs:
1977-
z = np.asarray(kwargs.pop('Z'))
1978-
else:
1979-
z = np.asarray(args[0])
1975+
try:
1976+
z = kwargs.pop('Z')
1977+
except KeyError:
19801978
# We do this so Z doesn't get passed as an arg to PolyCollection
1981-
args = args[1:]
1979+
z, *args = args
1980+
z = np.asarray(z)
19821981

19831982
triangles = tri.get_masked_triangles()
19841983
xt = tri.x[triangles]
@@ -2156,9 +2155,8 @@ def tricontour(self, *args,
21562155
if 'Z' in kwargs:
21572156
Z = kwargs.pop('Z')
21582157
else:
2159-
Z = args[0]
21602158
# We do this so Z doesn't get passed as an arg to Axes.tricontour
2161-
args = args[1:]
2159+
Z, *args = args
21622160

21632161
jX, jY, jZ = art3d.rotate_axes(X, Y, Z, zdir)
21642162
tri = Triangulation(jX, jY, tri.triangles, tri.mask)
@@ -2246,9 +2244,8 @@ def tricontourf(self, *args, zdir='z', offset=None, **kwargs):
22462244
if 'Z' in kwargs:
22472245
Z = kwargs.pop('Z')
22482246
else:
2249-
Z = args[0]
22502247
# We do this so Z doesn't get passed as an arg to Axes.tricontourf
2251-
args = args[1:]
2248+
Z, *args = args
22522249

22532250
jX, jY, jZ = art3d.rotate_axes(X, Y, Z, zdir)
22542251
tri = Triangulation(jX, jY, tri.triangles, tri.mask)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.