Skip to content

Commit fc7cec1

Browse files
authored
Remove remaining :rtype:s from docstrings (#9742)
2 parents 94cc03e + 5ad6072 commit fc7cec1

3 files changed

Lines changed: 18 additions & 57 deletions

File tree

src/PIL/Image.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,6 @@ def load(self) -> core.PixelAccess | None:
978978
operations. See :ref:`file-handling` for more information.
979979
980980
:returns: An image access object.
981-
:rtype: :py:class:`.PixelAccess`
982981
"""
983982
if self._im is not None and self.palette and self.palette.dirty:
984983
# realize palette
@@ -1062,7 +1061,6 @@ def convert(
10621061
:data:`Palette.ADAPTIVE`.
10631062
:param colors: Number of colors to use for the :data:`Palette.ADAPTIVE`
10641063
palette. Defaults to 256.
1065-
:rtype: :py:class:`~PIL.Image.Image`
10661064
:returns: An :py:class:`~PIL.Image.Image` object.
10671065
"""
10681066

@@ -1358,7 +1356,6 @@ def copy(self) -> Image:
13581356
Copies this image. Use this method if you wish to paste things
13591357
into an image, but still retain the original.
13601358
1361-
:rtype: :py:class:`~PIL.Image.Image`
13621359
:returns: An :py:class:`~PIL.Image.Image` object.
13631360
"""
13641361
self.load()
@@ -1375,7 +1372,6 @@ def crop(self, box: tuple[float, float, float, float] | None = None) -> Image:
13751372
Note: Prior to Pillow 3.4.0, this was a lazy operation.
13761373
13771374
:param box: The crop rectangle, as a (left, upper, right, lower)-tuple.
1378-
:rtype: :py:class:`~PIL.Image.Image`
13791375
:returns: An :py:class:`~PIL.Image.Image` object.
13801376
"""
13811377

@@ -1472,7 +1468,6 @@ def getbands(self) -> tuple[str, ...]:
14721468
For example, ``getbands`` on an RGB image returns ("R", "G", "B").
14731469
14741470
:returns: A tuple containing band names.
1475-
:rtype: tuple
14761471
"""
14771472
return ImageMode.getmode(self.mode).bands
14781473

src/PIL/ImageChops.py

Lines changed: 18 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,13 @@
2121

2222

2323
def constant(image: Image.Image, value: int) -> Image.Image:
24-
"""Fill a channel with a given gray level.
25-
26-
:rtype: :py:class:`~PIL.Image.Image`
27-
"""
24+
"""Fill a channel with a given gray level."""
2825

2926
return Image.new("L", image.size, value)
3027

3128

3229
def duplicate(image: Image.Image) -> Image.Image:
33-
"""Copy a channel. Alias for :py:meth:`PIL.Image.Image.copy`.
34-
35-
:rtype: :py:class:`~PIL.Image.Image`
36-
"""
30+
"""Copy a channel. Alias for :py:meth:`PIL.Image.Image.copy`."""
3731

3832
return image.copy()
3933

@@ -43,8 +37,6 @@ def invert(image: Image.Image) -> Image.Image:
4337
Invert an image (channel). ::
4438
4539
out = MAX - image
46-
47-
:rtype: :py:class:`~PIL.Image.Image`
4840
"""
4941

5042
image.load()
@@ -57,8 +49,6 @@ def lighter(image1: Image.Image, image2: Image.Image) -> Image.Image:
5749
the lighter values. ::
5850
5951
out = max(image1, image2)
60-
61-
:rtype: :py:class:`~PIL.Image.Image`
6252
"""
6353

6454
image1.load()
@@ -72,8 +62,6 @@ def darker(image1: Image.Image, image2: Image.Image) -> Image.Image:
7262
the darker values. ::
7363
7464
out = min(image1, image2)
75-
76-
:rtype: :py:class:`~PIL.Image.Image`
7765
"""
7866

7967
image1.load()
@@ -87,8 +75,6 @@ def difference(image1: Image.Image, image2: Image.Image) -> Image.Image:
8775
images. ::
8876
8977
out = abs(image1 - image2)
90-
91-
:rtype: :py:class:`~PIL.Image.Image`
9278
"""
9379

9480
image1.load()
@@ -104,8 +90,6 @@ def multiply(image1: Image.Image, image2: Image.Image) -> Image.Image:
10490
you multiply with a solid white image, the image is unaffected. ::
10591
10692
out = image1 * image2 / MAX
107-
108-
:rtype: :py:class:`~PIL.Image.Image`
10993
"""
11094

11195
image1.load()
@@ -118,8 +102,6 @@ def screen(image1: Image.Image, image2: Image.Image) -> Image.Image:
118102
Superimposes two inverted images on top of each other. ::
119103
120104
out = MAX - ((MAX - image1) * (MAX - image2) / MAX)
121-
122-
:rtype: :py:class:`~PIL.Image.Image`
123105
"""
124106

125107
image1.load()
@@ -130,8 +112,6 @@ def screen(image1: Image.Image, image2: Image.Image) -> Image.Image:
130112
def soft_light(image1: Image.Image, image2: Image.Image) -> Image.Image:
131113
"""
132114
Superimposes two images on top of each other using the Soft Light algorithm
133-
134-
:rtype: :py:class:`~PIL.Image.Image`
135115
"""
136116

137117
image1.load()
@@ -142,8 +122,6 @@ def soft_light(image1: Image.Image, image2: Image.Image) -> Image.Image:
142122
def hard_light(image1: Image.Image, image2: Image.Image) -> Image.Image:
143123
"""
144124
Superimposes two images on top of each other using the Hard Light algorithm
145-
146-
:rtype: :py:class:`~PIL.Image.Image`
147125
"""
148126

149127
image1.load()
@@ -154,8 +132,6 @@ def hard_light(image1: Image.Image, image2: Image.Image) -> Image.Image:
154132
def overlay(image1: Image.Image, image2: Image.Image) -> Image.Image:
155133
"""
156134
Superimposes two images on top of each other using the Overlay algorithm
157-
158-
:rtype: :py:class:`~PIL.Image.Image`
159135
"""
160136

161137
image1.load()
@@ -168,11 +144,11 @@ def add(
168144
) -> Image.Image:
169145
"""
170146
Adds two images, dividing the result by scale and adding the
171-
offset. If omitted, scale defaults to 1.0, and offset to 0.0. ::
147+
offset. If omitted, scale defaults to 1.0, and offset to 0.0.
172148
173-
out = ((image1 + image2) / scale + offset)
149+
::
174150
175-
:rtype: :py:class:`~PIL.Image.Image`
151+
out = ((image1 + image2) / scale + offset)
176152
"""
177153

178154
image1.load()
@@ -185,11 +161,11 @@ def subtract(
185161
) -> Image.Image:
186162
"""
187163
Subtracts two images, dividing the result by scale and adding the offset.
188-
If omitted, scale defaults to 1.0, and offset to 0.0. ::
164+
If omitted, scale defaults to 1.0, and offset to 0.0.
189165
190-
out = ((image1 - image2) / scale + offset)
166+
::
191167
192-
:rtype: :py:class:`~PIL.Image.Image`
168+
out = ((image1 - image2) / scale + offset)
193169
"""
194170

195171
image1.load()
@@ -198,11 +174,11 @@ def subtract(
198174

199175

200176
def add_modulo(image1: Image.Image, image2: Image.Image) -> Image.Image:
201-
"""Add two images, without clipping the result. ::
177+
"""Add two images, without clipping the result.
202178
203-
out = ((image1 + image2) % MAX)
179+
::
204180
205-
:rtype: :py:class:`~PIL.Image.Image`
181+
out = ((image1 + image2) % MAX)
206182
"""
207183

208184
image1.load()
@@ -211,11 +187,11 @@ def add_modulo(image1: Image.Image, image2: Image.Image) -> Image.Image:
211187

212188

213189
def subtract_modulo(image1: Image.Image, image2: Image.Image) -> Image.Image:
214-
"""Subtract two images, without clipping the result. ::
190+
"""Subtract two images, without clipping the result.
215191
216-
out = ((image1 - image2) % MAX)
192+
::
217193
218-
:rtype: :py:class:`~PIL.Image.Image`
194+
out = ((image1 - image2) % MAX)
219195
"""
220196

221197
image1.load()
@@ -232,8 +208,6 @@ def logical_and(image1: Image.Image, image2: Image.Image) -> Image.Image:
232208
as the second image. ::
233209
234210
out = ((image1 and image2) % MAX)
235-
236-
:rtype: :py:class:`~PIL.Image.Image`
237211
"""
238212

239213
image1.load()
@@ -247,8 +221,6 @@ def logical_or(image1: Image.Image, image2: Image.Image) -> Image.Image:
247221
Both of the images must have mode "1". ::
248222
249223
out = ((image1 or image2) % MAX)
250-
251-
:rtype: :py:class:`~PIL.Image.Image`
252224
"""
253225

254226
image1.load()
@@ -262,8 +234,6 @@ def logical_xor(image1: Image.Image, image2: Image.Image) -> Image.Image:
262234
Both of the images must have mode "1". ::
263235
264236
out = ((bool(image1) != bool(image2)) % MAX)
265-
266-
:rtype: :py:class:`~PIL.Image.Image`
267237
"""
268238

269239
image1.load()
@@ -272,10 +242,9 @@ def logical_xor(image1: Image.Image, image2: Image.Image) -> Image.Image:
272242

273243

274244
def blend(image1: Image.Image, image2: Image.Image, alpha: float) -> Image.Image:
275-
"""Blend images using constant transparency weight. Alias for
276-
:py:func:`PIL.Image.blend`.
245+
"""Blend images using constant transparency weight.
277246
278-
:rtype: :py:class:`~PIL.Image.Image`
247+
Alias for :py:func:`PIL.Image.blend`.
279248
"""
280249

281250
return Image.blend(image1, image2, alpha)
@@ -284,10 +253,9 @@ def blend(image1: Image.Image, image2: Image.Image, alpha: float) -> Image.Image
284253
def composite(
285254
image1: Image.Image, image2: Image.Image, mask: Image.Image
286255
) -> Image.Image:
287-
"""Create composite using transparency mask. Alias for
288-
:py:func:`PIL.Image.composite`.
256+
"""Create composite using transparency mask.
289257
290-
:rtype: :py:class:`~PIL.Image.Image`
258+
Alias for :py:func:`PIL.Image.composite`.
291259
"""
292260

293261
return Image.composite(image1, image2, mask)
@@ -302,7 +270,6 @@ def offset(image: Image.Image, xoffset: int, yoffset: int | None = None) -> Imag
302270
:param xoffset: The horizontal distance.
303271
:param yoffset: The vertical distance. If omitted, both
304272
distances are set to the same value.
305-
:rtype: :py:class:`~PIL.Image.Image`
306273
"""
307274

308275
if yoffset is None:

src/PIL/ImageEnhance.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ def enhance(self, factor: float) -> Image.Image:
3535
lower factors mean less color (brightness, contrast,
3636
etc), and higher values more. There are no restrictions
3737
on this value.
38-
:rtype: :py:class:`~PIL.Image.Image`
3938
"""
4039
return Image.blend(self.degenerate, self.image, factor)
4140

0 commit comments

Comments
 (0)