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

Skip to content

Commit 68e8d95

Browse files
authored
Merge pull request #13337 from anntzer/flake837
TST: Bump to flake8 3.7.
2 parents f0e7db5 + af01bf3 commit 68e8d95

File tree

8 files changed

+122
-129
lines changed

8 files changed

+122
-129
lines changed

.flake8

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -28,36 +28,36 @@ per-file-ignores =
2828
tools/compare_backend_driver_results.py: E501
2929
tools/subset.py: E221, E251, E261, E302, E501
3030

31-
matplotlib/_cm.py: E202, E203, E302
32-
matplotlib/_mathtext_data.py: E203, E261
33-
matplotlib/backends/_backend_tk.py: E501
34-
matplotlib/backends/backend_agg.py: E302
35-
matplotlib/backends/backend_cairo.py: E203, E221, E402
36-
matplotlib/backends/backend_gtk3.py: E203, E221, E222, E225, E251, E501
37-
matplotlib/backends/backend_pgf.py: E731
38-
matplotlib/backends/qt_editor/_formlayout.py: E501
39-
matplotlib/font_manager.py: E203, E221, E251, E501
40-
matplotlib/fontconfig_pattern.py: E201, E203, E221, E222, E225
41-
matplotlib/mathtext.py: E201, E202, E203, E211, E221, E222, E225, E251, E301, E402
42-
matplotlib/projections/geo.py: E203, E221, E502
43-
matplotlib/pylab.py: E501
44-
matplotlib/rcsetup.py: E501
45-
matplotlib/tests/test_mathtext.py: E501
46-
matplotlib/transforms.py: E201, E202, E203, E501
47-
matplotlib/tri/triinterpolate.py: E201, E221
48-
matplotlib/type1font.py: E731
31+
lib/matplotlib/_cm.py: E202, E203, E302
32+
lib/matplotlib/_mathtext_data.py: E203, E261
33+
lib/matplotlib/backends/_backend_tk.py: E501
34+
lib/matplotlib/backends/backend_agg.py: E302
35+
lib/matplotlib/backends/backend_cairo.py: E203, E221, E402
36+
lib/matplotlib/backends/backend_gtk3.py: E203, E221, E222, E225, E251, E501
37+
lib/matplotlib/backends/backend_pgf.py: E731
38+
lib/matplotlib/backends/qt_editor/_formlayout.py: E501
39+
lib/matplotlib/font_manager.py: E203, E221, E251, E501
40+
lib/matplotlib/fontconfig_pattern.py: E201, E203, E221, E222, E225
41+
lib/matplotlib/mathtext.py: E201, E202, E203, E211, E221, E222, E225, E251, E301, E402
42+
lib/matplotlib/projections/geo.py: E203, E221, E502
43+
lib/matplotlib/pylab.py: E501
44+
lib/matplotlib/rcsetup.py: E501
45+
lib/matplotlib/tests/test_mathtext.py: E501
46+
lib/matplotlib/transforms.py: E201, E202, E203, E501
47+
lib/matplotlib/tri/triinterpolate.py: E201, E221
48+
lib/matplotlib/type1font.py: E731
4949

50-
mpl_toolkits/axes_grid/axes_rgb.py: E501
51-
mpl_toolkits/axes_grid1/axes_divider.py: E402, E501
52-
mpl_toolkits/axes_grid1/axes_grid.py: E225
53-
mpl_toolkits/axes_grid1/axes_size.py: E272, E501
54-
mpl_toolkits/axes_grid1/colorbar.py: E225, E501
55-
mpl_toolkits/axes_grid1/inset_locator.py: E501
56-
mpl_toolkits/axisartist/angle_helper.py: E221
57-
mpl_toolkits/axisartist/clip_path.py: E225
58-
mpl_toolkits/axisartist/floating_axes.py: E225, E402, E501
59-
mpl_toolkits/axisartist/grid_helper_curvelinear.py: E225, E501
60-
mpl_toolkits/tests/test_axes_grid1.py: E201, E202
50+
lib/mpl_toolkits/axes_grid/axes_rgb.py: E501
51+
lib/mpl_toolkits/axes_grid1/axes_divider.py: E402, E501
52+
lib/mpl_toolkits/axes_grid1/axes_grid.py: E225
53+
lib/mpl_toolkits/axes_grid1/axes_size.py: E272, E501
54+
lib/mpl_toolkits/axes_grid1/colorbar.py: E225, E501
55+
lib/mpl_toolkits/axes_grid1/inset_locator.py: E501
56+
lib/mpl_toolkits/axisartist/angle_helper.py: E221
57+
lib/mpl_toolkits/axisartist/clip_path.py: E225
58+
lib/mpl_toolkits/axisartist/floating_axes.py: E225, E402, E501
59+
lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py: E225, E501
60+
lib/mpl_toolkits/tests/test_axes_grid1.py: E201, E202
6161

