From 2ce902a7f6a51eba5ca6fefe33cc130f1f8d948f Mon Sep 17 00:00:00 2001 From: Eric Soroos Date: Wed, 3 Jan 2018 12:33:49 +0000 Subject: [PATCH] Typing: Image.getextrema --- src/PIL/Image.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/PIL/Image.py b/src/PIL/Image.py index 66ec7e2ff..c87be3727 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -1292,9 +1292,16 @@ class Image(object): self.load() if self.im.bands > 1: - extrema = [] + extrema = [] # type: List[Tuple[int,int]] + # UNDONE typing: + # We know that the extrema here is List[Tuple[int,int]] + # but the method sig of getextrema mentions a float, but + # we know that if it's a multiband image, it's got to be + # int. Single band images could be either. + # We could cast, but that's not going to work with py27 or + # py34 for i in range(self.im.bands): - extrema.append(self.im.getband(i).getextrema()) + extrema.append(self.im.getband(i).getextrema()) # type: ignore return tuple(extrema) return self.im.getextrema()