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

Skip to content

Commit 0b1c33a

Browse files
committed
Merge pull request matplotlib#2141 from mdboom/handle-pep8-missing
Handle pep8 missing
2 parents c371e63 + 5ef58a0 commit 0b1c33a

File tree

1 file changed

+152
-151
lines changed

1 file changed

+152
-151
lines changed

lib/matplotlib/tests/test_coding_standards.py

Lines changed: 152 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -15,159 +15,160 @@
1515
import matplotlib
1616

1717

18-
class StandardReportWithExclusions(pep8.StandardReport):
19-
#; A class attribute to store the exception exclusion file patterns.
20-
expected_bad_files = [
21-
'*/matplotlib/__init__.py',
22-
'*/matplotlib/_cm.py',
23-
'*/matplotlib/_mathtext_data.py',
24-
'*/matplotlib/_pylab_helpers.py',
25-
'*/matplotlib/afm.py',
26-
'*/matplotlib/artist.py',
27-
'*/matplotlib/axes.py',
28-
'*/matplotlib/axis.py',
29-
'*/matplotlib/backend_bases.py',
30-
'*/matplotlib/bezier.py',
31-
'*/matplotlib/cbook.py',
32-
'*/matplotlib/collections.py',
33-
'*/matplotlib/docstring.py',
34-
'*/matplotlib/dviread.py',
35-
'*/matplotlib/finance.py',
36-
'*/matplotlib/font_manager.py',
37-
'*/matplotlib/fontconfig_pattern.py',
38-
'*/matplotlib/gridspec.py',
39-
'*/matplotlib/legend.py',
40-
'*/matplotlib/legend_handler.py',
41-
'*/matplotlib/mathtext.py',
42-
'*/matplotlib/mlab.py',
43-
'*/matplotlib/path.py',
44-
'*/matplotlib/patheffects.py',
45-
'*/matplotlib/pylab.py',
46-
'*/matplotlib/pyplot.py',
47-
'*/matplotlib/rcsetup.py',
48-
'*/matplotlib/stackplot.py',
49-
'*/matplotlib/texmanager.py',
50-
'*/matplotlib/text.py',
51-
'*/matplotlib/transforms.py',
52-
'*/matplotlib/type1font.py',
53-
'*/matplotlib/widgets.py',
54-
'*/matplotlib/testing/compare.py',
55-
'*/matplotlib/testing/decorators.py',
56-
'*/matplotlib/testing/image_util.py',
57-
'*/matplotlib/testing/noseclasses.py',
58-
'*/matplotlib/testing/jpl_units/Duration.py',
59-
'*/matplotlib/testing/jpl_units/Epoch.py',
60-
'*/matplotlib/testing/jpl_units/EpochConverter.py',
61-
'*/matplotlib/testing/jpl_units/StrConverter.py',
62-
'*/matplotlib/testing/jpl_units/UnitDbl.py',
63-
'*/matplotlib/testing/jpl_units/UnitDblConverter.py',
64-
'*/matplotlib/testing/jpl_units/UnitDblFormatter.py',
65-
'*/matplotlib/testing/jpl_units/__init__.py',
66-
'*/matplotlib/tri/tricontour.py',
67-
'*/matplotlib/tri/triinterpolate.py',
68-
'*/matplotlib/tri/tripcolor.py',
69-
'*/matplotlib/tri/triplot.py',
70-
'*/matplotlib/tests/__init__.py',
71-
'*/matplotlib/tests/test_agg.py',
72-
'*/matplotlib/tests/test_animation.py',
73-
'*/matplotlib/tests/test_arrow_patches.py',
74-
'*/matplotlib/tests/test_artist.py',
75-
'*/matplotlib/tests/test_axes.py',
76-
'*/matplotlib/tests/test_backend_pdf.py',
77-
'*/matplotlib/tests/test_backend_pgf.py',
78-
'*/matplotlib/tests/test_backend_svg.py',
79-
'*/matplotlib/tests/test_basic.py',
80-
'*/matplotlib/tests/test_bbox_tight.py',
81-
'*/matplotlib/tests/test_cbook.py',
82-
'*/matplotlib/tests/test_colorbar.py',
83-
'*/matplotlib/tests/test_colors.py',
84-
'*/matplotlib/tests/test_compare_images.py',
85-
'*/matplotlib/tests/test_contour.py',
86-
'*/matplotlib/tests/test_dates.py',
87-
'*/matplotlib/tests/test_delaunay.py',
88-
'*/matplotlib/tests/test_dviread.py',
89-
'*/matplotlib/tests/test_image.py',
90-
'*/matplotlib/tests/test_legend.py',
91-
'*/matplotlib/tests/test_lines.py',
92-
'*/matplotlib/tests/test_mathtext.py',
93-
'*/matplotlib/tests/test_patches.py',
94-
'*/matplotlib/tests/test_pickle.py',
95-
'*/matplotlib/tests/test_png.py',
96-
'*/matplotlib/tests/test_rcparams.py',
97-
'*/matplotlib/tests/test_simplification.py',
98-
'*/matplotlib/tests/test_spines.py',
99-
'*/matplotlib/tests/test_streamplot.py',
100-
'*/matplotlib/tests/test_subplots.py',
101-
'*/matplotlib/tests/test_text.py',
102-
'*/matplotlib/tests/test_tightlayout.py',
103-
'*/matplotlib/tests/test_transforms.py',
104-
'*/matplotlib/tests/test_triangulation.py',
105-
'*/matplotlib/compat/subprocess.py',
106-
'*/matplotlib/backends/__init__.py',
107-
'*/matplotlib/backends/backend_agg.py',
108-
'*/matplotlib/backends/backend_cairo.py',
109-
'*/matplotlib/backends/backend_cocoaagg.py',
110-
'*/matplotlib/backends/backend_gdk.py',
111-
'*/matplotlib/backends/backend_gtk.py',
112-
'*/matplotlib/backends/backend_gtk3.py',
113-
'*/matplotlib/backends/backend_gtk3cairo.py',
114-
'*/matplotlib/backends/backend_gtkagg.py',
115-
'*/matplotlib/backends/backend_gtkcairo.py',
116-
'*/matplotlib/backends/backend_macosx.py',
117-
'*/matplotlib/backends/backend_mixed.py',
118-
'*/matplotlib/backends/backend_pdf.py',
119-
'*/matplotlib/backends/backend_pgf.py',
120-
'*/matplotlib/backends/backend_ps.py',
121-
'*/matplotlib/backends/backend_qt4.py',
122-
'*/matplotlib/backends/backend_qt4agg.py',
123-
'*/matplotlib/backends/backend_svg.py',
124-
'*/matplotlib/backends/backend_template.py',
125-
'*/matplotlib/backends/backend_tkagg.py',
126-
'*/matplotlib/backends/backend_webagg.py',
127-
'*/matplotlib/backends/backend_wx.py',
128-
'*/matplotlib/backends/backend_wxagg.py',
129-
'*/matplotlib/backends/qt4_compat.py',
130-
'*/matplotlib/backends/tkagg.py',
131-
'*/matplotlib/backends/windowing.py',
132-
'*/matplotlib/backends/qt4_editor/figureoptions.py',
133-
'*/matplotlib/backends/qt4_editor/formlayout.py',
134-
'*/matplotlib/sphinxext/__init__.py',
135-
'*/matplotlib/sphinxext/ipython_console_highlighting.py',
136-
'*/matplotlib/sphinxext/ipython_directive.py',
137-
'*/matplotlib/sphinxext/mathmpl.py',
138-
'*/matplotlib/sphinxext/only_directives.py',
139-
'*/matplotlib/sphinxext/plot_directive.py',
140-
'*/matplotlib/projections/__init__.py',
141-
'*/matplotlib/projections/geo.py',
142-
'*/matplotlib/projections/polar.py']
143-
144-
#: A class attribute to store patterns which have seen exceptions.
145-
matched_exclusions = set()
146-
147-
def get_file_results(self):
148-
# If the file had no errors, return self.file_errors (which will be 0)
149-
if not self._deferred_print:
150-
return self.file_errors
151-
152-
# Iterate over all of the patterns, to find a possible exclusion. If we
153-
# the filename is to be excluded, go ahead and remove the counts that
154-
# self.error added.
155-
for pattern in self.expected_bad_files:
156-
if fnmatch(self.filename, pattern):
157-
self.matched_exclusions.add(pattern)
158-
# invert the error method's counters.
159-
for _, _, code, _, _ in self._deferred_print:
160-
self.counters[code] -= 1
161-
if self.counters[code] == 0:
162-
self.counters.pop(code)
163-
self.messages.pop(code)
164-
self.file_errors -= 1
165-
self.total_errors -= 1
18+
if HAS_PEP8:
19+
class StandardReportWithExclusions(pep8.StandardReport):
20+
#; A class attribute to store the exception exclusion file patterns.
21+
expected_bad_files = [
22+
'*/matplotlib/__init__.py',
23+
'*/matplotlib/_cm.py',
24+
'*/matplotlib/_mathtext_data.py',
25+
'*/matplotlib/_pylab_helpers.py',
26+
'*/matplotlib/afm.py',
27+
'*/matplotlib/artist.py',
28+
'*/matplotlib/axes.py',
29+
'*/matplotlib/axis.py',
30+
'*/matplotlib/backend_bases.py',
31+
'*/matplotlib/bezier.py',
32+
'*/matplotlib/cbook.py',
33+
'*/matplotlib/collections.py',
34+
'*/matplotlib/docstring.py',
35+
'*/matplotlib/dviread.py',
36+
'*/matplotlib/finance.py',
37+
'*/matplotlib/font_manager.py',
38+
'*/matplotlib/fontconfig_pattern.py',
39+
'*/matplotlib/gridspec.py',
40+
'*/matplotlib/legend.py',
41+
'*/matplotlib/legend_handler.py',
42+
'*/matplotlib/mathtext.py',
43+
'*/matplotlib/mlab.py',
44+
'*/matplotlib/path.py',
45+
'*/matplotlib/patheffects.py',
46+
'*/matplotlib/pylab.py',
47+
'*/matplotlib/pyplot.py',
48+
'*/matplotlib/rcsetup.py',
49+
'*/matplotlib/stackplot.py',
50+
'*/matplotlib/texmanager.py',
51+
'*/matplotlib/text.py',
52+
'*/matplotlib/transforms.py',
53+
'*/matplotlib/type1font.py',
54+
'*/matplotlib/widgets.py',
55+
'*/matplotlib/testing/compare.py',
56+
'*/matplotlib/testing/decorators.py',
57+
'*/matplotlib/testing/image_util.py',
58+
'*/matplotlib/testing/noseclasses.py',
59+
'*/matplotlib/testing/jpl_units/Duration.py',
60+
'*/matplotlib/testing/jpl_units/Epoch.py',
61+
'*/matplotlib/testing/jpl_units/EpochConverter.py',
62+
'*/matplotlib/testing/jpl_units/StrConverter.py',
63+
'*/matplotlib/testing/jpl_units/UnitDbl.py',
64+
'*/matplotlib/testing/jpl_units/UnitDblConverter.py',
65+
'*/matplotlib/testing/jpl_units/UnitDblFormatter.py',
66+
'*/matplotlib/testing/jpl_units/__init__.py',
67+
'*/matplotlib/tri/tricontour.py',
68+
'*/matplotlib/tri/triinterpolate.py',
69+
'*/matplotlib/tri/tripcolor.py',
70+
'*/matplotlib/tri/triplot.py',
71+
'*/matplotlib/tests/__init__.py',
72+
'*/matplotlib/tests/test_agg.py',
73+
'*/matplotlib/tests/test_animation.py',
74+
'*/matplotlib/tests/test_arrow_patches.py',
75+
'*/matplotlib/tests/test_artist.py',
76+
'*/matplotlib/tests/test_axes.py',
77+
'*/matplotlib/tests/test_backend_pdf.py',
78+
'*/matplotlib/tests/test_backend_pgf.py',
79+
'*/matplotlib/tests/test_backend_svg.py',
80+
'*/matplotlib/tests/test_basic.py',
81+
'*/matplotlib/tests/test_bbox_tight.py',
82+
'*/matplotlib/tests/test_cbook.py',
83+
'*/matplotlib/tests/test_colorbar.py',
84+
'*/matplotlib/tests/test_colors.py',
85+
'*/matplotlib/tests/test_compare_images.py',
86+
'*/matplotlib/tests/test_contour.py',
87+
'*/matplotlib/tests/test_dates.py',
88+
'*/matplotlib/tests/test_delaunay.py',
89+
'*/matplotlib/tests/test_dviread.py',
90+
'*/matplotlib/tests/test_image.py',
91+
'*/matplotlib/tests/test_legend.py',
92+
'*/matplotlib/tests/test_lines.py',
93+
'*/matplotlib/tests/test_mathtext.py',
94+
'*/matplotlib/tests/test_patches.py',
95+
'*/matplotlib/tests/test_pickle.py',
96+
'*/matplotlib/tests/test_png.py',
97+
'*/matplotlib/tests/test_rcparams.py',
98+
'*/matplotlib/tests/test_simplification.py',
99+
'*/matplotlib/tests/test_spines.py',
100+
'*/matplotlib/tests/test_streamplot.py',
101+
'*/matplotlib/tests/test_subplots.py',
102+
'*/matplotlib/tests/test_text.py',
103+
'*/matplotlib/tests/test_tightlayout.py',
104+
'*/matplotlib/tests/test_transforms.py',
105+
'*/matplotlib/tests/test_triangulation.py',
106+
'*/matplotlib/compat/subprocess.py',
107+
'*/matplotlib/backends/__init__.py',
108+
'*/matplotlib/backends/backend_agg.py',
109+
'*/matplotlib/backends/backend_cairo.py',
110+
'*/matplotlib/backends/backend_cocoaagg.py',
111+
'*/matplotlib/backends/backend_gdk.py',
112+
'*/matplotlib/backends/backend_gtk.py',
113+
'*/matplotlib/backends/backend_gtk3.py',
114+
'*/matplotlib/backends/backend_gtk3cairo.py',
115+
'*/matplotlib/backends/backend_gtkagg.py',
116+
'*/matplotlib/backends/backend_gtkcairo.py',
117+
'*/matplotlib/backends/backend_macosx.py',
118+
'*/matplotlib/backends/backend_mixed.py',
119+
'*/matplotlib/backends/backend_pdf.py',
120+
'*/matplotlib/backends/backend_pgf.py',
121+
'*/matplotlib/backends/backend_ps.py',
122+
'*/matplotlib/backends/backend_qt4.py',
123+
'*/matplotlib/backends/backend_qt4agg.py',
124+
'*/matplotlib/backends/backend_svg.py',
125+
'*/matplotlib/backends/backend_template.py',
126+
'*/matplotlib/backends/backend_tkagg.py',
127+
'*/matplotlib/backends/backend_webagg.py',
128+
'*/matplotlib/backends/backend_wx.py',
129+
'*/matplotlib/backends/backend_wxagg.py',
130+
'*/matplotlib/backends/qt4_compat.py',
131+
'*/matplotlib/backends/tkagg.py',
132+
'*/matplotlib/backends/windowing.py',
133+
'*/matplotlib/backends/qt4_editor/figureoptions.py',
134+
'*/matplotlib/backends/qt4_editor/formlayout.py',
135+
'*/matplotlib/sphinxext/__init__.py',
136+
'*/matplotlib/sphinxext/ipython_console_highlighting.py',
137+
'*/matplotlib/sphinxext/ipython_directive.py',
138+
'*/matplotlib/sphinxext/mathmpl.py',
139+
'*/matplotlib/sphinxext/only_directives.py',
140+
'*/matplotlib/sphinxext/plot_directive.py',
141+
'*/matplotlib/projections/__init__.py',
142+
'*/matplotlib/projections/geo.py',
143+
'*/matplotlib/projections/polar.py']
144+
145+
#: A class attribute to store patterns which have seen exceptions.
146+
matched_exclusions = set()
147+
148+
def get_file_results(self):
149+
# If the file had no errors, return self.file_errors (which will be 0)
150+
if not self._deferred_print:
166151
return self.file_errors
167152

168-
# Otherwise call the superclass' method to print the bad results.
169-
return super(StandardReportWithExclusions,
170-
self).get_file_results()
153+
# Iterate over all of the patterns, to find a possible exclusion. If we
154+
# the filename is to be excluded, go ahead and remove the counts that
155+
# self.error added.
156+
for pattern in self.expected_bad_files:
157+
if fnmatch(self.filename, pattern):
158+
self.matched_exclusions.add(pattern)
159+
# invert the error method's counters.
160+
for _, _, code, _, _ in self._deferred_print:
161+
self.counters[code] -= 1
162+
if self.counters[code] == 0:
163+
self.counters.pop(code)
164+
self.messages.pop(code)
165+
self.file_errors -= 1
166+
self.total_errors -= 1
167+
return self.file_errors
168+
169+
# Otherwise call the superclass' method to print the bad results.
170+
return super(StandardReportWithExclusions,
171+
self).get_file_results()
171172

172173

173174
def _test_pep8_conformance():

0 commit comments

Comments
 (0)