8000 Re-enabled PEP8 test, closing #2443. · matplotlib/matplotlib@1dc0404 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1dc0404

Browse files
committed
Re-enabled PEP8 test, closing #2443.
1 parent d1cb803 commit 1dc0404

File tree

12 files changed

+43
-45
lines changed

12 files changed

+43
-45
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -558,17 +558,18 @@ def annotate(self, *args, **kwargs):
558558
"figure points", "figure pixels", "figure fraction", "axes
559559
points", .... See `matplotlib.text.Annotation` for more details.
560560
561-
textcoords : string, optional, default: None
561+
textcoords : string, optional
562562
string that indicates what type of coordinates `text` is. Examples:
563563
"figure points", "figure pixels", "figure fraction", "axes
564564
points", .... See `matplotlib.text.Annotation` for more details.
565+
Default is None.
565566
566-
arrowprops : `matplotlib.lines.Line2D` properties, optional, default: None
567+
arrowprops : `matplotlib.lines.Line2D` properties, optional
567568
Dictionnary of line properties for the arrow that connects the
568569
annotation to the point. If the dictionnary has a key
569570
`arrowstyle`, a `FancyArrowPatch` instance is created and drawn.
570571
See `matplotlib.text.Annotation` for more details on valid
571-
options.
572+
options. Default is None.
572573
573574
Returns
574575
-------
@@ -3643,7 +3644,7 @@ def hexbin(self, x, y, C=None, gridsize=100, bins=None,
36433644
# Transform accum if needed
36443645
if bins == 'log':
36453646
accum = np.log10(accum + 1)
3646-
elif bins != None:
3647+
elif bins is not None:
36473648
if not iterable(bins):
36483649
minimum, maximum = min(accum), max(accum)
36493650
bins -= 1 # one less edge than bins
@@ -5119,7 +5120,8 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
51195120
51205121
Returns
51215122
-------
5122-
tuple : (n, bins, patches) or ([n0, n1, ...], bins, [patches0, patches1,...])
5123+
tuple : ``(n, bins, patches)`` or \
5124+
``([n0, n1, ...], bins, [patches0, patches1,...])``
51235125
51245126
Other Parameters
51255127
----------------
@@ -5246,7 +5248,7 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
52465248
# this will automatically overwrite bins,
52475249
# so that each histogram uses the same bins
52485250
m, bins = np.histogram(x[i], bins, weights=w[i], **hist_kwargs)
5249-
m = m.astype(float) # causes problems later if it's an int
5251+
m = m.astype(float) # causes problems later if it's an int
52505252
if mlast is None:
52515253
mlast = np.zeros(len(bins)-1, m.dtype)
52525254
if normed and not stacked:
@@ -5417,15 +5419,15 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
54175419
xmin0 = max(_saved_bounds[0]*0.9, minimum)
54185420
xmax = self.dataLim.intervalx[1]
54195421
for m in n:
5420-
xmin = np.amin(m[m != 0]) # filter out the 0 height bins
5422+
xmin = np.amin(m[m != 0]) # filter out the 0 height bins
54215423
xmin = max(xmin*0.9, minimum)
54225424
xmin = min(xmin0, xmin)
54235425
self.dataLim.intervalx = (xmin, xmax)
54245426
elif orientation == 'vertical':
54255427
ymin0 = max(_saved_bounds[1]*0.9, minimum)
54265428
ymax = self.dataLim.intervaly[1]
54275429
for m in n:
5428-
ymin = np.amin(m[m != 0]) # filter out the 0 height bins
5430+
ymin = np.amin(m[m != 0]) # filter out the 0 height bins
54295431
ymin = max(ymin*0.9, minimum)
54305432
ymin = min(ymin0, ymin)
54315433
self.dataLim.intervaly = (ymin, ymax)

lib/matplotlib/axes/_base.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -698,8 +698,6 @@ def get_yaxis_text2_transform(self, pad_points):
698698
self.figure.dpi_scale_trans),
699699
"center", "left")
700700

