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

Skip to content

Commit 3ea8522

Browse files
authored
Merge pull request #16619 from anntzer/e127
Fix overindented lines.
2 parents d7ba944 + c664fb0 commit 3ea8522

24 files changed

+80
-89
lines changed

examples/images_contours_and_fields/tricontour_smooth_delaunay.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ def experiment_res(x, y):
124124

125125
# 1) plot of the refined (computed) data contours:
126126
ax.tricontour(tri_refi, z_test_refi, levels=levels, cmap=cmap,
127-
linewidths=[2.0, 0.5, 1.0, 0.5])
127+
linewidths=[2.0, 0.5, 1.0, 0.5])
128128
# 2) plot of the expected (analytical) data contours (dashed):
129129
if plot_expected:
130130
ax.tricontour(tri_refi, z_expected, levels=levels, cmap=cmap,
131-
linestyles='--')
131+
linestyles='--')
132132
# 3) plot of the fine mesh on which interpolation was done:
133133
if plot_refi_tri:
134134
ax.triplot(tri_refi, color='0.97')

examples/images_contours_and_fields/tricontour_smooth_user.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ def function_z(x, y):
6969
cmap = cm.get_cmap(name='terrain', lut=None)
7070
ax.tricontourf(tri_refi, z_test_refi, levels=levels, cmap=cmap)
7171
ax.tricontour(tri_refi, z_test_refi, levels=levels,
72-
colors=['0.25', '0.5', '0.5', '0.5', '0.5'],
73-
linewidths=[1.0, 0.5, 0.5, 0.5, 0.5])
72+
colors=['0.25', '0.5', '0.5', '0.5', '0.5'],
73+
linewidths=[1.0, 0.5, 0.5, 0.5, 0.5])
7474

7575
ax.set_title("High-resolution tricontouring")
7676

lib/matplotlib/_cm.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,22 @@ def _g36(x): return 2 * x - 1
240240
(0.857143, 0.937500, 0.937500),
241241
(1.0, 0.09375, 0.09375))}
242242

243-
_jet_data = {'red': ((0., 0, 0), (0.35, 0, 0), (0.66, 1, 1), (0.89, 1, 1),
244-
(1, 0.5, 0.5)),
245-
'green': ((0., 0, 0), (0.125, 0, 0), (0.375, 1, 1), (0.64, 1, 1),
246-
(0.91, 0, 0), (1, 0, 0)),
247-
'blue': ((0., 0.5, 0.5), (0.11, 1, 1), (0.34, 1, 1),
248-
(0.65, 0, 0), (1, 0, 0))}
243+
_jet_data = {'red': ((0.00, 0, 0),
244+
(0.35, 0, 0),
245+
(0.66, 1, 1),
246+
(0.89, 1, 1),
247+
(1.00, 0.5, 0.5)),
248+
'green': ((0.000, 0, 0),
249+
(0.125, 0, 0),
250+
(0.375, 1, 1),
251+
(0.640, 1, 1),
252+
(0.910, 0, 0),
253+
(1.000, 0, 0)),
254+
'blue': ((0.00, 0.5, 0.5),
255+
(0.11, 1, 1),
256+
(0.34, 1, 1),
257+
(0.65, 0, 0),
258+
(1.00, 0, 0))}
249259

