mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-26 15:14:45 +03:00
Type annotations: Switch open/save BytesIO->BinaryIO.
This commit is contained in:
parent
10e2908813
commit
ab40a28c1c
|
@ -25,12 +25,11 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
if False:
|
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 *
|
from PIL.aliases import *
|
||||||
|
|
||||||
# Just required for typing, or gradual module inclusion while adding annotation?
|
# Just required for typing, or gradual module inclusion while adding annotation?
|
||||||
from io import BytesIO
|
|
||||||
import pathlib
|
import pathlib
|
||||||
# from . import ImagingPalette ## This will need a stub?
|
# from . import ImagingPalette ## This will need a stub?
|
||||||
from . import ImagePalette
|
from . import ImagePalette
|
||||||
|
@ -1934,7 +1933,7 @@ class Image(object):
|
||||||
return self.transform((w, h), AFFINE, matrix, resample)
|
return self.transform((w, h), AFFINE, matrix, resample)
|
||||||
|
|
||||||
def save(self, fp, format=None, **params):
|
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
|
Saves this image under the given filename. If no format is
|
||||||
specified, the format to use is determined from the filename
|
specified, the format to use is determined from the filename
|
||||||
|
@ -2615,7 +2614,7 @@ def _decompression_bomb_check(size):
|
||||||
|
|
||||||
|
|
||||||
def open(fp, mode="r"):
|
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.
|
Opens and identifies the given image file.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user