701-
702-
703701
def _update_transScale(self):
704702
self.transScale.set(
705703
mtransforms.blended_transform_factory(
@@ -1090,7 +1088,8 @@ def set_anchor(self, anchor):
10901088
===== ============
10911089
10921090
"""
1093-
if anchor in list(six.iterkeys(mtransforms.Bbox.coefs)) or len(anchor) == 2:
1091+
if (anchor in list(six.iterkeys(mtransforms.Bbox.coefs)) or
1092+
len(anchor) == 2):
10941093
self._anchor = anchor
10951094
else:
10961095
raise ValueError('argument must be among %s' %
@@ -1593,9 +1592,9 @@ def add_container(self, container):
15931592

15941593
def relim(self, visible_only=False):
15951594
"""
1596-
Recompute the data limits based on current artists. If you want to exclude
1597-
invisible artists from the calculation, set
1598-
`visible_only=True`
1595+
Recompute the data limits based on current artists. If you want to
1596+
exclude invisible artists from the calculation, set
1597+
``visible_only=True``
15991598
16001599
At present, :class:`~matplotlib.collections.Collection`
16011600
instances are not supported.
@@ -2503,7 +2502,8 @@ def set_xlim(self, left=None, right=None, emit=True, auto=False, **kw):
25032502
if 'xmax' in kw:
25042503
right = kw.pop('xmax')
25052504
if kw:
2506-
raise ValueError("unrecognized kwargs: %s" % list(six.iterkeys(kw)))
2505+
raise ValueError("unrecognized kwargs: %s" %
2506+
list(six.iterkeys(kw)))
25072507

25082508
if right is None and iterable(left):
25092509
left, right = left
@@ -2732,7 +2732,8 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False, **kw):
27322732
if 'ymax' in kw:
27332733
top = kw.pop('ymax')
27342734
if kw:
2735-
raise ValueError("unrecognized kwargs: %s" % list(six.iterkeys(kw)))
2735+
raise ValueError("unrecognized kwargs: %s" %
2736+
list(six.iterkeys(kw)))
27362737

27372738
if top is None and iterable(bottom):
27382739
bottom, top = bottom

lib/matplotlib/backends/backend_qt4.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def mouseDoubleClickEvent(self, event):
272272
FigureCanvasBase.button_press_event(self, x, y,
273273
button, dblclick=True)
274274
if DEBUG:
275-
print ('button doubleclicked:', event.button())
275+
print('button doubleclicked:', event.button())
276276

277277
def mouseMoveEvent(self, event):
278278
x = event.x()
@@ -720,8 +720,8 @@ def save_figure(self, *args):
720720
matplotlib.rcParams['savefig.directory'] = startpath
721721
else:
722722
# save dir for next time
723-
matplotlib.rcParams['savefig.directory'] = os.path.dirname(
724-
six.text_type(fname))
723+
savefig_dir = os.path.dirname(six.text_type(fname))
724+
matplotlib.rcParams['savefig.directory'] = savefig_dir
725725
try:
726726
self.canvas.print_figure(six.text_type(fname))
727727
except Exception as e:

lib/matplotlib/backends/backend_webagg_core.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
# - `backend_webagg.py` contains a concrete implementation of a basic
1111
# application, implemented with tornado.
1212

13-
from __future__ import absolute_import, division, print_function, unicode_literals
13+
from __future__ import (absolute_import, division, print_function,
14+
unicode_literals)
1415

1516
import six
1617

@@ -283,8 +284,9 @@ def get_javascript(cls, stream=None):
283284
json.dumps(toolitems)))
284285

285286
extensions = []
286-
for filetype, ext in sorted(
287-
FigureCanvasWebAggCore.get_supported_filetypes_grouped().items()):
287+
for filetype, ext in sorted(FigureCanvasWebAggCore.
288+
get_supported_filetypes_grouped().
289+
items()):
288290
extensions.append(ext[0])
289291
output.write("mpl.extensions = {0};\n\n".format(
290292
json.dumps(extensions)))

lib/matplotlib/cm.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,8 @@ def _generate_cmap(name, lutsize):
7575

7676
LUTSIZE = mpl.rcParams['image.lut']
7777

78-
_cmapnames = list(six.iterkeys(datad)) # need this list because datad is changed in loop
79-
8078
# Generate the reversed specifications ...
81-
82-
for cmapname in _cmapnames:
79+
for cmapname in list(six.iterkeys(datad)):
8380
spec = datad[cmapname]
8481
spec_reversed = _reverse_cmap_spec(spec)
8582
datad[cmapname + '_r'] = spec_reversed

lib/matplotlib/dates.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -820,8 +820,8 @@ def __init__(self, tz=None, minticks=5, maxticks=None,
820820
5000, 10000, 20000, 50000, 100000, 200000, 500000,
821821
1000000]}
822822
self._byranges = [None, list(xrange(1, 13)), list(xrange(1, 32)),
823-
list(xrange(0, 24)), list(xrange(0, 60)), list(xrange(0, 60)),
824-
None]
823+
list(xrange(0, 24)), list(xrange(0, 60)),
824+
list(xrange(0, 60)), None]
825825

826826
def __call__(self):
827827
'Return the locations of the ticks'

lib/matplotlib/figure.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1415,7 +1415,8 @@ def savefig(self, *args, **kwargs):
14151415

14161416
kwargs.setdefault('dpi', rcParams['savefig.dpi'])
14171417
frameon = kwargs.pop('frameon', rcParams['savefig.frameon'])
1418-
transparent = kwargs.pop('transparent', rcParams['savefig.transparent'])
1418+
transparent = kwargs.pop('transparent',
1419+
rcParams['savefig.transparent'])
14191420

14201421
if transparent:
14211422
kwargs.setdefault('facecolor', 'none')

lib/matplotlib/tests/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def setup():
2828
"Could not set locale to English/United States. "
2929
"Some date-related tests may fail")
3030

31-
use('Agg', warn=False) # use Agg backend for these tests
31+
use('Agg', warn=False) # use Agg backend for these tests
3232

3333
# These settings *must* be hardcoded for running the comparison
3434
# tests and are not necessarily the default values as specified in

lib/matplotlib/tests/test_backend_pdf.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212

