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

Skip to content

Commit aac340f

Browse files
committed
Fix various flake8 indent problems.
1 parent 706051a commit aac340f

File tree

15 files changed

+64
-68
lines changed

15 files changed

+64
-68
lines changed

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ignore =
33
# Normal default
44
E121,E123,E126,E226,E24,E704,W503,W504,
55
# Additional ignores:
6-
E111, E114, E115, E116, E122, E124, E125, E127, E128, E129, E131,
6+
E122, E124, E125, E127, E128, E129, E131,
77
E265, E266,
88
E305, E306,
99
E722, E741,

examples/images_contours_and_fields/tricontour_smooth_delaunay.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,23 @@ def experiment_res(x, y):
4949
# Generating the initial data test points and triangulation for the demo
5050
#-----------------------------------------------------------------------------
5151
# User parameters for data test points
52-
n_test = 200 # Number of test data points, tested from 3 to 5000 for subdiv=3
5352

54-
subdiv = 3 # Number of recursive subdivisions of the initial mesh for smooth
55-
# plots. Values >3 might result in a very high number of triangles
56-
# for the refine mesh: new triangles numbering = (4**subdiv)*ntri
53+
# Number of test data points, tested from 3 to 5000 for subdiv=3
54+
n_test = 200
5755

58-
init_mask_frac = 0.0 # Float > 0. adjusting the proportion of
59-
# (invalid) initial triangles which will be masked
60-
# out. Enter 0 for no mask.
56+
# Number of recursive subdivisions of the initial mesh for smooth plots.
57+
# Values >3 might result in a very high number of triangles for the refine
58+
# mesh: new triangles numbering = (4**subdiv)*ntri
59+
subdiv = 3
6160

62-
min_circle_ratio = .01 # Minimum circle ratio - border triangles with circle
63-
# ratio below this will be masked if they touch a
64-
# border. Suggested value 0.01; use -1 to keep
65-
# all triangles.
61+
# Float > 0. adjusting the proportion of (invalid) initial triangles which will
62+
# be masked out. Enter 0 for no mask.
63+
init_mask_frac = 0.0
64+
65+
# Minimum circle ratio - border triangles with circle ratio below this will be
66+
# masked if they touch a border. Suggested value 0.01; use -1 to keep all
67+
# triangles.
68+
min_circle_ratio = .01
6669

6770
# Random points
6871
random_gen = np.random.RandomState(seed=19680801)

examples/misc/multipage_pdf.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
x = np.arange(0, 5, 0.1)
3333
plt.plot(x, np.sin(x), 'b-')
3434
plt.title('Page Two')
35-
pdf.attach_note("plot of sin(x)") # you can add a pdf note to
36-
# attach metadata to a page
35+
pdf.attach_note("plot of sin(x)") # attach metadata (as pdf note) to page
3736
pdf.savefig()
3837
plt.close()
3938

examples/pyplots/auto_subplots_adjust.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,31 @@
1111
or `~.Figure.constrained_layout`; this example shows how one could customize
1212
the subplot parameter adjustment.
1313
"""
14+
1415
import matplotlib.pyplot as plt
1516
import matplotlib.transforms as mtransforms
17+
1618
fig, ax = plt.subplots()
1719
ax.plot(range(10))
1820
ax.set_yticks((2,5,7))
1921
labels = ax.set_yticklabels(('really, really, really', 'long', 'labels'))
2022

2123
def on_draw(event):
22-
bboxes = []
23-
for label in labels:
24-
bbox = label.get_window_extent()
25-
# the figure transform goes from relative coords->pixels and we
26-
# want the inverse of that
27-
bboxi = bbox.inverse_transformed(fig.transFigure)
28-
bboxes.append(bboxi)
29-
30-
# this is the bbox that bounds all the bboxes, again in relative
31-
# figure coords
32-
bbox = mtransforms.Bbox.union(bboxes)
33-
if fig.subplotpars.left < bbox.width:
34-
# we need to move it over
35-
fig.subplots_adjust(left=1.1*bbox.width) # pad a little
36-
fig.canvas.draw()
37-
return False
24+
bboxes = []
25+
for label in labels:
26+
bbox = label.get_window_extent()
27+
# the figure transform goes from relative coords->pixels and we
28+
# want the inverse of that
29+
bboxi = bbox.inverse_transformed(fig.transFigure)
30+
bboxes.append(bboxi)
31+
32+
# this is the bbox that bounds all the bboxes, again in relative
33+
# figure coords
34+
bbox = mtransforms.Bbox.union(bboxes)
35+
if fig.subplotpars.left < bbox.width:
36+
# we need to move it over
37+
fig.subplots_adjust(left=1.1*bbox.width) # pad a little
38+
fig.canvas.draw()
3839

3940
fig.canvas.mpl_connect('draw_event', on_draw)
4041

examples/user_interfaces/embedding_in_tk_sgskip.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ def on_key_press(event):
4141

4242

4343
def _quit():
44-
root.quit() # stops mainloop
45-
root.destroy() # this is necessary on Windows to prevent
46-
# Fatal Python Error: PyEval_RestoreThread: NULL tstate
44+
root.quit() # Stops mainloop.
45+
# The following is necessary on Windows to prevent
46+
# Fatal Python Error: PyEval_RestoreThread: NULL tstate
47+
root.destroy()
4748

4849

4950
button = tkinter.Button(master=root, text="Quit", command=_quit)

lib/matplotlib/backend_bases.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2630,8 +2630,7 @@ def __init__(self, canvas):
26302630
self.canvas = canvas
26312631
canvas.toolbar = self
26322632
self._nav_stack = cbook.Stack()
2633-
self._xypress = None # the location and axis info at the time
2634-
# of the press
2633+
self._xypress = None # location and axis info at the time of the press
26352634
self._idPress = None
26362635
self._idRelease = None
26372636
self._active = None
@@ -2644,8 +2643,7 @@ def __init__(self, canvas):
26442643
self._ids_zoom = []
26452644
self._zoom_mode = None
26462645

2647-
self._button_pressed = None # determined by the button pressed
2648-
# at start
2646+
self._button_pressed = None # determined by button pressed at start
26492647

26502648
self.mode = '' # a mode string for the status bar
26512649
self.set_history_buttons()

lib/matplotlib/backends/backend_cairo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def _append_path(ctx, path, transform, clip=None):
7373
if code == Path.MOVETO:
7474
ctx.move_to(*points)
7575
elif code == Path.CLOSEPOLY:
76-
ctx.close_path()
76+
ctx.close_path()
7777
elif code == Path.LINETO:
7878
ctx.line_to(*points)
7979
elif code == Path.CURVE3:

lib/matplotlib/backends/backend_pdf.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,7 @@ def __init__(self, filename, metadata=None):
505505

506506
self.paths = []
507507

508-
self.pageAnnotations = [] # A list of annotations for the
509-
# current page
508+
self.pageAnnotations = [] # A list of annotations for the current page
510509

511510
# The PDF spec recommends to include every procset
512511
procsets = [Name(x)

lib/matplotlib/colors.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,8 +781,7 @@ class ListedColormap(Colormap):
781781
the list will be extended by repetition.
782782
"""
783783
def __init__(self, colors, name='from_list', N=None):
784-
self.monochrome = False # True only if all colors in map are
785-
# identical; needed for contouring.
784+
self.monochrome = False # Are all colors identical? (for contour.py)
786785
if N is None:
787786
self.colors = colors
788787
N = len(colors)

lib/matplotlib/contour.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,8 +804,8 @@ def __init__(self, ax, *args,
804804
self.extend = extend
805805
self.antialiased = antialiased
806806
if self.antialiased is None and self.filled:
807-
self.antialiased = False # eliminate artifacts; we are not
808-
# stroking the boundaries.
807+
# Eliminate artifacts; we are not stroking the boundaries.
808+
self.antialiased = False
809809
# The default for line contours will be taken from the
810810
# LineCollection default, which uses :rc:`lines.antialiased`.
811811

lib/matplotlib/quiver.py

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,10 @@ def __init__(self, Q, X, Y, U, label,
239239
def on_dpi_change(fig):
240240
self_weakref = weak_self()
241241
if self_weakref is not None:
242-
self_weakref.labelsep = (self_weakref._labelsep_inches*fig.dpi)
243-
self_weakref._initialized = False # simple brute force update
244-
# works because _init is
245-
# called at the start of
246-
# draw.
242+
self_weakref.labelsep = self_weakref._labelsep_inches * fig.dpi
243+
# simple brute force update works because _init is called at
244+
# the start of draw.
245+
self_weakref._initialized = False
247246

248247
self._cid = Q.ax.figure.callbacks.connect('dpi_changed',
249248
on_dpi_change)
@@ -464,12 +463,11 @@ def __init__(self, ax, *args,
464463
def on_dpi_change(fig):
465464
self_weakref = weak_self()
466465
if self_weakref is not None:
467-
self_weakref._new_UV = True # vertices depend on width, span
468-
# which in turn depend on dpi
469-
self_weakref._initialized = False # simple brute force update
470-
# works because _init is
471-
# called at the start of
472-
# draw.
466+
# vertices depend on width, span which in turn depend on dpi
467+
self_weakref._new_UV = True
468+
# simple brute force update works because _init is called at
469+
# the start of draw.
470+
self_weakref._initialized = False
473471

474472
self._cid = self.ax.figure.callbacks.connect('dpi_changed',
475473
on_dpi_change)
@@ -712,12 +710,11 @@ def _h_arrows(self, length):
712710
if self.pivot == 'middle':
713711
X -= 0.5 * X[:, 3, np.newaxis]
714712
elif self.pivot == 'tip':
715-
X = X - X[:, 3, np.newaxis] # numpy bug? using -= does not
716-
# work here unless we multiply
717-
# by a float first, as with 'mid'.
713+
# numpy bug? using -= does not work here unless we multiply by a
714+
# float first, as with 'mid'.
715+
X = X - X[:, 3, np.newaxis]
718716
elif self.pivot != 'tail':
719-
raise ValueError(("Quiver.pivot must have value in {{'middle', "
720-
"'tip', 'tail'}} not {0}").format(self.pivot))
717+
cbook._check_in_list(["middle", "tip", "tail"], pivot=self.pivot)
721718

722719
tooshort = length < self.minlength
723720
if tooshort.any():

lib/matplotlib/scale.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,7 @@ def limit_range_for_scale(self, vmin, vmax, minpos):
422422
Limit the domain to positive values.
423423
"""
424424
if not np.isfinite(minpos):
425-
minpos = 1e-300 # This value should rarely if ever
426-
# end up with a visible effect.
425+
minpos = 1e-300 # Should rarely (if ever) have a visible effect.
427426

428427
return (minpos if vmin <= 0 else vmin,
429428
minpos if vmax <= 0 else vmax)
@@ -708,8 +707,7 @@ def limit_range_for_scale(self, vmin, vmax, minpos):
708707
Limit the domain to values between 0 and 1 (excluded).
709708
"""
710709
if not np.isfinite(minpos):
711-
minpos = 1e-7 # This value should rarely if ever
712-
# end up with a visible effect.
710+
minpos = 1e-7 # Should rarely (if ever) have a visible effect.
713711
return (minpos if vmin <= 0 else vmin,
714712
1 - minpos if vmax >= 1 else vmax)
715713

lib/matplotlib/tight_layout.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,9 @@ def get_tight_layout_figure(fig, axes_list, subplotspec_list, renderer,
300300
ncols_list = []
301301
ax_bbox_list = []
302302

303-
subplot_dict = {} # Multiple axes can share same subplot_interface (e.g.,
304-
# axes_grid1); thus we need to join them together.
303+
# Multiple axes can share same subplot_interface (e.g., axes_grid1); thus
304+
# we need to join them together.
305+
subplot_dict = {}
305306

306307
subplotspec_list2 = []
307308

lib/mpl_toolkits/axes_grid1/mpl_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ def __init__(self, axes):
2626
def __getitem__(self, k):
2727
if isinstance(k, tuple):
2828
r = SimpleChainedObjects(
29+
# super() within a list comprehension needs explicit args.
2930
[super(Axes.AxisDict, self).__getitem__(k1) for k1 in k])
30-
# super() within a list comprehension needs explicit args
3131
return r
3232
elif isinstance(k, slice):
3333
if k.start is None and k.stop is None and k.step is None:

lib/mpl_toolkits/axisartist/floating_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,8 @@ def _update_grid(self, x1, y1, x2, y2):
278278
grid_info["lat_lines"] = lat_lines
279279

280280
lon_lines, lat_lines = grid_finder._get_raw_grid_lines(
281-
extremes[:2], extremes[2:], *extremes)
282281
# lon_min, lon_max, lat_min, lat_max)
282+
extremes[:2], extremes[2:], *extremes)
283283

284284
grid_info["lon_lines0"] = lon_lines
285285
grid_info["lat_lines0"] = lat_lines

0 commit comments

Comments
 (0)