250260
_pink_data = {'red': ((0., 0.1178, 0.1178), (0.015873, 0.195857, 0.195857),
251261
(0.031746, 0.250661, 0.250661),

lib/matplotlib/axes/_axes.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ def get_title(self, loc="center"):
114114
title = cbook._check_getitem(titles, loc=loc.lower())
115115
return title.get_text()
116116

117-
def set_title(self, label, fontdict=None, loc=None, pad=None,
118-
**kwargs):
117+
def set_title(self, label, fontdict=None, loc=None, pad=None, **kwargs):
119118
"""
120119
Set a title for the axes.
121120
@@ -1417,8 +1416,8 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
14171416

14181417
colls = []
14191418
for position, lineoffset, linelength, linewidth, color, linestyle in \
1420-
zip(positions, lineoffsets, linelengths, linewidths,
1421-
colors, linestyles):
1419+
zip(positions, lineoffsets, linelengths, linewidths,
1420+
colors, linestyles):
14221421
coll = mcoll.EventCollection(position,
14231422
orientation=orientation,
14241423
lineoffset=lineoffset,
@@ -7992,7 +7991,7 @@ def violin(self, vpstats, positions=None, vert=True, widths=0.5,
79927991
ppmaxs = np.concatenate((ppmaxs, [cmax] * np.size(q)))
79937992
# Start rendering
79947993
artists['cquantiles'] = perp_lines(quantiles, ppmins, ppmaxs,
7995-
colors=edgecolor)
7994+
colors=edgecolor)
79967995

79977996
return artists
79987997

lib/matplotlib/axes/_secondary_axes.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ class SecondaryAxis(_AxesBase):
3939
General class to hold a Secondary_X/Yaxis.
4040
"""
4141

42-
def __init__(self, parent, orientation,
43-
location, functions, **kwargs):
42+
def __init__(self, parent, orientation, location, functions, **kwargs):
4443
"""
4544
See `.secondary_xaxis` and `.secondary_yaxis` for the doc string.
4645
While there is no need for this to be private, it should really be

lib/matplotlib/axis.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,10 @@ def get_view_interval(self):
346346

347347
def _apply_params(self, **kw):
348348
for name, target in [("gridOn", self.gridline),
349-
("tick1On", self.tick1line),
350-
("tick2On", self.tick2line),
351-
("label1On", self.label1),
352-
("label2On", self.label2)]:
349+
("tick1On", self.tick1line),
350+
("tick2On", self.tick2line),
351+
("label1On", self.label1),
352+
("label2On", self.label2)]:
353353
if name in kw:
354354
target.set_visible(kw.pop(name))
355355
if any(k in kw for k in ['size', 'width', 'pad', 'tickdir']):

lib/matplotlib/backends/qt_editor/_formlayout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,4 +566,4 @@ def apply_test(data):
566566
print("result:", fedit(((datagroup, "Title 1", "Tab 1 comment"),
567567
(datalist, "Title 2", "Tab 2 comment"),
568568
(datalist, "Title 3", "Tab 3 comment")),
569-
"Global title"))
569+
"Global title"))

lib/matplotlib/figure.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,9 @@ def __init__(self,
253253
edgecolor=None,
254254
linewidth=0.0,
255255
frameon=None,
256-
subplotpars=None, # default to rc
257-
tight_layout=None, # default to rc figure.autolayout
258-
constrained_layout=None, # default to rc
259-
#figure.constrained_layout.use
256+
subplotpars=None, # rc figure.subplot.*
257+
tight_layout=None, # rc figure.autolayout
258+
constrained_layout=None, # rc figure.constrained_layout.use
260259
):
261260
"""
262261
Parameters

lib/matplotlib/mathtext.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2748,7 +2748,7 @@ def symbol(self, s, loc, toks):
27482748
return [Hlist([self._make_space(0.2),
27492749
char,
27502750
self._make_space(0.2)],
2751-
do_kern = True)]
2751+
do_kern=True)]
27522752
elif c in self._punctuation_symbols:
27532753

27542754
# Do not space commas between brackets
@@ -2762,9 +2762,7 @@ def symbol(self, s, loc, toks):
27622762
if c == '.' and s[loc - 1].isdigit() and s[loc + 1].isdigit():
27632763
return [char]
27642764
else:
2765-
return [Hlist([char,
2766-
self._make_space(0.2)],
2767-
do_kern = True)]
2765+
return [Hlist([char, self._make_space(0.2)], do_kern=True)]
27682766
return [char]
27692767

27702768
accentprefixed = symbol

lib/matplotlib/projections/polar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ def draw(self, renderer, *args, **kwargs):
902902
if thetamin > thetamax:
903903
thetamin, thetamax = thetamax, thetamin
904904
rmin, rmax = ((self._realViewLim.intervaly - self.get_rorigin()) *
905-
self.get_rsign())
905+
self.get_rsign())
906906
if isinstance(self.patch, mpatches.Wedge):
907907
# Backwards-compatibility: Any subclassed Axes might override the
908908
# patch to not be the Wedge that PolarAxes uses.

