Lint fixes

This commit is contained in:
Andrew Murray 2019-02-15 23:25:56 +11:00
parent 45752d2a28
commit 14e7f8a6ed
8 changed files with 84 additions and 77 deletions

View File

@ -34,7 +34,7 @@ if False:
from . import ImagePalette from . import ImagePalette
from .ImageFilter import Filter from .ImageFilter import Filter
from .ImageFile import PyDecoder from .ImageFile import PyDecoder
PyEncoder = Any ## FIXME TYPING: PyEncoder is not defined anywhere? Needs stub/class? PyEncoder = Any # FIXME TYPING: PyEncoder is not defined anywhere? Needs stub/class?
from ._imaging import ImagingCore from ._imaging import ImagingCore
from . import PyAccess, ImageFile from . import PyAccess, ImageFile
@ -2344,7 +2344,8 @@ class Image(object):
def __transformer(self, box, image, method, data, def __transformer(self, box, image, method, data,
resample=NEAREST, fill=1): resample=NEAREST, fill=1):
# type: (LURD, Image, int, Any, int, Any) -> None # FIXME TYPING: What are Any here? # type: (LURD, Image, int, Any, int, Any) -> None
# FIXME TYPING: What are Any here?
w = box[2] - box[0] w = box[2] - box[0]
h = box[3] - box[1] h = box[3] - box[1]
@ -2443,6 +2444,7 @@ class ImagePointHandler(object):
# type (T) -> T # type (T) -> T
return s return s
class ImageTransformHandler(object): class ImageTransformHandler(object):
# used as a mixin by geometry transforms (for use with im.transform) # used as a mixin by geometry transforms (for use with im.transform)
pass pass

View File

@ -121,8 +121,8 @@ class ImageFile(Image.Image):
if sys.version_info >= (3, 4, 0): if sys.version_info >= (3, 4, 0):
def __del__(self): def __del__(self):
# type: () -> None # type: () -> None
if (hasattr(self, 'fp') and hasattr(self, '_exclusive_fp') if hasattr(self, 'fp') and hasattr(self, '_exclusive_fp') and \
and self.fp and self._exclusive_fp): self.fp and self._exclusive_fp:
self.fp.close() self.fp.close()
self.fp = None self.fp = None

View File

@ -29,6 +29,7 @@ class Filter(object):
def filter(self, image): def filter(self, image):
return image.im return image.im
class MultibandFilter(Filter): class MultibandFilter(Filter):
pass pass

View File

@ -22,6 +22,7 @@ from collections import namedtuple
if False: if False:
from typing import Dict, List, Text from typing import Dict, List, Text
class TagInfo(namedtuple("_TagInfo", "value name type length enum")): class TagInfo(namedtuple("_TagInfo", "value name type length enum")):
__slots__ = [] # type: List[Text] __slots__ = [] # type: List[Text]

View File

@ -7,17 +7,20 @@ XY = Tuple[int, int]
Coord = XY Coord = XY
Size = XY # NOTE: All XY aliases will be interchangeable 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
SingleChannelExtrema = Union[Tuple[float, float], Tuple[int, int]] SingleChannelExtrema = Union[Tuple[float, float], Tuple[int, int]]
MultiChannelExtrema = SingleChannelExtrema # Note: currently only a Tuple[int,int] MultiChannelExtrema = SingleChannelExtrema # Note: currently only a Tuple[int,int]
Extrema = Union[SingleChannelExtrema, Tuple[MultiChannelExtrema, ...]] Extrema = Union[SingleChannelExtrema, Tuple[MultiChannelExtrema, ...]]
Color = Union[int, float, Tuple[int, int], Tuple[int, int, int], Tuple[int, int, int, int]] Color = Union[int, float, Tuple[int, int], Tuple[int, int, int],
Tuple[int, int, int, int]]
ArrayInterfaceStruct = Dict[unicode, Any] ArrayInterfaceStruct = Dict[unicode, Any]
class SupportsArrayInterface(Protocol): class SupportsArrayInterface(Protocol):
@abstractproperty @abstractproperty
def __array_interface__(self): def __array_interface__(self):