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

Skip to content

Commit 4e47f87

Browse files
authored
Merge pull request #10094 from anntzer/sixnext
replace six.next -> next (available since Py2.6).
2 parents 6a95a85 + 60beb5b commit 4e47f87

File tree

6 files changed

+14
-21
lines changed

6 files changed

+14
-21
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2631,7 +2631,7 @@ def pie(self, x, explode=None, labels=None, colors=None,
26312631
color_cycle = itertools.cycle(colors)
26322632

26332633
def get_next_color():
2634-
return six.next(color_cycle)
2634+
return next(color_cycle)
26352635

26362636
if radius is None:
26372637
radius = 1
@@ -2873,7 +2873,7 @@ def errorbar(self, x, y, yerr=None, xerr=None,
28732873
if 'color' in kwargs:
28742874
base_style['color'] = kwargs.pop('color')
28752875
else:
2876-
base_style = six.next(self._get_lines.prop_cycler)
2876+
base_style = next(self._get_lines.prop_cycler)
28772877

28782878
base_style['label'] = '_nolegend_'
28792879
base_style.update(fmt_style_kwargs)

lib/matplotlib/axes/_base.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,10 @@ def __call__(self, *args, **kwargs):
197197
return ret
198198

199199
def get_next_color(self):
200-
"""
201-
Return the next color in the cycle.
202-
"""
200+
"""Return the next color in the cycle."""
203201
if 'color' not in self._prop_keys:
204202
return 'k'
205-
return six.next(self.prop_cycler)['color']
203+
return next(self.prop_cycler)['color']
206204

207205
def set_lineprops(self, line, **kwargs):
208206
assert self.command == 'plot', 'set_lineprops only works with "plot"'
@@ -275,7 +273,7 @@ def _getdefaults(self, ignore, *kwargs):
275273
for k in prop_keys):
276274
# Need to copy this dictionary or else the next time around
277275
# in the cycle, the dictionary could be missing entries.
278-
default_dict = six.next(self.prop_cycler).copy()
276+
default_dict = next(self.prop_cycler).copy()
279277
for p in ignore:
280278
default_dict.pop(p, None)
281279
else:

lib/matplotlib/legend_handler.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -664,20 +664,16 @@ def create_artists(self, legend, orig_handle,
664664
pad = self._pad * fontsize
665665

666666
if ndivide > 1:
667-
width = (width - pad*(ndivide - 1)) / ndivide
667+
width = (width - pad * (ndivide - 1)) / ndivide
668668

669-
xds = [xdescent - (width + pad) * i for i in range(ndivide)]
670-
xds_cycle = cycle(xds)
669+
xds_cycle = cycle(xdescent - (width + pad) * np.arange(ndivide))
671670

672671
a_list = []
673672
for handle1 in orig_handle:
674673
handler = legend.get_legend_handler(handler_map, handle1)
675-
_a_list = handler.create_artists(legend, handle1,
676-
six.next(xds_cycle),
677-
ydescent,
678-
width, height,
679-
fontsize,
680-
trans)
674+
_a_list = handler.create_artists(
675+
legend, handle1,
676+
next(xds_cycle), ydescent, width, height, fontsize, trans)
681677
a_list.extend(_a_list)
682678

683679
return a_list

lib/matplotlib/sankey.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ def _get_angle(a, r):
741741
fc = kwargs.pop('fc', kwargs.pop('facecolor', None))
742742
lw = kwargs.pop('lw', kwargs.pop('linewidth', None))
743743
if fc is None:
744-
fc = six.next(self.ax._get_patches_for_fill.prop_cycler)['color']
744+
fc = next(self.ax._get_patches_for_fill.prop_cycler)['color']
745745
patch = PathPatch(Path(vertices, codes), fc=fc, lw=lw, **kwargs)
746746
self.ax.add_patch(patch)
747747

lib/matplotlib/stackplot.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def stackplot(axes, x, *args, **kwargs):
118118
# Color between x = 0 and the first array.
119119
color = axes._get_lines.get_next_color()
120120
coll = axes.fill_between(x, first_line, stack[0, :],
121-
facecolor=color, label=six.next(labels, None),
121+
facecolor=color, label=next(labels, None),
122122
**kwargs)
123123
coll.sticky_edges.y[:] = [0]
124124
r = [coll]
@@ -127,7 +127,6 @@ def stackplot(axes, x, *args, **kwargs):
127127
for i in xrange(len(y) - 1):
128128
color = axes._get_lines.get_next_color()
129129
r.append(axes.fill_between(x, stack[i, :], stack[i + 1, :],
130-
facecolor=color,
131-
label=six.next(labels, None),
130+
facecolor=color, label=next(labels, None),
132131
**kwargs))
133132
return r

lib/mpl_toolkits/axisartist/clip_path.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def clip_line_to_rect(xline, yline, bbox):
156156

157157
ccc = iter(["ro", "go", "rx", "bx"])
158158
for ttt in ticks:
159-
cc = six.next(ccc)
159+
cc = next(ccc)
160160
for (xx, yy), aa in ttt:
161161
plt.plot([xx], [yy], cc)
162162

0 commit comments

Comments
 (0)