Type annotations: Switch open/save BytesIO->BinaryIO.

This commit is contained in:
neiljp (Neil Pilgrim) 2017-08-20 19:56:16 -07:00 committed by Eric Soroos
parent 10e2908813
commit ab40a28c1c

View File

@ -25,12 +25,11 @@
#
if False:
from typing import Any, Text, Optional, Tuple, List, Sequence, Union, Callable, Dict
from typing import Any, Text, Optional, Tuple, List, Sequence, Union, Callable, Dict, BinaryIO
from PIL.aliases import *
# Just required for typing, or gradual module inclusion while adding annotation?
from io import BytesIO
import pathlib
# from . import ImagingPalette ## This will need a stub?
from . import ImagePalette
@ -1934,7 +1933,7 @@ class Image(object):
return self.transform((w, h), AFFINE, matrix, resample)
def save(self, fp, format=None, **params):
# type: (Union[Text, pathlib.Path, BytesIO], Optional[Text], **Any) -> None
# type: (Union[Text, pathlib.Path, BinaryIO], Optional[Text], **Any) -> None
"""
Saves this image under the given filename. If no format is
specified, the format to use is determined from the filename
@ -2615,7 +2614,7 @@ def _decompression_bomb_check(size):
def open(fp, mode="r"):
# type: (Union[Text, pathlib.Path, BytesIO], Text) -> Image
# type: (Union[Text, pathlib.Path, BinaryIO], Text) -> Image
"""
Opens and identifies the given image file.