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 6edf693

Browse filesBrowse files
committed
Don't use __builtins__ (an impl. detail) in pylab.
Also smuggled in some minor reformattings. Fixes #7186. Supersedes #7187 (see discussion there).
1 parent a729227 commit 6edf693
Copy full SHA for 6edf693

File tree

Expand file treeCollapse file tree

1 file changed

+25
-37
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+25
-37
lines changed

‎lib/matplotlib/pylab.py

Copy file name to clipboardExpand all lines: lib/matplotlib/pylab.py
+25-37Lines changed: 25 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -222,59 +222,47 @@
222222

223223
import sys, warnings
224224

225-
from matplotlib.cbook import flatten, is_string_like, exception_to_str, \
226-
silent_list, iterable, dedent
225+
from matplotlib.cbook import (
226+
flatten, is_string_like, exception_to_str, silent_list, iterable, dedent)
227227

228228
import matplotlib as mpl
229229
# make mpl.finance module available for backwards compatability, in case folks
230230
# using pylab interface depended on not having to import it
231231
import matplotlib.finance
232232

233-
from matplotlib.dates import date2num, num2date,\
234-
datestr2num, strpdate2num, drange,\
235-
epoch2num, num2epoch, mx2num,\
236-
DateFormatter, IndexDateFormatter, DateLocator,\
237-
RRuleLocator, YearLocator, MonthLocator, WeekdayLocator,\
238-
DayLocator, HourLocator, MinuteLocator, SecondLocator,\
239-
rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY, MONTHLY,\
240-
WEEKLY, DAILY, HOURLY, MINUTELY, SECONDLY, relativedelta
233+
from matplotlib.dates import (
234+
date2num, num2date, datestr2num, strpdate2num, drange, epoch2num,
235+
num2epoch, mx2num, DateFormatter, IndexDateFormatter, DateLocator,
236+
RRuleLocator, YearLocator, MonthLocator, WeekdayLocator, DayLocator,
237+
HourLocator, MinuteLocator, SecondLocator, rrule, MO, TU, WE, TH, FR,
238+
SA, SU, YEARLY, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, SECONDLY,
239+
relativedelta)
241240

242-
import matplotlib.dates # Do we need this at all?
243-
244-
# bring all the symbols in so folks can import them from
241+
# bring all the symbols in so folks can import them from
245242
# pylab in one fell swoop
246243

247-
248244
## We are still importing too many things from mlab; more cleanup is needed.
249245

250-
from matplotlib.mlab import griddata, stineman_interp, slopes, \
251-
inside_poly, poly_below, poly_between, \
252-
is_closed_polygon, path_length, distances_along_curve, vector_lengths
253-
254-
from matplotlib.mlab import window_hanning, window_none, detrend, demean, \
255-
detrend_mean, detrend_none, detrend_linear, entropy, normpdf, \
256-
find, longest_contiguous_ones, longest_ones, \
257-
prctile, prctile_rank, \
258-
center_matrix, rk4, bivariate_normal, get_xyz_where, \
259-
get_sparse_matrix, dist, \
260-
dist_point_to_segment, segments_intersect, fftsurr, movavg, \
261-
exp_safe, \
262-
amap, rms_flat, l1norm, l2norm, norm_flat, frange, identity, \
263-
base_repr, binary_repr, log2, ispower2, \
264-
rec_append_fields, rec_drop_fields, rec_join, csv2rec, rec2csv, isvector
265-
266-
import matplotlib.mlab as mlab
267-
import matplotlib.cbook as cbook
246+
from matplotlib.mlab import (
247+
amap, base_repr, binary_repr, bivariate_normal, center_matrix, csv2rec,
248+
demean, detrend, detrend_linear, detrend_mean, detrend_none, dist,
249+
dist_point_to_segment, distances_along_curve, entropy, exp_safe,
250+
fftsurr, find, frange, get_sparse_matrix, get_xyz_where, griddata,
251+
identity, inside_poly, is_closed_polygon, ispower2, isvector, l1norm,
252+
l2norm, log2, longest_contiguous_ones, longest_ones, movavg, norm_flat,
253+
normpdf, path_length, poly_below, poly_between, prctile, prctile_rank,
254+
rec2csv, rec_append_fields, rec_drop_fields, rec_join, rk4, rms_flat,
255+
segments_intersect, slopes, stineman_interp, vector_lengths,
256+
window_hanning, window_none)
257+
258+
from matplotlib import cbook, mlab, pyplot as plt
259+
from matplotlib.pyplot import *
268260

269261
from numpy import *
270262
from numpy.fft import *
271263
from numpy.random import *
272264
from numpy.linalg import *
273265

274-
from matplotlib.pyplot import *
275-
276-
# provide the recommended module abbrevs in the pylab namespace
277-
import matplotlib.pyplot as plt
278266
import numpy as np
279267
import numpy.ma as ma
280268

@@ -283,4 +271,4 @@
283271

284272
# This is needed, or bytes will be numpy.random.bytes from
285273
# "from numpy.random import *" above
286-
bytes = __builtins__['bytes']
274+
bytes = six.moves.builtins.bytes

0 commit comments

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