Typing: Image.getextrema

This commit is contained in:
Eric Soroos 2018-01-03 12:33:49 +00:00
parent 9a0c10e10a
commit 2ce902a7f6

View File

@ -1292,9 +1292,16 @@ class Image(object):
self.load() self.load()
if self.im.bands > 1: 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): 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 tuple(extrema)
return self.im.getextrema() return self.im.getextrema()