Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb292a59

Browse files
authored
Merge pull request#16874 from timhoffm/pydocstyle-D209
Fix pydocstyle D209 (Multi-line docstring closing separate line)
2 parents65ebc8c +08ccd61 commitb292a59

File tree

5 files changed

+83
-55
lines changed

5 files changed

+83
-55
lines changed

‎.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ignore =
1313
N801, N802, N803, N806, N812,
1414
# pydocstyle
1515
D100, D101, D102, D103, D104, D105, D106, D107,
16-
D200, D202, D203, D204, D205, D207,D209,D212, D213,
16+
D200, D202, D203, D204, D205, D207, D212, D213,
1717
D301
1818
D400, D401, D402, D403, D413,
1919

‎lib/matplotlib/backends/backend_pdf.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,12 @@
9595

9696

9797
deffill(strings,linelen=75):
98-
"""Make one string from sequence of strings, with whitespace
99-
in between. The whitespace is chosen to form lines of at most
100-
linelen characters, if possible."""
98+
"""
99+
Make one string from sequence of strings, with whitespace in between.
100+
101+
The whitespace is chosen to form lines of at most *linelen* characters,
102+
if possible.
103+
"""
101104
currpos=0
102105
lasti=0
103106
result= []
@@ -295,8 +298,7 @@ def pdfRepr(self):
295298

296299

297300
classVerbatim:
298-
"""Store verbatim PDF command content for later inclusion in the
299-
stream."""
301+
"""Store verbatim PDF command content for later inclusion in the stream."""
300302
def__init__(self,x):
301303
self._x=x
302304

@@ -322,9 +324,16 @@ def pdfRepr(self):
322324

323325

324326
def_paint_path(fill,stroke):
325-
"""Return the PDF operator to paint a path in the following way:
326-
fill: fill the path with the fill color
327-
stroke: stroke the outline of the path with the line color"""
327+
"""
328+
Return the PDF operator to paint a path.
329+
330+
Parameters
331+
----------
332+
fill: bool
333+
Fill the path with the fill color.
334+
stroke: bool
335+
Stroke the outline of the path with the line color.
336+
"""
328337
ifstroke:
329338
iffill:
330339
returnOp.fill_stroke
@@ -339,7 +348,8 @@ def _paint_path(fill, stroke):
339348

340349

341350
classStream:
342-
"""PDF stream object.
351+
"""
352+
PDF stream object.
343353
344354
This has no pdfRepr method. Instead, call begin(), then output the
345355
contents of the stream by calling write(), and finally call end().

‎lib/matplotlib/dviread.py

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,45 +69,55 @@
6969
# argument bytes in this delta.
7070

7171
def_arg_raw(dvi,delta):
72-
"""Return *delta* without reading anything more from the dvi file"""
72+
"""Return *delta* without reading anything more from the dvi file."""
7373
returndelta
7474

7575

7676
def_arg(bytes,signed,dvi,_):
77-
"""Read *bytes* bytes, returning the bytes interpreted as a
78-
signed integer if *signed* is true, unsigned otherwise."""
77+
"""
78+
Read *bytes* bytes, returning the bytes interpreted as a signed integer
79+
if *signed* is true, unsigned otherwise.
80+
"""
7981
returndvi._arg(bytes,signed)
8082

8183

8284
def_arg_slen(dvi,delta):
83-
"""Signed, length *delta*
85+
"""
86+
Signed, length *delta*
8487
85-
Read *delta* bytes, returning None if *delta* is zero, and
86-
the bytes interpreted as a signed integer otherwise."""
88+
Read *delta* bytes, returning None if *delta* is zero, and the bytes
89+
interpreted as a signed integer otherwise.
90+
"""
8791
ifdelta==0:
8892
returnNone
8993
returndvi._arg(delta,True)
9094

9195

9296
def_arg_slen1(dvi,delta):
93-
"""Signed, length *delta*+1
97+
"""
98+
Signed, length *delta*+1
9499
95-
Read *delta*+1 bytes, returning the bytes interpreted as signed."""
100+
Read *delta*+1 bytes, returning the bytes interpreted as signed.
101+
"""
96102
returndvi._arg(delta+1,True)
97103

98104

99105
def_arg_ulen1(dvi,delta):
100-
"""Unsigned length *delta*+1
106+
"""
107+
Unsigned length *delta*+1
101108
102-
Read *delta*+1 bytes, returning the bytes interpreted as unsigned."""
109+
Read *delta*+1 bytes, returning the bytes interpreted as unsigned.
110+
"""
103111
returndvi._arg(delta+1,False)
104112

