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

Skip to content

Commit 9895288

Browse files
authored
Merge pull request #16279 from anntzer/e128
STY: Fix underindented continuation lines.
2 parents 2bdf82b + 7a2a9db commit 9895288

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+320
-332
lines changed

.flake8

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

doc/sphinxext/missing_references.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ def _record_reference(self, record):
4747
self.app.env.missing_references_warnings = defaultdict(set)
4848

4949
record_missing_reference(self.app,
50-
self.app.env.missing_references_warnings,
51-
record.location)
50+
self.app.env.missing_references_warnings,
51+
record.location)
5252

5353
def filter(self, record):
5454
self._record_reference(record)
@@ -157,13 +157,14 @@ def _warn_unused_missing_references(app):
157157
return
158158

159159
# This is a dictionary of {(domain_type, target): locations}
160-
references_ignored = getattr(app.env,
161-
'missing_references_ignored_references', {})
160+
references_ignored = getattr(
161+
app.env, 'missing_references_ignored_references', {})
162162
references_events = getattr(app.env, 'missing_references_events', {})
163163

164164
# Warn about any reference which is no longer missing.
165165
for (domain_type, target), locations in references_ignored.items():
166-
missing_reference_locations = [_truncate_location(location)
166+
missing_reference_locations = [
167+
_truncate_location(location)
167168
for location in references_events.get((domain_type, target), [])]
168169

169170
# For each ignored reference location, ensure a missing reference
@@ -176,9 +177,9 @@ def _warn_unused_missing_references(app):
176177
f" from {app.config.missing_references_filename}."
177178
"It is no longer a missing reference in the docs.")
178179
logger.warning(msg,
179-
location=ignored_reference_location,
180-
type='ref',
181-
subtype=domain_type)
180+
location=ignored_reference_location,
181+
type='ref',
182+
subtype=domain_type)
182183

183184

184185
def save_missing_references_handler(app, exc):

examples/color/custom_cmap.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@
147147
# in the middle of the range.
148148
cdict4 = {**cdict3,
149149
'alpha': ((0.0, 1.0, 1.0),
150-
# (0.25, 1.0, 1.0),
150+
# (0.25, 1.0, 1.0),
151151
(0.5, 0.3, 0.3),
152-
# (0.75, 1.0, 1.0),
152+
# (0.75, 1.0, 1.0),
153153
(1.0, 1.0, 1.0)),
154154
}
155155

examples/images_contours_and_fields/contour_image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
axs = _axs.flatten()
4242

4343
cset1 = axs[0].contourf(X, Y, Z, levels, norm=norm,
44-
cmap=cm.get_cmap(cmap, len(levels) - 1))
44+
cmap=cm.get_cmap(cmap, len(levels) - 1))
4545
# It is not necessary, but for the colormap, we need only the
4646
# number of levels minus 1. To avoid discretization error, use
4747
# either this number or a large number such as the default (256).
@@ -84,7 +84,7 @@
8484
# image pixel (each color block on the following subplot), so the
8585
# domain that is contoured does not extend beyond these pixel centers.
8686
im = axs[3].imshow(Z, interpolation='nearest', extent=extent,
87-
cmap=cmap, norm=norm)
87+
cmap=cmap, norm=norm)
8888
axs[3].contour(Z, levels, colors='k', origin='image', extent=extent)
8989
ylim = axs[3].get_ylim()
9090
axs[3].set_ylim(ylim[::-1])

examples/images_contours_and_fields/plot_streamplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
ax3 = fig.add_subplot(gs[1, 1])
4949
strm = ax3.streamplot(X, Y, U, V, color=U, linewidth=2,
50-
cmap='autumn', start_points=seed_points.T)
50+
cmap='autumn', start_points=seed_points.T)
5151
fig.colorbar(strm.lines)
5252
ax3.set_title('Controlling Starting Points')
5353

examples/images_contours_and_fields/tricontour_smooth_delaunay.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ def experiment_res(x, y):
119119

120120
fig, ax = plt.subplots()
121121
ax.set_aspect('equal')
122-
ax.set_title("Filtering a Delaunay mesh\n" +
123-
"(application to high-resolution tricontouring)")
122+
ax.set_title("Filtering a Delaunay mesh\n"
123+
"(application to high-resolution tricontouring)")
124124