6262
doc/conf.py: E402, E501
6363
doc/sphinxext/github.py: E302, E501

lib/matplotlib/axis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ def _update_ticks(self, renderer):
10741074
tick_tups = [ti for ti in tick_tups if ilow <= ti[1] <= ihigh]
10751075

10761076
if interval[1] <= interval[0]:
1077-
interval = interval[1], interval[0]
1077+
interval = interval[1], interval[0]
10781078
inter = self.get_transform().transform(interval)
10791079

10801080
ticks_to_draw = []

lib/matplotlib/mlab.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,8 +1461,8 @@ def __init__(self, dataset, bw_method=None):
14611461
elif (isString and bw_method == 'silverman'):
14621462
self.covariance_factor = self.silverman_factor
14631463
elif (np.isscalar(bw_method) and not isString):
1464-
self._bw_method = 'use constant'
1465-
self.covariance_factor = lambda: bw_method
1464+
self._bw_method = 'use constant'
1465+
self.covariance_factor = lambda: bw_method
14661466
elif callable(bw_method):
14671467
self._bw_method = bw_method
14681468
self.covariance_factor = lambda: self._bw_method(self)

lib/matplotlib/pyplot.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2133,11 +2133,10 @@ def matshow(A, fignum=None, **kwargs):
21332133
fignum : None or int or False
21342134
If *None*, create a new figure window with automatic numbering.
21352135
2136-
If *fignum* is an integer, draw into the figure with the given number
2136+
If a nonzero integer, draw into the figure with the given number
21372137
(create it if it does not exist).
21382138
2139-
If 0 or *False*, use the current axes if it exists instead of creating
2140-
a new figure.
2139+
If 0, use the current axes (or create one if it does not exist).
21412140
21422141
.. note::
21432142
@@ -2155,17 +2154,15 @@ def matshow(A, fignum=None, **kwargs):
21552154
21562155
"""
21572156
A = np.asanyarray(A)
2158-
if fignum is False or fignum is 0:
2157+
if fignum == 0:
21592158
ax = gca()
21602159
else:
21612160
# Extract actual aspect ratio of array and make appropriately sized
21622161
# figure.
21632162
fig = figure(fignum, figsize=figaspect(A))
21642163
ax = fig.add_axes([0.15, 0.09, 0.775, 0.775])
2165-
21662164
im = ax.matshow(A, **kwargs)
21672165
sci(im)
2168-
21692166
return im
21702167

21712168

lib/matplotlib/scale.py

Lines changed: 85 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -104,93 +104,93 @@ def get_transform(self):
104104

105105

106106
class FuncTransform(Transform):
107-
"""
108-
A simple transform that takes and arbitrary function for the
109-
forward and inverse transform.
110-
"""
111-
112-
input_dims = 1
113-
output_dims = 1
114-
is_separable = True
115-
has_inverse = True
116-
117-
def __init__(self, forward, inverse):
118-
"""
119-
Parameters
120-
----------
121-
122-
forward : callable
123-
The forward function for the transform. This function must have
124-
an inverse and, for best behavior, be monotonic.
125-
It must have the signature::
126-
127-
def forward(values: array-like) -> array-like
128-
129-
inverse : callable
130-
The inverse of the forward function. Signature as ``forward``.
131-
"""
132-
super().__init__()
133-
if callable(forward) and callable(inverse):
134-
self._forward = forward
135-
self._inverse = inverse
136-
else:
137-
raise ValueError('arguments to FuncTransform must '
138-
'be functions')
139-
140-
def transform_non_affine(self, values):
141-
return self._forward(values)
142-
143-
def inverted(self):
144-
return FuncTransform(self._inverse, self._forward)
107+
"""
108+
A simple transform that takes and arbitrary function for the
109+
forward and inverse transform.
110+
"""
111+
112+
input_dims = 1
113+
output_dims = 1
114+
is_separable = True
115+
has_inverse = True
116+
117+
def __init__(self, forward, inverse):
118+
"""
119+
Parameters
120+
----------
121+
122+
forward : callable
123+
The forward function for the transform. This function must have
124+
an inverse and, for best behavior, be monotonic.
125+
It must have the signature::
126+
127+
def forward(values: array-like) -> array-like
128+
129+
inverse : callable
130+
The inverse of the forward function. Signature as ``forward``.
131+
"""
132+
super().__init__()
133+
if callable(forward) and callable(inverse):
134+
self._forward = forward
135+
self._inverse = inverse
136+
else:
137+
raise ValueError('arguments to FuncTransform must '
138+
'be functions')
139+
140+
def transform_non_affine(self, values):
141+
return self._forward(values)
142+
143+
def inverted(self):
144+
return FuncTransform(self._inverse, self._forward)
145145

146146

147147
class FuncScale(ScaleBase):
148-
"""
149-
Provide an arbitrary scale with user-supplied function for the axis.
150-
"""
151-
152-
name = 'function'
153-
154-
def __init__(self, axis, functions):
155-
"""
156-
Parameters
157-
----------
158-
159-
axis: the axis for the scale
160-
161-
functions : (callable, callable)
162-
two-tuple of the forward and inverse functions for the scale.
163-
The forward function must have an inverse and, for best behavior,
164-
be monotonic.
165-
166-
Both functions must have the signature::
167-
168-
def forward(values: array-like) -> array-like
169-
"""
170-
forward, inverse = functions
171-
transform = FuncTransform(forward, inverse)
172-
self._transform = transform
173-
174-
def get_transform(self):
175-
"""
176-
The transform for arbitrary scaling
177-
"""
178-
return self._transform
179-
180-
def set_default_locators_and_formatters(self, axis):
181-
"""
182-
Set the locators and formatters to the same defaults as the
183-
linear scale.
184-
"""
185-
axis.set_major_locator(AutoLocator())
186-
axis.set_major_formatter(ScalarFormatter())
187-
axis.set_minor_formatter(NullFormatter())
188-
# update the minor locator for x and y axis based on rcParams
189-
if (axis.axis_name == 'x' and rcParams['xtick.minor.visible']
190-
or axis.axis_name == 'y' and rcParams['ytick.minor.visible']):
191-
axis.set_minor_locator(AutoMinorLocator())
192-
else:
193-
axis.set_minor_locator(NullLocator())
148+
"""
149+
Provide an arbitrary scale with user-supplied function for the axis.
150+
"""
151+
152+
name = 'function'
153+
154+
def __init__(self, axis, functions):
155+
"""
156+
Parameters
157+
----------
158+
159+
axis: the axis for the scale
160+
161+
functions : (callable, callable)
162+
two-tuple of the forward and inverse functions for the scale.
163+
The forward function must have an inverse and, for best behavior,
164+
be monotonic.
165+
166+
Both functions must have the signature::
167+
168+
def forward(values: array-like) -> array-like
169+
"""
170+
forward, inverse = functions
171+
transform = FuncTransform(forward, inverse)
172+
self._transform = transform
173+
174+
def get_transform(self):
175+
"""
176+
The transform for arbitrary scaling
177+
"""
178+
return self._transform
179+
180+
def set_default_locators_and_formatters(self, axis):
181+
"""
182+
Set the locators and formatters to the same defaults as the
183+
linear scale.
184+
"""
185+
axis.set_major_locator(AutoLocator())
186+
axis.set_major_formatter(ScalarFormatter())
187+
axis.set_minor_formatter(NullFormatter())
188+
# update the minor locator for x and y axis based on rcParams
189+
if (axis.axis_name == 'x' and rcParams['xtick.minor.visible']
190+
or axis.axis_name == 'y' and rcParams['ytick.minor.visible']):
191+
axis.set_minor_locator(AutoMinorLocator())
192+
else:
193+
axis.set_minor_locator(NullLocator())
194194

195195

196196
class LogTransformBase(Transform):
@@ -218,7 +218,7 @@ def transform_non_affine(self, a):
218218
# pass. On the other hand, in practice, we want to clip beyond
219219
# np.log10(np.nextafter(0, 1)) ~ -323
220220
# so 1000 seems safe.
221-
out[a <= 0] = -1000
221+
out[a <= 0] = -1000
222222
return out
223223

224224
def __str__(self):

lib/matplotlib/tests/test_preprocess_data.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,8 @@ def test_compiletime_checks():
2727
"""test decorator invocations -> no replacements"""
2828

2929
def func(ax, x, y): pass
30-
3130
def func_args(ax, x, y, *args): pass
32-
3331
def func_kwargs(ax, x, y, **kwargs): pass
34-
3532
def func_no_ax_args(*args, **kwargs): pass
3633

3734
# this is ok

lib/matplotlib/widgets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ def _rendercursor(self):
794794

795795
def _notify_submit_observers(self):
796796
for cid, func in self.submit_observers.items():
797-
func(self.text)
797+
func(self.text)
798798

799799
def _release(self, event):
800800
if self.ignore(event):
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# Extra pip requirements for the travis flake8 build
22

3-
flake8<3.7
4-
flake8-per-file-ignores
3+
flake8>=3.7

0 commit comments

Comments
 (0)