diff --git a/.flake8 b/.flake8 index 9d20350e6faa..611538d1ee34 100644 --- a/.flake8 +++ b/.flake8 @@ -28,61 +28,61 @@ per-file-ignores = tools/compare_backend_driver_results.py: E501 tools/subset.py: E221, E231, E251, E261, E302, E501, E701 - matplotlib/_cm.py: E202, E203, E302 - matplotlib/_mathtext_data.py: E203, E261 - matplotlib/backend_bases.py: E225 - matplotlib/backends/_backend_tk.py: E203, E222, E225, E231, E271, E301, E303, E401, E501, E701 - matplotlib/backends/backend_agg.py: E261, E302, E701 - matplotlib/backends/backend_cairo.py: E203, E221, E261, E303, E402 - matplotlib/backends/backend_gtk3.py: E203, E221, E222, E225, E251, E261, E501 - matplotlib/backends/backend_macosx.py: E231, E261 - matplotlib/backends/backend_pgf.py: E303, E731 - matplotlib/backends/backend_ps.py: E203, E225, E228, E231, E261, E262, E302, E303, E501, E701 - matplotlib/backends/backend_svg.py: E203, E225, E228, E231, E261, E302, E501 - matplotlib/backends/qt_editor/formlayout.py: E301, E501 - matplotlib/backends/tkagg.py: E231, E302, E701 - matplotlib/backends/windowing.py: E301, E302 - matplotlib/font_manager.py: E203, E221, E251, E261, E262, E302, E501 - matplotlib/fontconfig_pattern.py: E201, E203, E221, E222, E225, E302 - matplotlib/legend_handler.py: E201, E501 - matplotlib/mathtext.py: E201, E202, E203, E211, E221, E222, E225, E231, E251, E261, E301, E302, E303, E402, E501 - matplotlib/patheffects.py: E231 - matplotlib/projections/geo.py: E203, E221, E231, E261, E502 - matplotlib/pylab.py: E501 - matplotlib/pyplot.py: E201, E202, E221, E222, E225, E231, E251, E261, E501 - matplotlib/rcsetup.py: E203, E225, E261, E302, E501 - matplotlib/sphinxext/mathmpl.py: E302 - matplotlib/sphinxext/only_directives.py: E302 - matplotlib/sphinxext/plot_directive.py: E261, E302, E402 - matplotlib/tests/test_image.py: E231 - matplotlib/tests/test_mathtext.py: E501 - matplotlib/transforms.py: E201, E202, E203, E501 - matplotlib/tri/triinterpolate.py: E201, E221 - matplotlib/type1font.py: E731 + lib/matplotlib/_cm.py: E202, E203, E302 + lib/matplotlib/_mathtext_data.py: E203, E261 + lib/matplotlib/backend_bases.py: E225 + lib/matplotlib/backends/_backend_tk.py: E203, E222, E225, E231, E271, E301, E303, E401, E501, E701 + lib/matplotlib/backends/backend_agg.py: E261, E302, E701 + lib/matplotlib/backends/backend_cairo.py: E203, E221, E261, E303, E402 + lib/matplotlib/backends/backend_gtk3.py: E203, E221, E222, E225, E251, E261, E501 + lib/matplotlib/backends/backend_macosx.py: E231, E261 + lib/matplotlib/backends/backend_pgf.py: E303, E731 + lib/matplotlib/backends/backend_ps.py: E203, E225, E228, E231, E261, E262, E302, E303, E501, E701 + lib/matplotlib/backends/backend_svg.py: E203, E225, E228, E231, E261, E302, E501 + lib/matplotlib/backends/qt_editor/formlayout.py: E301, E501 + lib/matplotlib/backends/tkagg.py: E231, E302, E701 + lib/matplotlib/backends/windowing.py: E301, E302 + lib/matplotlib/font_manager.py: E203, E221, E251, E261, E262, E302, E501 + lib/matplotlib/fontconfig_pattern.py: E201, E203, E221, E222, E225, E302 + lib/matplotlib/legend_handler.py: E201, E501 + lib/matplotlib/mathtext.py: E201, E202, E203, E211, E221, E222, E225, E231, E251, E261, E301, E302, E303, E402, E501 + lib/matplotlib/patheffects.py: E231 + lib/matplotlib/projections/geo.py: E203, E221, E231, E261, E502 + lib/matplotlib/pylab.py: E501 + lib/matplotlib/pyplot.py: E201, E202, E221, E222, E225, E231, E251, E261, E501 + lib/matplotlib/rcsetup.py: E203, E225, E261, E302, E501 + lib/matplotlib/sphinxext/mathmpl.py: E302 + lib/matplotlib/sphinxext/only_directives.py: E302 + lib/matplotlib/sphinxext/plot_directive.py: E261, E302, E402 + lib/matplotlib/tests/test_image.py: E231 + lib/matplotlib/tests/test_mathtext.py: E501 + lib/matplotlib/transforms.py: E201, E202, E203, E501 + lib/matplotlib/tri/triinterpolate.py: E201, E221 + lib/matplotlib/type1font.py: E731 - mpl_toolkits/__init__.py: E261 - mpl_toolkits/axes_grid/axes_rgb.py: E501 - mpl_toolkits/axes_grid1/axes_divider.py: E402, E501 - mpl_toolkits/axes_grid1/axes_grid.py: E225 - mpl_toolkits/axes_grid1/axes_rgb.py: E231 - mpl_toolkits/axes_grid1/axes_size.py: E261, E501 - mpl_toolkits/axes_grid1/colorbar.py: E225, E231, E261, E262, E302, E303, E501, E701 - mpl_toolkits/axes_grid1/inset_locator.py: E501 - mpl_toolkits/axes_grid1/mpl_axes.py: E303, E501 - mpl_toolkits/axisartist/angle_helper.py: E201, E203, E221, E222, E225, E231, E251, E261, E262, E302, E303, E501 - mpl_toolkits/axisartist/axis_artist.py: E201, E202, E221, E225, E228, E231, E251, E261, E262, E302, E303, E402, E501, E701 - mpl_toolkits/axisartist/axisline_style.py: E231, E261, E262, E302, E303 - mpl_toolkits/axisartist/axislines.py: E225, E231, E261, E303, E501 - mpl_toolkits/axisartist/clip_path.py: E225, E302, E303, E501 - mpl_toolkits/axisartist/floating_axes.py: E225, E231, E261, E262, E302, E303, E402, E501 - mpl_toolkits/axisartist/grid_finder.py: E231, E261, E302, E303, E402 - mpl_toolkits/axisartist/grid_helper_curvelinear.py: E225, E231, E261, E262, E271, E302, E303, E501 - mpl_toolkits/mplot3d/art3d.py: E203, E222, E225, E231 - mpl_toolkits/mplot3d/axes3d.py: E203, E231, E402, E501, E701 - mpl_toolkits/mplot3d/axis3d.py: E231, E302 - mpl_toolkits/mplot3d/proj3d.py: E231, E302, E303 - mpl_toolkits/tests/test_axes_grid1.py: E201, E202 - mpl_toolkits/tests/test_mplot3d.py: E231, E302 + lib/mpl_toolkits/__init__.py: E261 + lib/mpl_toolkits/axes_grid/axes_rgb.py: E501 + lib/mpl_toolkits/axes_grid1/axes_divider.py: E402, E501 + lib/mpl_toolkits/axes_grid1/axes_grid.py: E225 + lib/mpl_toolkits/axes_grid1/axes_rgb.py: E231 + lib/mpl_toolkits/axes_grid1/axes_size.py: E261, E501 + lib/mpl_toolkits/axes_grid1/colorbar.py: E225, E231, E261, E262, E302, E303, E501, E701 + lib/mpl_toolkits/axes_grid1/inset_locator.py: E501 + lib/mpl_toolkits/axes_grid1/mpl_axes.py: E303, E501 + lib/mpl_toolkits/axisartist/angle_helper.py: E201, E203, E221, E222, E225, E231, E251, E261, E262, E302, E303, E501 + lib/mpl_toolkits/axisartist/axis_artist.py: E201, E202, E221, E225, E228, E231, E251, E261, E262, E302, E303, E402, E501, E701 + lib/mpl_toolkits/axisartist/axisline_style.py: E231, E261, E262, E302, E303 + lib/mpl_toolkits/axisartist/axislines.py: E225, E231, E261, E303, E501 + lib/mpl_toolkits/axisartist/clip_path.py: E225, E302, E303, E501 + lib/mpl_toolkits/axisartist/floating_axes.py: E225, E231, E261, E262, E302, E303, E402, E501 + lib/mpl_toolkits/axisartist/grid_finder.py: E231, E261, E302, E303, E402 + lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py: E225, E231, E261, E262, E271, E302, E303, E501 + lib/mpl_toolkits/mplot3d/art3d.py: E203, E222, E225, E231 + lib/mpl_toolkits/mplot3d/axes3d.py: E203, E231, E402, E501, E701 + lib/mpl_toolkits/mplot3d/axis3d.py: E231, E302 + lib/mpl_toolkits/mplot3d/proj3d.py: E231, E302, E303 + lib/mpl_toolkits/tests/test_axes_grid1.py: E201, E202 + lib/mpl_toolkits/tests/test_mplot3d.py: E231, E302 doc/conf.py: E402, E501 doc/sphinxext/github.py: E302, E501 diff --git a/.travis.yml b/.travis.yml index ec42696dbd37..2d87f42e2937 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,12 +38,13 @@ addons: - lmodern - otf-freefont - pgf + - qtbase5-dev - texlive-fonts-recommended - texlive-latex-base - texlive-latex-extra - texlive-latex-recommended - - texlive-xetex - texlive-luatex + - texlive-xetex env: global: diff --git a/lib/matplotlib/backends/qt_editor/figureoptions.py b/lib/matplotlib/backends/qt_editor/figureoptions.py index 6620f5870920..cbd1e8729d7f 100644 --- a/lib/matplotlib/backends/qt_editor/figureoptions.py +++ b/lib/matplotlib/backends/qt_editor/figureoptions.py @@ -217,7 +217,7 @@ def apply_callback(data): rgba = mcolors.to_rgba(color) line.set_alpha(None) line.set_color(rgba) - if marker is not 'none': + if not isinstance(marker, str) or marker != 'none': line.set_marker(marker) line.set_markersize(markersize) line.set_markerfacecolor(markerfacecolor) diff --git a/lib/matplotlib/mlab.py b/lib/matplotlib/mlab.py index 4ba3f3215a14..d6bed4c807df 100644 --- a/lib/matplotlib/mlab.py +++ b/lib/matplotlib/mlab.py @@ -3665,8 +3665,8 @@ def __init__(self, dataset, bw_method=None): elif (isString and bw_method == 'silverman'): self.covariance_factor = self.silverman_factor elif (np.isscalar(bw_method) and not isString): - self._bw_method = 'use constant' - self.covariance_factor = lambda: bw_method + self._bw_method = 'use constant' + self.covariance_factor = lambda: bw_method elif callable(bw_method): self._bw_method = bw_method self.covariance_factor = lambda: self._bw_method(self) diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index 731de096ac3a..12d37a6c6afb 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -2176,11 +2176,10 @@ def matshow(A, fignum=None, **kwargs): fignum : None or int or False If *None*, create a new figure window with automatic numbering. - If *fignum* is an integer, draw into the figure with the given number + If a nonzero integer, draw into the figure with the given number (create it if it does not exist). - If 0 or *False*, use the current axes if it exists instead of creating - a new figure. + If 0, use the current axes (or create one if it does not exist). .. note:: @@ -2198,7 +2197,7 @@ def matshow(A, fignum=None, **kwargs): """ A = np.asanyarray(A) - if fignum is False or fignum is 0: + if fignum == 0: ax = gca() else: # Extract actual aspect ratio of array and make appropriately sized figure @@ -2207,7 +2206,6 @@ def matshow(A, fignum=None, **kwargs): im = ax.matshow(A, **kwargs) sci(im) - return im diff --git a/lib/matplotlib/scale.py b/lib/matplotlib/scale.py index f6600751275d..9207554f2e32 100644 --- a/lib/matplotlib/scale.py +++ b/lib/matplotlib/scale.py @@ -108,7 +108,7 @@ def transform_non_affine(self, a): # pass. On the other hand, in practice, we want to clip beyond # np.log10(np.nextafter(0, 1)) ~ -323 # so 1000 seems safe. - out[a <= 0] = -1000 + out[a <= 0] = -1000 return out def __str__(self): diff --git a/lib/matplotlib/tests/test_preprocess_data.py b/lib/matplotlib/tests/test_preprocess_data.py index 7f36447340ba..8165774bb0bf 100644 --- a/lib/matplotlib/tests/test_preprocess_data.py +++ b/lib/matplotlib/tests/test_preprocess_data.py @@ -41,11 +41,8 @@ def test_compiletime_checks(): """test decorator invocations -> no replacements""" def func(ax, x, y): pass - def func_args(ax, x, y, *args): pass - def func_kwargs(ax, x, y, **kwargs): pass - def func_no_ax_args(*args, **kwargs): pass # this is ok diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index e5ee50165d87..0e918e9d9c20 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -762,7 +762,7 @@ def _rendercursor(self): def _notify_submit_observers(self): for cid, func in self.submit_observers.items(): - func(self.text) + func(self.text) def _release(self, event): if self.ignore(event): diff --git a/requirements/testing/travis_flake8.txt b/requirements/testing/travis_flake8.txt index 31a59985c544..da52d6741973 100644 --- a/requirements/testing/travis_flake8.txt +++ b/requirements/testing/travis_flake8.txt @@ -1,4 +1,3 @@ # Extra pip requirements for the travis flake8 build -flake8 -flake8-per-file-ignores +flake8>=3.7