125125
# 1) plot of the refined (computed) data contours:
126126
ax.tricontour(tri_refi, z_test_refi, levels=levels, cmap=cmap,

examples/lines_bars_and_markers/markevery_demo.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def trim_axs(axs, N):
5353
###############################################################################
5454
# Plot each markevery case for linear x and y scales
5555

56-
fig1, axs = plt.subplots(rows, cols, figsize=figsize, constrained_layout=True)
56+
axs = plt.figure(figsize=figsize, constrained_layout=True).subplots(rows, cols)
5757
axs = trim_axs(axs, len(cases))
5858
for ax, case in zip(axs, cases):
5959
ax.set_title('markevery=%s' % str(case))
@@ -62,7 +62,7 @@ def trim_axs(axs, N):
6262
###############################################################################
6363
# Plot each markevery case for log x and y scales
6464

65-
fig2, axs = plt.subplots(rows, cols, figsize=figsize, constrained_layout=True)
65+
axs = plt.figure(figsize=figsize, constrained_layout=True).subplots(rows, cols)
6666
axs = trim_axs(axs, len(cases))
6767
for ax, case in zip(axs, cases):
6868
ax.set_title('markevery=%s' % str(case))
@@ -76,7 +76,7 @@ def trim_axs(axs, N):
7676
# it is always interpreted with respect to the first data point which might be
7777
# different to the first visible data point.
7878

79-
fig3, axs = plt.subplots(rows, cols, figsize=figsize, constrained_layout=True)
79+
axs = plt.figure(figsize=figsize, constrained_layout=True).subplots(rows, cols)
8080
axs = trim_axs(axs, len(cases))
8181
for ax, case in zip(axs, cases):
8282
ax.set_title('markevery=%s' % str(case))
@@ -91,8 +91,8 @@ def trim_axs(axs, N):
9191
###############################################################################
9292
# Plot each markevery case for polar plots
9393

94-
fig4, axs = plt.subplots(rows, cols, figsize=figsize,
95-
subplot_kw={'projection': 'polar'}, constrained_layout=True)
94+
axs = plt.figure(figsize=figsize, constrained_layout=True).subplots(
95+
rows, cols, subplot_kw={'projection': 'polar'})
9696
axs = trim_axs(axs, len(cases))
9797
for ax, case in zip(axs, cases):
9898
ax.set_title('markevery=%s' % str(case))

examples/statistics/barchart_demo.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,11 @@ def plot_student_results(student, scores, cohort_size):
139139

140140
# Center the text vertically in the bar
141141
yloc = rect.get_y() + rect.get_height() / 2
142-
label = ax1.annotate(rank_str, xy=(width, yloc), xytext=(xloc, 0),
143-
textcoords="offset points",
144-
ha=align, va='center',
145-
color=clr, weight='bold', clip_on=True)
142+
label = ax1.annotate(
143+
rank_str, xy=(width, yloc), xytext=(xloc, 0),
144+
textcoords="offset points",
145+
horizontalalignment=align, verticalalignment='center',
146+
color=clr, weight='bold', clip_on=True)
146147
rect_labels.append(label)
147148

148149
# make the interactive mouse over give the bar title

examples/statistics/confidence_ellipse.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,8 @@ def confidence_ellipse(x, y, ax, n_std=3.0, facecolor='none', **kwargs):
7070
# two-dimensionl dataset.
7171
ell_radius_x = np.sqrt(1 + pearson)
7272
ell_radius_y = np.sqrt(1 - pearson)
73-
ellipse = Ellipse((0, 0),
74-
width=ell_radius_x * 2,
75-
height=ell_radius_y * 2,
76-
facecolor=facecolor,
77-
**kwargs)
73+
ellipse = Ellipse((0, 0), width=ell_radius_x * 2, height=ell_radius_y * 2,
74+
facecolor=facecolor, **kwargs)
7875

7976
# Calculating the stdandard deviation of x from
8077
# the squareroot of the variance and multiplying
@@ -176,11 +173,11 @@ def get_correlated_dataset(n, dependency, mu, scale):
176173
ax_nstd.scatter(x, y, s=0.5)
177174

178175
confidence_ellipse(x, y, ax_nstd, n_std=1,
179-
label=r'$1\sigma$', edgecolor='firebrick')
176+
label=r'$1\sigma$', edgecolor='firebrick')
180177
confidence_ellipse(x, y, ax_nstd, n_std=2,
181-
label=r'$2\sigma$', edgecolor='fuchsia', linestyle='--')
178+
label=r'$2\sigma$', edgecolor='fuchsia', linestyle='--')
182179
confidence_ellipse(x, y, ax_nstd, n_std=3,
183-
label=r'$3\sigma$', edgecolor='blue', linestyle=':')
180+
label=r'$3\sigma$', edgecolor='blue', linestyle=':')
184181