105113

106114
def_arg_olen1(dvi,delta):
107-
"""Optionally signed, length *delta*+1
115+
"""
116+
Optionally signed, length *delta*+1
108117
109118
Read *delta*+1 bytes, returning the bytes interpreted as
110-
unsigned integer for 0<=*delta*<3 and signed if *delta*==3."""
119+
unsigned integer for 0<=*delta*<3 and signed if *delta*==3.
120+
"""
111121
returndvi._arg(delta+1,delta==3)
112122

113123

@@ -122,7 +132,8 @@ def _arg_olen1(dvi, delta):
122132

123133

124134
def_dispatch(table,min,max=None,state=None,args=('raw',)):
125-
"""Decorator for dispatch by opcode. Sets the values in *table*
135+
"""
136+
Decorator for dispatch by opcode. Sets the values in *table*
126137
from *min* to *max* to this method, adds a check that the Dvi state
127138
matches *state* if not None, reads arguments from the file according
128139
to *args*.

‎lib/matplotlib/tests/test_colors.py

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -592,8 +592,10 @@ def test_light_source_topo_surface():
592592

593593

594594
deftest_light_source_shading_default():
595-
"""Array comparison test for the default "hsv" blend mode. Ensure the
596-
default result doesn't change without warning."""
595+
"""
596+
Array comparison test for the default "hsv" blend mode. Ensure the
597+
default result doesn't change without warning.
598+
"""
597599
y,x=np.mgrid[-1.2:1.2:8j,-1.2:1.2:8j]
598600
z=10*np.cos(x**2+y**2)
599601

@@ -647,8 +649,10 @@ def test_light_source_shading_default():
647649
# additional elements being masked when calculating the gradient thus
648650
# the output is different with earlier numpy versions.
649651
deftest_light_source_masked_shading():
650-
"""Array comparison test for a surface with a masked portion. Ensures that
651-
we don't wind up with "fringes" of odd colors around masked regions."""
652+
"""
653+
Array comparison test for a surface with a masked portion. Ensures that
654+
we don't wind up with "fringes" of odd colors around masked regions.
655+
"""
652656
y,x=np.mgrid[-1.2:1.2:8j,-1.2:1.2:8j]
653657
z=10*np.cos(x**2+y**2)
654658

@@ -701,8 +705,10 @@ def test_light_source_masked_shading():
701705

702706

703707
deftest_light_source_hillshading():
704-
"""Compare the current hillshading method against one that should be
705-
mathematically equivalent. Illuminates a cone from a range of angles."""
708+
"""
709+
Compare the current hillshading method against one that should be
710+
mathematically equivalent. Illuminates a cone from a range of angles.
711+
"""
706712

707713
defalternative_hillshade(azimuth,elev,z):
708714
illum=_sph2cart(*_azimuth2math(azimuth,elev))
@@ -730,20 +736,25 @@ def alternative_hillshade(azimuth, elev, z):
730736

731737

732738
deftest_light_source_planar_hillshading():
733-
"""Ensure that the illumination intensity is correct for planar
734-
surfaces."""
739+
"""
740+
Ensure that the illumination intensity is correct for planar surfaces.
741+
"""
735742

736743
defplane(azimuth,elevation,x,y):
737-
"""Create a plane whose normal vector is at the given azimuth and
738-
elevation."""
744+
"""
745+
Create a plane whose normal vector is at the given azimuth and
746+
elevation.
747+
"""
739748
theta,phi=_azimuth2math(azimuth,elevation)
740749
a,b,c=_sph2cart(theta,phi)
741750
z=-(a*x+b*y)/c
742751
returnz
743752

744753
defangled_plane(azimuth,elevation,angle,x,y):
745-
"""Create a plane whose normal vector is at an angle from the given
746-
azimuth and elevation."""
754+
"""
755+
Create a plane whose normal vector is at an angle from the given
756+
azimuth and elevation.
757+
"""
747758
elevation=elevation+angle
748759
ifelevation>90:
749760
azimuth= (azimuth+180)%360
@@ -775,8 +786,10 @@ def _sph2cart(theta, phi):
775786

776787

