Skip to content

Commit 008b28e

Browse files
hugovkradarhere
andauthored
Add type hints
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
1 parent b6c755d commit 008b28e

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/PIL/Image.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ def size(self) -> tuple[int, int]:
524524
def mode(self):
525525
return self._mode
526526

527-
def _new(self, im: Image) -> Image:
527+
def _new(self, im: Image):
528528
new = Image()
529529
new.im = im
530530
new._mode = im.mode
@@ -1347,7 +1347,9 @@ def getbbox(self, *, alpha_only: bool = True) -> tuple[int, int, int, int]:
13471347
self.load()
13481348
return self.im.getbbox(alpha_only)
13491349

1350-
def getcolors(self, maxcolors: int = 256) -> list[tuple[int, int]] | None:
1350+
def getcolors(
1351+
self, maxcolors: int = 256
1352+
) -> list[tuple[int, int | tuple[int, ...]]] | None:
13511353
"""
13521354
Returns a list of colors used in this image.
13531355
@@ -1370,7 +1372,7 @@ def getcolors(self, maxcolors: int = 256) -> list[tuple[int, int]] | None:
13701372
return out
13711373
return self.im.getcolors(maxcolors)
13721374

1373-
def getdata(self, band: int | None = None) -> Image:
1375+
def getdata(self, band: int | None = None):
13741376
"""
13751377
Returns the contents of this image as a sequence object
13761378
containing pixel values. The sequence object is flattened, so
@@ -1393,7 +1395,7 @@ def getdata(self, band: int | None = None) -> Image:
13931395
return self.im.getband(band)
13941396
return self.im # could be abused
13951397

1396-
def getextrema(self) -> tuple[float, float] | tuple[tuple[float, float], ...]:
1398+
def getextrema(self) -> tuple[float, float] | tuple[tuple[int, int], ...]:
13971399
"""
13981400
Gets the minimum and maximum pixel values for each band in
13991401
the image.

0 commit comments

Comments
 (0)