185182
ax_nstd.scatter(mu[0], mu[1], c='red', s=3)
186183
ax_nstd.set_title('Different standard deviations')
@@ -209,7 +206,7 @@ def get_correlated_dataset(n, dependency, mu, scale):
209206
# Plot the ellipse with zorder=0 in order to demonstrate
210207
# its transparency (caused by the use of alpha).
211208
confidence_ellipse(x, y, ax_kwargs,
212-
alpha=0.5, facecolor='pink', edgecolor='purple', zorder=0)
209+
alpha=0.5, facecolor='pink', edgecolor='purple', zorder=0)
213210

214211
ax_kwargs.scatter(x, y, s=0.5)
215212
ax_kwargs.scatter(mu[0], mu[1], c='red', s=3)

examples/subplots_axes_and_figures/axes_box_aspect.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@
9999
# figure.
100100

101101
fig5, axs = plt.subplots(2, 2, sharex="col", sharey="row",
102-
gridspec_kw=dict(height_ratios=[1, 3],
103-
width_ratios=[3, 1]))
102+
gridspec_kw=dict(height_ratios=[1, 3],
103+
width_ratios=[3, 1]))
104104
axs[0, 1].set_visible(False)
105105
axs[0, 0].set_box_aspect(1/3)
106106
axs[1, 0].set_box_aspect(1)
@@ -138,7 +138,7 @@
138138
# following creates a 2 by 3 subplot grid with all square axes.
139139

140140
fig7, axs = plt.subplots(2, 3, subplot_kw=dict(box_aspect=1),
141-
sharex=True, sharey=True, constrained_layout=True)
141+
sharex=True, sharey=True, constrained_layout=True)
142142