1313
from matplotlib import cm, rcParams
1414
from matplotlib import pyplot as plt
15-
from matplotlib.testing.decorators import image_comparison, knownfailureif, cleanup
15+
from matplotlib.testing.decorators import (image_comparison, knownfailureif,
16+
cleanup)
1617

1718
if 'TRAVIS' not in os.environ:
18-
@image_comparison(baseline_images=['pdf_use14corefonts'], extensions=['pdf'])
19+
@image_comparison(baseline_images=['pdf_use14corefonts'],
20+
extensions=['pdf'])
1921
def test_use14corefonts():
2022
rcParams['pdf.use14corefonts'] = True
2123
rcParams['font.family'] = 'sans-serif'

lib/matplotlib/tests/test_backend_pgf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ def create_figure():
7474
plt.figure()
7575
x = np.linspace(0, 1, 15)
7676
plt.plot(x, x ** 2, "b-")
77-
plt.fill_between([0., .4], [.4, 0.], hatch='//', facecolor="lightgray", edgecolor="red")
77+
plt.fill_between([0., .4], [.4, 0.], hatch='//', facecolor="lightgray",
78+
edgecolor="red")
7879
plt.plot(x, 1 - x**2, "g>")
7980
plt.plot([0.9], [0.5], "ro", markersize=3)
8081
plt.text(0.9, 0.5, 'unicode (ü, °, µ) and math ($\\mu_i = x_i^2$)',

lib/matplotlib/tests/test_coding_standards.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,12 @@
4343
'*/matplotlib/_pylab_helpers.py',
4444
'*/matplotlib/afm.py',
4545
'*/matplotlib/artist.py',
46-
'*/matplotlib/axes.py',
4746
'*/matplotlib/axis.py',
4847
'*/matplotlib/backend_bases.py',
4948
'*/matplotlib/bezier.py',
5049
'*/matplotlib/cbook.py',
5150
'*/matplotlib/collections.py',
52-
'*/matplotlib/docstring.py',
5351
'*/matplotlib/dviread.py',
54-
'*/matplotlib/finance.py',
5552
'*/matplotlib/font_manager.py',
5653
'*/matplotlib/fontconfig_pattern.py',
5754
'*/matplotlib/gridspec.py',
@@ -82,10 +79,7 @@
8279
'*/matplotlib/testing/jpl_units/UnitDblConverter.py',
8380
'*/matplotlib/testing/jpl_units/UnitDblFormatter.py',
8481
'*/matplotlib/testing/jpl_units/__init__.py',
85-
'*/matplotlib/tri/tricontour.py',
8682
'*/matplotlib/tri/triinterpolate.py',
87-
'*/matplotlib/tri/tripcolor.py',
88-
'*/matplotlib/tri/triplot.py',
8983
'*/matplotlib/tests/test_axes.py',
9084
'*/matplotlib/tests/test_bbox_tight.py',
9185
'*/matplotlib/tests/test_dates.py',
@@ -123,15 +117,13 @@
123117
'*/matplotlib/backends/backend_svg.py',
124118
'*/matplotlib/backends/backend_template.py',
125119
'*/matplotlib/backends/backend_tkagg.py',
126-
'*/matplotlib/backends/backend_webagg.py',
127120
'*/matplotlib/backends/backend_wx.py',
128121
'*/matplotlib/backends/backend_wxagg.py',
129122
'*/matplotlib/backends/qt4_compat.py',
130123
'*/matplotlib/backends/tkagg.py',
131124
'*/matplotlib/backends/windowing.py',
132125
'*/matplotlib/backends/qt4_editor/figureoptions.py',
133126
'*/matplotlib/backends/qt4_editor/formlayout.py',
134-
'*/matplotlib/sphinxext/__init__.py',
135127
'*/matplotlib/sphinxext/ipython_console_highlighting.py',
136128
'*/matplotlib/sphinxext/ipython_directive.py',
137129
'*/matplotlib/sphinxext/mathmpl.py',
@@ -246,9 +238,8 @@ def assert_pep8_conformance(module=matplotlib, exclude_files=EXCLUDE_FILES,
246238
'{}'.format('\n '.join(unexpectedly_good)))
247239

248240

249-
## Temporarily disabling test
250-
#def test_pep8_conformance():
251-
# assert_pep8_conformance()
241+
def test_pep8_conformance():
242+
assert_pep8_conformance()
252243

253244

254245
if __name__ == '__main__':

lib/matplotlib/tests/test_mlab.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ def test_recarray_csv_roundtrip(self):
7575
np.testing.assert_allclose(expected['t'], actual['t'])
7676

7777
def test_rec2csv_bad_shape_ValueError(self):
78-
bad = np.recarray((99, 4), [(str('x'), np.float), (str('y'), np.float)])
78+
bad = np.recarray((99, 4), [(str('x'), np.float),
79+
(str('y'), np.float)])
7980

8081
# the bad recarray should trigger a ValueError for having ndim > 1.
8182
self.assertRaises(ValueError, mlab.rec2csv, bad, self.fd)

0 commit comments

Comments
 (0)
0