lib/matplotlib/pyplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ def subplot(*args, **kwargs):
10141014
# Check for nrows and ncols, which are not valid subplot args:
10151015
if 'nrows' in kwargs or 'ncols' in kwargs:
10161016
raise TypeError("subplot() got an unexpected keyword argument 'ncols' "
1017-
"and/or 'nrows'. Did you intend to call subplots()?")
1017+
"and/or 'nrows'. Did you intend to call subplots()?")
10181018

10191019
fig = gcf()
10201020
ax = fig.add_subplot(*args, **kwargs)

lib/matplotlib/tests/test_arrow_patches.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ def test_boxarrow():
4242

4343
for i, stylename in enumerate(sorted(styles)):
4444
fig.text(0.5, ((n - i) * spacing - 0.5)/figheight, stylename,
45-
ha="center",
46-
size=fontsize,
47-
transform=fig.transFigure,
48-
bbox=dict(boxstyle=stylename, fc="w", ec="k"))
45+
ha="center",
46+
size=fontsize,
47+
transform=fig.transFigure,
48+
bbox=dict(boxstyle=stylename, fc="w", ec="k"))
4949

5050

5151
def __prepare_fancyarrow_dpi_cor_test():

lib/matplotlib/tests/test_axes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,7 +1756,7 @@ def test_bar_pandas(pd):
17561756
def test_bar_pandas_indexed(pd):
17571757
# Smoke test for indexed pandas
17581758
df = pd.DataFrame({"x": [1., 2., 3.], "width": [.2, .4, .6]},
1759-
index=[1, 2, 3])
1759+
index=[1, 2, 3])
17601760
fig, ax = plt.subplots()
17611761
ax.bar(df.x, 1., width=df.width)
17621762

@@ -5456,8 +5456,8 @@ def test_title_xticks_top():
54565456
def test_title_xticks_top_both():
54575457
# Test that title moves if xticks on top of axes.
54585458
fig, ax = plt.subplots()
5459-
ax.tick_params(axis="x", bottom=True, top=True,
5460-
labelbottom=True, labeltop=True)
5459+
ax.tick_params(axis="x",
5460+
bottom=True, top=True, labelbottom=True, labeltop=True)
54615461
ax.set_title('xlabel top')
54625462
fig.canvas.draw()
54635463
assert ax.title.get_position()[1] > 1.04

lib/matplotlib/tests/test_backend_nbagg.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ def test_ipynb():
2323
with out_path.open() as out:
2424
nb = nbformat.read(out, nbformat.current_nbformat)
2525

26-
errors = [output for cell in nb.cells if "outputs" in cell
27-
for output in cell["outputs"]
28-
if output.output_type == "error"]
26+
errors = [output for cell in nb.cells for output in cell.get("outputs", [])
27+
if output.output_type == "error"]
2928
assert not errors

lib/matplotlib/tests/test_colorbar.py

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -282,27 +282,22 @@ def test_colorbar_minorticks_on_off():
282282
im = ax.pcolormesh(data, vmin=-2.3, vmax=3.3)
283283

284284
cbar = fig.colorbar(im, extend='both')
285-
cbar.minorticks_on()
286-
correct_minorticklocs = np.array([-2.2, -1.8, -1.6, -1.4, -1.2, -0.8,
287-
-0.6, -0.4, -0.2, 0.2, 0.4, 0.6,
288-
0.8, 1.2, 1.4, 1.6, 1.8, 2.2, 2.4,
289-
2.6, 2.8, 3.2])
290285
# testing after minorticks_on()
291-
np.testing.assert_almost_equal(cbar.ax.yaxis.get_minorticklocs(),
292-
correct_minorticklocs)
293-
cbar.minorticks_off()
286+
cbar.minorticks_on()
287+
np.testing.assert_almost_equal(
288+
cbar.ax.yaxis.get_minorticklocs(),
289+
[-2.2, -1.8, -1.6, -1.4, -1.2, -0.8, -0.6, -0.4, -0.2,
290+
0.2, 0.4, 0.6, 0.8, 1.2, 1.4, 1.6, 1.8, 2.2, 2.4, 2.6, 2.8, 3.2])
294291
# testing after minorticks_off()
295-
np.testing.assert_almost_equal(cbar.ax.yaxis.get_minorticklocs(),
296-
np.array([]))
292+
cbar.minorticks_off()
293+
np.testing.assert_almost_equal(cbar.ax.yaxis.get_minorticklocs(), [])
297294

