Type annotations: Add & use Extrema type alias.

This commit is contained in:
neiljp (Neil Pilgrim) 2017-08-19 11:04:28 -07:00 committed by Eric Soroos
parent 9625b7957e
commit 850e28a02f
2 changed files with 3 additions and 2 deletions

View File

@ -8,4 +8,5 @@ Size = XY # NOTE: All XY aliases will be interchangeable
Matrix4 = Tuple[float, float, float, float] Matrix4 = Tuple[float, float, float, float]
Matrix12 = Tuple[float, float, float, float, float, float, float, float, float, float, float, float] Matrix12 = Tuple[float, float, float, float, float, float, float, float, float, float, float, float]
Mode = str Mode = str
Extrema = Union[Tuple[Any, Any], Tuple[Tuple[Any, Any], ...]] # Any -> float?

View File

@ -1283,7 +1283,7 @@ class Image(object):
return self.im # could be abused return self.im # could be abused
def getextrema(self): def getextrema(self):
# type: () -> Tuple # type: () -> Extrema
""" """
Gets the the minimum and maximum pixel values for each band in Gets the the minimum and maximum pixel values for each band in
the image. the image.
@ -1359,7 +1359,7 @@ class Image(object):
return [i8(c) for c in x], [i8(c) for c in y] return [i8(c) for c in x], [i8(c) for c in y]
def histogram(self, mask=None, extrema=None): def histogram(self, mask=None, extrema=None):
# type: (Optional[Image], Optional[Any]) -> List[int] # type: (Optional[Image], Optional[Extrema]) -> List[int]
""" """
Returns a histogram for the image. The histogram is returned as Returns a histogram for the image. The histogram is returned as
a list of pixel counts, one for each pixel value in the source a list of pixel counts, one for each pixel value in the source