From 24085acbe04a67d39afcef6d363d050ab95d6e39 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Wed, 26 Mar 2014 21:02:04 -0400 Subject: [PATCH 1/2] PEP8 : fixed all E71[3,4] failures --- lib/matplotlib/animation.py | 2 +- lib/matplotlib/axes/_base.py | 2 +- lib/matplotlib/image.py | 2 +- lib/matplotlib/textpath.py | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index 6cb593f00614..5cbec7d11586 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -685,7 +685,7 @@ def save(self, filename, writer=None, fps=None, dpi=None, codec=None, bitrate = rcParams['animation.bitrate'] all_anim = [self] - if not extra_anim is None: + if extra_anim is not None: all_anim.extend(anim for anim in extra_anim if anim._fig is self._fig) diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 87b3815e8d87..998806e321d8 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -232,7 +232,7 @@ def _xy_from_xy(self, x, y): def _makeline(self, x, y, kw, kwargs): kw = kw.copy() # Don't modify the original kw. - if not 'color' in kw and not 'color' in kwargs: + if 'color' not in kw and 'color' not in kwargs: kw['color'] = six.next(self.color_cycle) # (can't use setdefault because it always evaluates # its second argument) diff --git a/lib/matplotlib/image.py b/lib/matplotlib/image.py index 1ded203f5f29..f4ee7f168b13 100644 --- a/lib/matplotlib/image.py +++ b/lib/matplotlib/image.py @@ -776,7 +776,7 @@ def set_array(self, *args): raise NotImplementedError('Method not supported') def set_interpolation(self, s): - if s is not None and not s in ('nearest', 'bilinear'): + if s is not None and s not in ('nearest', 'bilinear'): raise NotImplementedError('Only nearest neighbor and ' 'bilinear interpolations are supported') AxesImage.set_interpolation(self, s) diff --git a/lib/matplotlib/textpath.py b/lib/matplotlib/textpath.py index 2cc5b51aac87..6bf05a8adda4 100644 --- a/lib/matplotlib/textpath.py +++ b/lib/matplotlib/textpath.py @@ -209,7 +209,7 @@ def get_glyphs_with_font(self, font, s, glyph_map=None, horiz_advance = (glyph.linearHoriAdvance / 65536.0) char_id = self._get_char_id(font, ccode) - if not char_id in glyph_map: + if char_id not in glyph_map: glyph_map_new[char_id] = self.glyph_to_path(font) currx += (kern / 64.0) @@ -258,7 +258,7 @@ def get_glyphs_mathtext(self, prop, s, glyph_map=None, currx, curry = 0, 0 for font, fontsize, ccode, ox, oy in glyphs: char_id = self._get_char_id(font, ccode) - if not char_id in glyph_map: + if char_id not in glyph_map: font.clear() font.set_size(self.FONT_SCALE, self.DPI) glyph = font.load_char(ccode, flags=LOAD_NO_HINTING) @@ -371,7 +371,7 @@ def get_glyphs_tex(self, prop, s, glyph_map=None, char_id = self._get_char_id_ps(font, glyph) - if not char_id in glyph_map: + if char_id not in glyph_map: font.clear() font.set_size(self.FONT_SCALE, self.DPI) if enc: From 6464e2d55f2ef3a939dccee3c7d281b98b5acf97 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Wed, 26 Mar 2014 21:31:45 -0400 Subject: [PATCH 2/2] PEP8 : Squelch spurious tests The new ignore tests (E111, E112, E113, E265) are just picking up style infractions on the comments. --- lib/matplotlib/tests/test_coding_standards.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/tests/test_coding_standards.py b/lib/matplotlib/tests/test_coding_standards.py index aa1bbce54c2d..ac690c50effd 100644 --- a/lib/matplotlib/tests/test_coding_standards.py +++ b/lib/matplotlib/tests/test_coding_standards.py @@ -36,8 +36,22 @@ '_backend_gdk.py', 'pyparsing*', '_qhull.py'] -PEP8_ADDITIONAL_IGNORE = ('E121', 'E122', 'E123', 'E124', 'E125', - 'E126', 'E127', 'E128') + +PEP8_ADDITIONAL_IGNORE = ['E111', + 'E112', + 'E113', + 'E121', + 'E122', + 'E123', + 'E124', + 'E125', + 'E126', + 'E127', + 'E128', + 'E129', + 'E131', + 'E265'] + EXPECTED_BAD_FILES = ['*/matplotlib/__init__.py', '*/matplotlib/_cm.py', '*/matplotlib/_mathtext_data.py',