143143
for i, ax in enumerate(axs.flat):
144144
ax.scatter(i % 3, -((i // 3) - 0.5)*200, c=[plt.cm.hsv(i / 6)], s=300)

examples/ticks_and_spines/date_concise_formatter.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,8 @@
165165
'%d %b %Y',
166166
'%d %b %Y %H:%M', ]
167167

168-
converter = mdates.ConciseDateConverter(formats=formats,
169-
zero_formats=zero_formats,
170-
offset_formats=offset_formats)
168+
converter = mdates.ConciseDateConverter(
169+
formats=formats, zero_formats=zero_formats, offset_formats=offset_formats)
171170

172171
munits.registry[np.datetime64] = converter
173172
munits.registry[datetime.date] = converter

examples/userdemo/colormap_normalizations_diverging.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@
2828
colors_undersea = plt.cm.terrain(np.linspace(0, 0.17, 256))
2929
colors_land = plt.cm.terrain(np.linspace(0.25, 1, 256))
3030
all_colors = np.vstack((colors_undersea, colors_land))
31-
terrain_map = colors.LinearSegmentedColormap.from_list('terrain_map',
32-
all_colors)
31+
terrain_map = colors.LinearSegmentedColormap.from_list(
32+
'terrain_map', all_colors)
3333

3434
# make the norm: Note the center is offset so that the land has more
3535
# dynamic range:
3636
divnorm = colors.TwoSlopeNorm(vmin=-500, vcenter=0, vmax=4000)
3737

38-
pcm = ax.pcolormesh(longitude, latitude, topo, rasterized=True, norm=divnorm,
39-
cmap=terrain_map,)
38+
pcm = ax.pcolormesh(
39+
longitude, latitude, topo, rasterized=True, norm=divnorm, cmap=terrain_map)
4040
ax.set_xlabel('Lon $[^o E]$')
4141
ax.set_ylabel('Lat $[^o N]$')
4242
ax.set_aspect(1 / np.cos(np.deg2rad(49)))

examples/userdemo/demo_gridspec06.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ def squiggle_xy(a, b, c, d):
2323
outer_grid = gridspec.GridSpec(4, 4, wspace=0.0, hspace=0.0)
2424

2525
for i in range(16):
26-
inner_grid = gridspec.GridSpecFromSubplotSpec(3, 3,
27-
subplot_spec=outer_grid[i], wspace=0.0, hspace=0.0)
26+
inner_grid = gridspec.GridSpecFromSubplotSpec(
27+
3, 3, subplot_spec=outer_grid[i], wspace=0.0, hspace=0.0)
2828
a = i // 4 + 1
2929
b = i % 4 + 1
3030
for j, (c, d) in enumerate(product(range(1, 4), repeat=2)):

lib/matplotlib/_cm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ def _gist_yarg(x): return 1 - x
11981198
# See `A Color Map for Effective Black-and-White Rendering of Color-Scale
11991199
# Images' by Carey Rappaport
12001200
# http://www.mathworks.com/matlabcentral/fileexchange/2662-cmrmap-m
1201-
_CMRmap_data = {'red': ((0.000, 0.00, 0.00),
1201+
_CMRmap_data = {'red': ((0.000, 0.00, 0.00),
12021202
(0.125, 0.15, 0.15),
12031203
(0.250, 0.30, 0.30),
12041204
(0.375, 0.60, 0.60),

lib/matplotlib/_constrained_layout.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def _axes_all_finite_sized(fig):
7777

7878
######################################################
7979
def do_constrained_layout(fig, renderer, h_pad, w_pad,
80-
hspace=None, wspace=None):
80+
hspace=None, wspace=None):
8181
"""
8282
Do the constrained_layout. Called at draw time in
8383
``figure.constrained_layout()``
@@ -420,7 +420,7 @@ def _align_spines(fig, gs):
420420
axc._poslayoutbox.height * height0 / heightC)
421421
alignheight = True
422422
elif _in_same_column(colnum0min, colnum0max,
423-
colnumCmin, colnumCmax):
423+
colnumCmin, colnumCmax):
424424
if height0 > heightC:
425425
ax._poslayoutbox.constrain_height_min(
426426
axc._poslayoutbox.height * height0 / heightC)
@@ -441,7 +441,7 @@ def _align_spines(fig, gs):
441441
axc._poslayoutbox.width * width0 / widthC)
442442
alignwidth = True
443443
elif _in_same_row(rownum0min, rownum0max,
444-
rownumCmin, rownumCmax):
444+
rownumCmin, rownumCmax):
445445
if width0 > widthC:
446446
ax._poslayoutbox.constrain_width_min(
447447
axc._poslayoutbox.width * width0 / widthC)
@@ -482,10 +482,10 @@ def _arrange_subplotspecs(gs, hspace=0, wspace=0):
482482
thepad = wspace / ncols
483483
if colNum0max < colNumCmin:
484484
layoutbox.hstack([ss0._layoutbox, ssc._layoutbox],
485-
padding=thepad)
485+
padding=thepad)
486486
if colNumCmax < colNum0min:
487487
layoutbox.hstack([ssc._layoutbox, ss0._layoutbox],
488-
padding=thepad)
488+
padding=thepad)
489489

490490
####
491491
# vertical alignment
@@ -621,7 +621,7 @@ def layoutcolorbargridspec(parents, cax, shrink, aspect, location, pad=0.05):
621621
else:
622622
order = [lb, ax._layoutbox]
623623
layoutbox.hstack(order, padding=pad * gslb.width,
624-
strength='strong')
624+
strength='strong')
625625
# constrain the height and center...
626626
# This isn't quite right. We'd like the colorbar
627627
# pos to line up w/ the axes poss, not the size of the
@@ -681,7 +681,7 @@ def layoutcolorbargridspec(parents, cax, shrink, aspect, location, pad=0.05):
681681
else:
682682
order = [lb, ax._layoutbox]
683683
layoutbox.vstack(order, padding=pad * gslb.width,
684-
strength='strong')
684+
strength='strong')
685685

686686
# Vertical Layout: need to check all the axes in this gridspec
687687
for ch in gslb.children:

lib/matplotlib/_layoutbox.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,10 +456,11 @@ def layout_from_subplotspec(self, subspec,
456456
return lb
457457

458458
def __repr__(self):
459-
args = (self.name, self.left.value(), self.bottom.value(),
460-
self.right.value(), self.top.value())
461-
return ('LayoutBox: %25s, (left: %1.3f) (bot: %1.3f) '
462-
'(right: %1.3f) (top: %1.3f) ') % args
459+
return (f'LayoutBox: {self.name:25s}, '
460+
f'(left: {self.left.value():1.3f}) '
461+
f'(bot: {self.bottom.value():1.3f}) '
462+
f'(right: {self.right.value():1.3f}) '
463+
f'(top: {self.top.value():1.3f})')
463464

464465

465466
# Utility functions that act on layoutboxes...

0 commit comments

Comments
 (0)