298295
im.set_clim(vmin=-1.2, vmax=1.2)
299296
cbar.minorticks_on()
300-
correct_minorticklocs = np.array([-1.2, -1.1, -0.9, -0.8, -0.7, -0.6,
301-
-0.4, -0.3, -0.2, -0.1, 0.1, 0.2,
302-
0.3, 0.4, 0.6, 0.7, 0.8, 0.9,
303-
1.1, 1.2])
304-
np.testing.assert_almost_equal(cbar.ax.yaxis.get_minorticklocs(),
305-
correct_minorticklocs)
297+
np.testing.assert_almost_equal(
298+
cbar.ax.yaxis.get_minorticklocs(),
299+
[-1.2, -1.1, -0.9, -0.8, -0.7, -0.6, -0.4, -0.3, -0.2, -0.1,
300+
0.1, 0.2, 0.3, 0.4, 0.6, 0.7, 0.8, 0.9, 1.1, 1.2])
306301

307302
# tests for github issue #13257 and PR #13265
308303
data = np.random.uniform(low=1, high=10, size=(20, 20))

lib/matplotlib/tests/test_constrainedlayout.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,9 @@ def test_constrained_layout6():
110110

111111
def test_constrained_layout7():
112112
"""Test for proper warning if fig not set in GridSpec"""
113-
with pytest.warns(UserWarning, match='Calling figure.constrained_layout, '
114-
'but figure not setup to do constrained layout'):
113+
with pytest.warns(
114+
UserWarning, match=('Calling figure.constrained_layout, but figure '
115+
'not setup to do constrained layout')):
115116
fig = plt.figure(constrained_layout=True)
116117
gs = gridspec.GridSpec(1, 2)
117118
gsl = gridspec.GridSpecFromSubplotSpec(2, 2, gs[0])

lib/matplotlib/tests/test_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ def test_bbox_image_inverted():
571571

572572
bbox_im = BboxImage(TransformedBbox(Bbox([[0.1, 0.2], [0.3, 0.25]]),
573573
ax.figure.transFigure),
574-
interpolation='nearest')
574+
interpolation='nearest')
575575
bbox_im.set_data(image)
576576
bbox_im.set_clip_on(False)
577577
ax.add_artist(bbox_im)

lib/matplotlib/tests/test_patches.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ def test_connection_patch():
391391
coordsA = "axes fraction"
392392
coordsB = ax2.get_yaxis_transform()
393393
con = mpatches.ConnectionPatch(xyA=xyA, xyB=xyB, coordsA=coordsA,
394-
coordsB=coordsB, arrowstyle="-")
394+
coordsB=coordsB, arrowstyle="-")
395395
ax2.add_artist(con)
396396

397397

lib/matplotlib/ticker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1419,7 +1419,7 @@ def format_eng(self, num):
14191419
# instead of 1 k. Beware of the corner case of values that are beyond
14201420
# the range of SI prefixes (i.e. > 'Y').
14211421
if (abs(float(format(mant, fmt))) >= 1000
1422-
and pow10 < max(self.ENG_PREFIXES)):
1422+
and pow10 < max(self.ENG_PREFIXES)):
14231423
mant /= 1000
14241424
pow10 += 3
14251425

lib/matplotlib/transforms.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,9 @@ def __setstate__(self, data_dict):
135135
# turn the normal dictionary back into a dictionary with weak values
136136
# The extra lambda is to provide a callback to remove dead
137137
# weakrefs from the dictionary when garbage collection is done.
138-
self._parents = {k: weakref.ref(v, lambda ref, sid=k,
139-
target=self._parents:
140-
target.pop(sid))
141-
for k, v in self._parents.items() if v is not None}
138+
self._parents = {
139+
k: weakref.ref(v, lambda _, pop=self._parents.pop, k=k: pop(k))
140+
for k, v in self._parents.items() if v is not None}
142141

143142
def __copy__(self, *args):
144143
raise NotImplementedError(
@@ -197,8 +196,8 @@ def set_children(self, *children):
197196
# Use weak references so this dictionary won't keep obsolete nodes
198197
# alive; the callback deletes the dictionary entry. This is a
199198
# performance improvement over using WeakValueDictionary.
200-
ref = weakref.ref(self, lambda ref, sid=id(self),
201-
target=child._parents: target.pop(sid))
199+
ref = weakref.ref(
200+
self, lambda _, pop=child._parents.pop, k=id(self): pop(k))
202201
child._parents[id(self)] = ref
203202

204203
if DEBUG:
@@ -2522,7 +2521,7 @@ def get_matrix(self):
25222521
self._mtx = np.array([[outw, 0.0, outl],
25232522
[ 0.0, outh, outb],
25242523
[ 0.0, 0.0, 1.0]],
2525-
float)
2524+
float)
25262525
self._inverted = None
25272526
self._invalid = 0
25282527
return self._mtx

lib/mpl_toolkits/axisartist/angle_helper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,14 +375,14 @@ def __call__(self, transform_xy, x1, y1, x2, y2):
375375
lat_min, lat_max = np.nanmin(lat), np.nanmax(lat)
376376

377377
lon_min, lon_max, lat_min, lat_max = \
378-
self._adjust_extremes(lon_min, lon_max, lat_min, lat_max)
378+
self._adjust_extremes(lon_min, lon_max, lat_min, lat_max)
379379

380380
return lon_min, lon_max, lat_min, lat_max
381381

382382
def _adjust_extremes(self, lon_min, lon_max, lat_min, lat_max):
383383

384384
lon_min, lon_max, lat_min, lat_max = \
385-
self._add_pad(lon_min, lon_max, lat_min, lat_max)
385+
self._add_pad(lon_min, lon_max, lat_min, lat_max)
386386

387387
# check cycle
388388
if self.lon_cycle:

lib/mpl_toolkits/axisartist/axislines.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import numpy as np
4343

4444
from matplotlib import cbook, rcParams
45-
import matplotlib.artist as martist
4645
import matplotlib.axes as maxes
4746
from matplotlib.path import Path
4847
from mpl_toolkits.axes_grid1 import mpl_axes
@@ -537,23 +536,16 @@ def grid(self, b=None, which='major', axis="both", **kwargs):
537536
# their are some discrepancy between the behavior of grid in
538537
# axes_grid and the original mpl's grid, because axes_grid
539538
# explicitly set the visibility of the gridlines.
540-
541539
super().grid(b, which=which, axis=axis, **kwargs)
542540
if not self._axisline_on:
543541
return
544-
545542
if b is None:
546543
b = (self.axes.xaxis._gridOnMinor
547-
or self.axes.xaxis._gridOnMajor
548-
or self.axes.yaxis._gridOnMinor
549-
or self.axes.yaxis._gridOnMajor)
550-
551-
self.gridlines.set_which(which)
552-
self.gridlines.set_axis(axis)
553-
self.gridlines.set_visible(b)
554-
555-
if len(kwargs):
556-
martist.setp(self.gridlines, **kwargs)
544+
or self.axes.xaxis._gridOnMajor
545+
or self.axes.yaxis._gridOnMinor
546+
or self.axes.yaxis._gridOnMajor)
547+
self.gridlines.set(which=which, axis=axis, visible=b)
548+
self.gridlines.set(**kwargs)
557549

558550
def get_children(self):
559551
if self._axisline_on:

lib/mpl_toolkits/axisartist/floating_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,9 @@ def _update_grid(self, x1, y1, x2, y2):
236236
lon_min, lon_max = sorted(extremes[:2])
237237
lat_min, lat_max = sorted(extremes[2:])
238238
lon_levs, lon_n, lon_factor = \
239-
grid_finder.grid_locator1(lon_min, lon_max)
239+
grid_finder.grid_locator1(lon_min, lon_max)
240240
lat_levs, lat_n, lat_factor = \
241-
grid_finder.grid_locator2(lat_min, lat_max)
241+
grid_finder.grid_locator2(lat_min, lat_max)
242242
grid_info["extremes"] = lon_min, lon_max, lat_min, lat_max # extremes
243243

244244
grid_info["lon_info"] = lon_levs, lon_n, lon_factor

0 commit comments

Comments
 (0)