777788
def_azimuth2math(azimuth,elevation):
778-
"""Converts from clockwise-from-north and up-from-horizontal to
779-
mathematical conventions."""
789+
"""
790+
Convert from clockwise-from-north and up-from-horizontal to mathematical
791+
conventions.
792+
"""
780793
theta=np.radians((90-azimuth)%360)
781794
phi=np.radians(90-elevation)
782795
returntheta,phi
@@ -795,8 +808,10 @@ def test_pandas_iterable(pd):
795808

796809
@pytest.mark.parametrize('name',sorted(cm.cmap_d))
797810
deftest_colormap_reversing(name):
798-
"""Check the generated _lut data of a colormap and corresponding
799-
reversed colormap if they are almost the same."""
811+
"""
812+
Check the generated _lut data of a colormap and corresponding reversed
813+
colormap if they are almost the same.
814+
"""
800815
cmap=plt.get_cmap(name)
801816
cmap_r=cmap.reversed()
802817
ifnotcmap_r._isinit:

‎lib/matplotlib/tests/test_mlab.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,44 +1561,38 @@ def test_single_dataset_element(self):
15611561
mlab.GaussianKDE([42])
15621562

15631563
deftest_silverman_multidim_dataset(self):
1564-
"""Use a multi-dimensional array as the dataset and test silverman's
1565-
output"""
1564+
"""Test silverman's for a multi-dimensional array."""
15661565
x1=np.array([[1,2,3], [4,5,6], [7,8,9]])
15671566
withpytest.raises(np.linalg.LinAlgError):
15681567
mlab.GaussianKDE(x1,"silverman")
15691568

15701569
deftest_silverman_singledim_dataset(self):
1571-
"""Use a single dimension list as the dataset and test silverman's
1572-
output."""
1570+
"""Test silverman's output for a single dimension list."""
15731571
x1=np.array([-7,-5,1,4,5])
15741572
mygauss=mlab.GaussianKDE(x1,"silverman")
15751573
y_expected=0.76770389927475502
15761574
assert_almost_equal(mygauss.covariance_factor(),y_expected,7)
15771575

15781576
deftest_scott_multidim_dataset(self):
1579-
"""Use a multi-dimensional array as the dataset and test scott's output
1580-
"""
1577+
"""Test scott's output for a multi-dimensional array."""
15811578
x1=np.array([[1,2,3], [4,5,6], [7,8,9]])
15821579
withpytest.raises(np.linalg.LinAlgError):
15831580
mlab.GaussianKDE(x1,"scott")
15841581

15851582
deftest_scott_singledim_dataset(self):
1586-
"""Use a single-dimensional array as the dataset and test scott's
1587-
output"""
1583+
"""Test scott's output a single-dimensional array."""
15881584
x1=np.array([-7,-5,1,4,5])
15891585
mygauss=mlab.GaussianKDE(x1,"scott")
15901586
y_expected=0.72477966367769553
15911587
assert_almost_equal(mygauss.covariance_factor(),y_expected,7)
15921588

15931589
deftest_scalar_empty_dataset(self):
1594-
"""Use an empty array as the dataset and test the scalar's cov factor
1595-
"""
1590+
"""Test the scalar's cov factor for an empty array."""
15961591
withpytest.raises(ValueError):
15971592
mlab.GaussianKDE([],bw_method=5)
15981593

15991594
deftest_scalar_covariance_dataset(self):
1600-
"""Use a dataset and test a scalar's cov factor
1601-
"""
1595+
"""Test a scalar's cov factor."""
16021596
np.random.seed(8765678)
16031597
n_basesample=50
16041598
multidim_data= [np.random.randn(n_basesample)foriinrange(5)]
@@ -1607,8 +1601,7 @@ def test_scalar_covariance_dataset(self):
16071601
assertkde.covariance_factor()==0.5
16081602

16091603
deftest_callable_covariance_dataset(self):
1610-
"""Use a multi-dimensional array as the dataset and test the callable's
1611-
cov factor"""
1604+
"""Test the callable's cov factor for a multi-dimensional array."""
16121605
np.random.seed(8765678)
16131606
n_basesample=50
16141607
multidim_data= [np.random.randn(n_basesample)foriinrange(5)]
@@ -1619,8 +1612,7 @@ def callable_fun(x):
16191612
assertkde.covariance_factor()==0.55
16201613

16211614
deftest_callable_singledim_dataset(self):
1622-
"""Use a single-dimensional array as the dataset and test the
1623-
callable's cov factor"""
1615+
"""Test the callable's cov factor for a single-dimensional array."""
16241616
np.random.seed(8765678)
16251617
n_basesample=50
16261618
multidim_data=np.random.randn(n_basesample)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp