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

Skip to content

Commit dd45300

Browse files
committed
Don't index into __builtins__ (not supported by PyPy).
1 parent 9d802a9 commit dd45300

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6147,13 +6147,6 @@ def _normalize_input(inp, ename='input'):
61476147
if bins is None:
61486148
bins = rcParams['hist.bins']
61496149

6150-
# xrange becomes range after 2to3
6151-
bin_range = range
6152-
range = __builtins__["range"]
6153-
6154-
# NOTE: the range keyword overwrites the built-in func range !!!
6155-
# needs to be fixed in numpy !!!
6156-
61576150
# Validate string inputs here so we don't have to clutter
61586151
# subsequent code.
61596152
if histtype not in ['bar', 'barstacked', 'step', 'stepfilled']:
@@ -6172,11 +6165,11 @@ def _normalize_input(inp, ename='input'):
61726165
# process the unit information
61736166
self._process_unit_info(xdata=x, kwargs=kwargs)
61746167
x = self.convert_xunits(x)
6175-
if bin_range is not None:
6176-
bin_range = self.convert_xunits(bin_range)
6168+
if range is not None:
6169+
range = self.convert_xunits(range)
61776170

61786171
# Check whether bins or range are given explicitly.
6179-
binsgiven = (cbook.iterable(bins) or bin_range is not None)
6172+
binsgiven = (cbook.iterable(bins) or range is not None)
61806173

61816174
# basic input validation
61826175
flat = np.ravel(x)
@@ -6205,7 +6198,8 @@ def _normalize_input(inp, ename='input'):
62056198
'weights should have the same shape as x')
62066199

62076200
if color is None:
6208-
color = [self._get_lines.get_next_color() for i in xrange(nx)]
6201+
color = [
6202+
self._get_lines.get_next_color() for i in xrange(nx)]
62096203
else:
62106204
color = mcolors.to_rgba_array(color)
62116205
if len(color) != nx:
@@ -6224,12 +6218,12 @@ def _normalize_input(inp, ename='input'):
62246218
if len(xi) > 0:
62256219
xmin = min(xmin, xi.min())
62266220
xmax = max(xmax, xi.max())
6227-
bin_range = (xmin, xmax)
6221+
range = (xmin, xmax)
62286222

62296223
# hist_kwargs = dict(range=range, normed=bool(normed))
62306224
# We will handle the normed kwarg within mpl until we
62316225
# get to the point of requiring numpy >= 1.5.
6232-
hist_kwargs = dict(range=bin_range)
6226+
hist_kwargs = dict(range=range)
62336227

62346228
n = []
62356229
mlast = None
@@ -6514,10 +6508,7 @@ def hist2d(self, x, y, bins=10, range=None, normed=False, weights=None,
65146508
.. plot:: mpl_examples/statistics/plot_hist.py
65156509
"""
65166510

6517-
# xrange becomes range after 2to3
6518-
bin_range = range
6519-
range = __builtins__["range"]
6520-
h, xedges, yedges = np.histogram2d(x, y, bins=bins, range=bin_range,
6511+
h, xedges, yedges = np.histogram2d(x, y, bins=bins, range=range,
65216512
normed=normed, weights=weights)
65226513

65236514
if cmin is not None:

0 commit comments

Comments
 (0)