diff --git a/.flake8 b/.flake8 index cd29fa461544..c7e9114821ff 100644 --- a/.flake8 +++ b/.flake8 @@ -28,36 +28,36 @@ per-file-ignores = tools/compare_backend_driver_results.py: E501 tools/subset.py: E221, E251, E261, E302, E501 - matplotlib/_cm.py: E202, E203, E302 - matplotlib/_mathtext_data.py: E203, E261 - matplotlib/backends/_backend_tk.py: E501 - matplotlib/backends/backend_agg.py: E302 - matplotlib/backends/backend_cairo.py: E203, E221, E402 - matplotlib/backends/backend_gtk3.py: E203, E221, E222, E225, E251, E501 - matplotlib/backends/backend_pgf.py: E731 - matplotlib/backends/qt_editor/_formlayout.py: E501 - matplotlib/font_manager.py: E203, E221, E251, E501 - matplotlib/fontconfig_pattern.py: E201, E203, E221, E222, E225 - matplotlib/mathtext.py: E201, E202, E203, E211, E221, E222, E225, E251, E301, E402 - matplotlib/projections/geo.py: E203, E221, E502 - matplotlib/pylab.py: E501 - matplotlib/rcsetup.py: E501 - 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/backends/_backend_tk.py: E501 + lib/matplotlib/backends/backend_agg.py: E302 + lib/matplotlib/backends/backend_cairo.py: E203, E221, E402 + lib/matplotlib/backends/backend_gtk3.py: E203, E221, E222, E225, E251, E501 + lib/matplotlib/backends/backend_pgf.py: E731 + lib/matplotlib/backends/qt_editor/_formlayout.py: E501 + lib/matplotlib/font_manager.py: E203, E221, E251, E501 + lib/matplotlib/fontconfig_pattern.py: E201, E203, E221, E222, E225 + lib/matplotlib/mathtext.py: E201, E202, E203, E211, E221, E222, E225, E251, E301, E402 + lib/matplotlib/projections/geo.py: E203, E221, E502 + lib/matplotlib/pylab.py: E501 + lib/matplotlib/rcsetup.py: E501 + 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/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_size.py: E272, E501 - mpl_toolkits/axes_grid1/colorbar.py: E225, E501 - mpl_toolkits/axes_grid1/inset_locator.py: E501 - mpl_toolkits/axisartist/angle_helper.py: E221 - mpl_toolkits/axisartist/clip_path.py: E225 - mpl_toolkits/axisartist/floating_axes.py: E225, E402, E501 - mpl_toolkits/axisartist/grid_helper_curvelinear.py: E225, E501 - mpl_toolkits/tests/test_axes_grid1.py: E201, E202 + 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_size.py: E272, E501 + lib/mpl_toolkits/axes_grid1/colorbar.py: E225, E501 + lib/mpl_toolkits/axes_grid1/inset_locator.py: E501 + lib/mpl_toolkits/axisartist/angle_helper.py: E221 + lib/mpl_toolkits/axisartist/clip_path.py: E225 + lib/mpl_toolkits/axisartist/floating_axes.py: E225, E402, E501 + lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py: E225, E501 + lib/mpl_toolkits/tests/test_axes_grid1.py: E201, E202 doc/conf.py: E402, E501 doc/sphinxext/github.py: E302, E501 diff --git a/lib/matplotlib/axis.py b/lib/matplotlib/axis.py index a2eb3e429bd1..b6cc642feab9 100644 --- a/lib/matplotlib/axis.py +++ b/lib/matplotlib/axis.py @@ -1015,7 +1015,7 @@ def _update_ticks(self, renderer): tick_tups = [ti for ti in tick_tups if ilow <= ti[1] <= ihigh] if interval[1] <= interval[0]: - interval = interval[1], interval[0] + interval = interval[1], interval[0] inter = self.get_transform().transform(interval) ticks_to_draw = [] diff --git a/lib/matplotlib/mlab.py b/lib/matplotlib/mlab.py index 031ee2351bc7..e2a9173cfa9b 100644 --- a/lib/matplotlib/mlab.py +++ b/lib/matplotlib/mlab.py @@ -1461,8 +1461,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 e6c3a9838889..c61cf1f3e775 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -2133,11 +2133,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:: @@ -2155,17 +2154,15 @@ 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. fig = figure(fignum, figsize=figaspect(A)) ax = fig.add_axes([0.15, 0.09, 0.775, 0.775]) - im = ax.matshow(A, **kwargs) sci(im) - return im diff --git a/lib/matplotlib/scale.py b/lib/matplotlib/scale.py index 424df5cf8c98..157c2d50b2b6 100644 --- a/lib/matplotlib/scale.py +++ b/lib/matplotlib/scale.py @@ -104,93 +104,93 @@ def get_transform(self): class FuncTransform(Transform): - """ - A simple transform that takes and arbitrary function for the - forward and inverse transform. - """ - - input_dims = 1 - output_dims = 1 - is_separable = True - has_inverse = True - - def __init__(self, forward, inverse): - """ - Parameters - ---------- - - forward : callable - The forward function for the transform. This function must have - an inverse and, for best behavior, be monotonic. - It must have the signature:: - - def forward(values: array-like) -> array-like - - inverse : callable - The inverse of the forward function. Signature as ``forward``. - """ - super().__init__() - if callable(forward) and callable(inverse): - self._forward = forward - self._inverse = inverse - else: - raise ValueError('arguments to FuncTransform must ' - 'be functions') - - def transform_non_affine(self, values): - return self._forward(values) - - def inverted(self): - return FuncTransform(self._inverse, self._forward) + """ + A simple transform that takes and arbitrary function for the + forward and inverse transform. + """ + + input_dims = 1 + output_dims = 1 + is_separable = True + has_inverse = True + + def __init__(self, forward, inverse): + """ + Parameters + ---------- + + forward : callable + The forward function for the transform. This function must have + an inverse and, for best behavior, be monotonic. + It must have the signature:: + + def forward(values: array-like) -> array-like + + inverse : callable + The inverse of the forward function. Signature as ``forward``. + """ + super().__init__() + if callable(forward) and callable(inverse): + self._forward = forward + self._inverse = inverse + else: + raise ValueError('arguments to FuncTransform must ' + 'be functions') + + def transform_non_affine(self, values): + return self._forward(values) + + def inverted(self): + return FuncTransform(self._inverse, self._forward) class FuncScale(ScaleBase): - """ - Provide an arbitrary scale with user-supplied function for the axis. - """ - - name = 'function' - - def __init__(self, axis, functions): - """ - Parameters - ---------- - - axis: the axis for the scale - - functions : (callable, callable) - two-tuple of the forward and inverse functions for the scale. - The forward function must have an inverse and, for best behavior, - be monotonic. - - Both functions must have the signature:: - - def forward(values: array-like) -> array-like - """ - forward, inverse = functions - transform = FuncTransform(forward, inverse) - self._transform = transform - - def get_transform(self): - """ - The transform for arbitrary scaling - """ - return self._transform - - def set_default_locators_and_formatters(self, axis): - """ - Set the locators and formatters to the same defaults as the - linear scale. - """ - axis.set_major_locator(AutoLocator()) - axis.set_major_formatter(ScalarFormatter()) - axis.set_minor_formatter(NullFormatter()) - # update the minor locator for x and y axis based on rcParams - if (axis.axis_name == 'x' and rcParams['xtick.minor.visible'] - or axis.axis_name == 'y' and rcParams['ytick.minor.visible']): - axis.set_minor_locator(AutoMinorLocator()) - else: - axis.set_minor_locator(NullLocator()) + """ + Provide an arbitrary scale with user-supplied function for the axis. + """ + + name = 'function' + + def __init__(self, axis, functions): + """ + Parameters + ---------- + + axis: the axis for the scale + + functions : (callable, callable) + two-tuple of the forward and inverse functions for the scale. + The forward function must have an inverse and, for best behavior, + be monotonic. + + Both functions must have the signature:: + + def forward(values: array-like) -> array-like + """ + forward, inverse = functions + transform = FuncTransform(forward, inverse) + self._transform = transform + + def get_transform(self): + """ + The transform for arbitrary scaling + """ + return self._transform + + def set_default_locators_and_formatters(self, axis): + """ + Set the locators and formatters to the same defaults as the + linear scale. + """ + axis.set_major_locator(AutoLocator()) + axis.set_major_formatter(ScalarFormatter()) + axis.set_minor_formatter(NullFormatter()) + # update the minor locator for x and y axis based on rcParams + if (axis.axis_name == 'x' and rcParams['xtick.minor.visible'] + or axis.axis_name == 'y' and rcParams['ytick.minor.visible']): + axis.set_minor_locator(AutoMinorLocator()) + else: + axis.set_minor_locator(NullLocator()) class LogTransformBase(Transform): @@ -218,7 +218,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 9b233d034553..23c0c5222dd2 100644 --- a/lib/matplotlib/tests/test_preprocess_data.py +++ b/lib/matplotlib/tests/test_preprocess_data.py @@ -27,11 +27,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 fd77fac2d9a1..890150aa0ca5 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -794,7 +794,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 d709e8e05624..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<3.7 -flake8-per-file-ignores +flake8>=3.7
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: