Type annotations: Add & use Extrema type alias.

This commit is contained in:
neiljp (Neil Pilgrim) 2017-08-19 11:04:28 -07:00
parent af87bfe1ef
commit 6d464c010b
2 changed files with 3 additions and 2 deletions

View File

@ -1262,7 +1262,7 @@ class Image(object):
return self.im # could be abused
def getextrema(self):
# type: () -> Tuple
# type: () -> Extrema
"""
Gets the the minimum and maximum pixel values for each band in
the image.
@ -1338,7 +1338,7 @@ class Image(object):
return [i8(c) for c in x], [i8(c) for c in y]
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
a list of pixel counts, one for each pixel value in the source

View File

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