8000 replace six.next -> next (available since Py2.6). by anntzer · Pull Request #10094 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

replace six.next -> next (available since Py2.6). #10094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2631,7 +2631,7 @@ def pie(self, x, explode=None, labels=None, colors=None,
color_cycle = itertools.cycle(colors)

def get_next_color():
return six.next(color_cycle)
return next(color_cycle)

if radius is None:
radius = 1
Expand Down Expand Up @@ -2880,7 +2880,7 @@ def errorbar(self, x, y, yerr=None, xerr=None,
if 'color' in kwargs:
base_style['color'] = kwargs.pop('color')
else:
base_style = six.next(self._get_lines.prop_cycler)
base_style = next(self._get_lines.prop_cycler)

base_style['label'] = '_nolegend_'
base_style.update(fmt_style_kwargs)
Expand Down
8 changes: 3 additions & 5 deletions lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,10 @@ def __call__(self, *args, **kwargs):
return ret

def get_next_color(self):
"""
Return the next color in the cycle.
"""
"""Return the next color in the cycle."""
if 'color' not in self._prop_keys:
return 'k'
return six.next(self.prop_cycler)['color']
return next(self.prop_cycler)['color']

def set_lineprops(self, line, **kwargs):
assert self 8000 .command == 'plot', 'set_lineprops only works with "plot"'
Expand Down Expand Up @@ -275,7 +273,7 @@ def _getdefaults(self, ignore, *kwargs):
for k in prop_keys):
# Need to copy this dictionary or else the next time around
# in the cycle, the dictionary could be missing entries.
default_dict = six.next(self.prop_cycler).copy()
default_dict = next(self.prop_cycler).copy()
for p in ignore:
default_dict.pop(p, None)
else:
Expand Down
14 changes: 5 additions & 9 deletions lib/matplotlib/legend_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,20 +664,16 @@ def create_artists(self, legend, orig_handle,
pad = self._pad * fontsize

if ndivide > 1:
width = (width - pad*(ndivide - 1)) / ndivide
width = (width - pad * (ndivide - 1)) / ndivide

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

a_list = []
for handle1 in orig_handle:
handler = legend.get_legend_handler(handler_map, handle1)
_a_list = handler.create_artists(legend, handle1,
six.next(xds_cycle),
ydescent,
width, height,
fontsize,
trans)
_a_list = handler.create_artists(
legend, handle1,
next(xds_cycle), ydescent, width, height, fontsize, trans)
a_list.extend(_a_list)

return a_list
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/sankey.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ def _get_angle(a, r):
fc = kwargs.pop('fc', kwargs.pop('facecolor', None))
lw = kwargs.pop('lw', kwargs.pop('linewidth', None))
if fc is None:
fc = six.next(self.ax._get_patches_for_fill.prop_cycler)['color']
fc = next(self.ax._get_patches_for_fill.prop_cycler)['color']
patch = PathPatch(Path(vertices, codes), fc=fc, lw=lw, **kwargs)
self.ax.add_patch(patch)

Expand Down
5 changes: 2 additions & 3 deletions lib/matplotlib/stackplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def stackplot(axes, x, *args, **kwargs):
# Color between x = 0 and the first array.
color = axes._get_lines.get_next_color()
coll = axes.fill_between(x, first_line, stack[0, :],
facecolor=color, label=six.next(labels, None),
facecolor=color, label=next(labels, None),
**kwargs)
coll.sticky_edges.y[:] = [0]
r = [coll]
Expand All @@ -127,7 +127,6 @@ def stackplot(axes, x, *args, **kwargs):
for i in xrange(len(y) - 1):
color = axes._get_lines.get_next_color()
r.append(axes.fill_between(x, stack[i, :], stack[i + 1, :],
facecolor=color,
label=six.next(labels, None),
facecolor=color, label=next(labels, None),
**kwargs))
return r
2 changes: 1 addition & 1 deletion lib/mpl_toolkits/axisartist/clip_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def clip_line_to_rect(xline, yline, bbox):

ccc = iter(["ro", "go", "rx", "bx"])
for ttt in ticks:
cc = six.next(ccc)
cc = next(ccc)
for (xx, yy), aa in ttt:
plt.plot([xx], [yy], cc)

Expand Down
0