mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-02 17:43:25 +08:00
Upgrade Pillow stubs for Pillow 8.3 (#5731)
* Upgrade Pillow stubs for Pillow 8.3 * stubtest: ignore PIL._tkinter_finder * Annotate TiffTags.py * Pillow: stubtest and various other fixes * Remove tkinter modules from stubtest_allowlist
This commit is contained in:
@@ -1 +1 @@
|
||||
version = "8.2"
|
||||
version = "8.3"
|
||||
|
||||
@@ -120,8 +120,7 @@ class Image:
|
||||
def __exit__(self, *args: Any) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
@property
|
||||
def __array_interface__(self) -> dict[str, Any]: ...
|
||||
def __array__(self) -> Any: ... # returns numpy.array()
|
||||
def __getstate__(self) -> _ImageState: ...
|
||||
def __setstate__(self, state: _ImageState) -> None: ...
|
||||
def tobytes(self, encoder_name: str = ..., *args) -> bytes: ...
|
||||
@@ -173,7 +172,7 @@ class Image:
|
||||
def resize(
|
||||
self,
|
||||
size: tuple[int, int],
|
||||
resample: _Resample = ...,
|
||||
resample: _Resample | None = ...,
|
||||
box: tuple[float, float, float, float] | None = ...,
|
||||
reducing_gap: float | None = ...,
|
||||
) -> Image: ...
|
||||
@@ -187,7 +186,15 @@ class Image:
|
||||
translate: tuple[float, float] | None = ...,
|
||||
fillcolor: _Color | None = ...,
|
||||
) -> Image: ...
|
||||
def save(self, fp: str | bytes | Path | _Writeable, format: str | None = ..., **params: Any) -> None: ...
|
||||
def save(
|
||||
self,
|
||||
fp: str | bytes | Path | _Writeable,
|
||||
format: str | None = ...,
|
||||
*,
|
||||
save_all: bool = ...,
|
||||
bitmap_format: Literal["bmp", "png"] = ..., # for ICO files
|
||||
**params: Any,
|
||||
) -> None: ...
|
||||
def seek(self, frame: int) -> None: ...
|
||||
def show(self, title: str | None = ..., command: str | None = ...) -> None: ...
|
||||
def split(self) -> Tuple[Image, ...]: ...
|
||||
|
||||
@@ -17,6 +17,7 @@ def colorize(
|
||||
whitepoint: int = ...,
|
||||
midpoint: int = ...,
|
||||
) -> Image: ...
|
||||
def contain(image: Image, size: _Size, method: _Resample = ...) -> Image: ...
|
||||
def pad(
|
||||
image: Image, size: _Size, method: _Resample = ..., color: Any | None = ..., centering: Iterable[float] = ...
|
||||
) -> Image: ...
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from typing import Any
|
||||
|
||||
from .Image import Image
|
||||
|
||||
class ImagePalette:
|
||||
mode: Any
|
||||
rawmode: Any
|
||||
@@ -11,7 +13,7 @@ class ImagePalette:
|
||||
def getdata(self): ...
|
||||
def tobytes(self) -> bytes: ...
|
||||
tostring = tobytes
|
||||
def getcolor(self, color: tuple[int, int, int]) -> int: ...
|
||||
def getcolor(self, color: tuple[int, int, int], image: Image | None = ...) -> int: ...
|
||||
def save(self, fp) -> None: ...
|
||||
|
||||
def raw(rawmode, data): ...
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
from typing import Any
|
||||
from _typeshed import SupportsWrite
|
||||
|
||||
from .Image import Image
|
||||
|
||||
class PSDraw:
|
||||
fp: Any
|
||||
def __init__(self, fp: Any | None = ...) -> None: ...
|
||||
isofont: Any
|
||||
def begin_document(self, id: Any | None = ...) -> None: ...
|
||||
fp: SupportsWrite[bytes]
|
||||
def __init__(self, fp: SupportsWrite[bytes] | None = ...) -> None: ...
|
||||
isofont: dict[bytes, int]
|
||||
def begin_document(self, id: object | None = ...) -> None: ...
|
||||
def end_document(self) -> None: ...
|
||||
def setfont(self, font: str, size: int) -> None: ...
|
||||
def line(self, xy0: tuple[int, int], xy1: tuple[int, int]) -> None: ...
|
||||
@@ -14,6 +14,6 @@ class PSDraw:
|
||||
def text(self, xy: tuple[int, int], text: str) -> None: ...
|
||||
def image(self, box: tuple[int, int, int, int], im: Image, dpi: float | None = ...) -> None: ...
|
||||
|
||||
EDROFF_PS: str
|
||||
VDI_PS: str
|
||||
ERROR_PS: str
|
||||
EDROFF_PS: bytes
|
||||
VDI_PS: bytes
|
||||
ERROR_PS: bytes
|
||||
|
||||
@@ -88,10 +88,13 @@ class IFDRational(Rational):
|
||||
__round__: Any
|
||||
|
||||
class ImageFileDirectory_v2(MutableMapping[int, Any]):
|
||||
group: int | None
|
||||
tagtype: dict[int, int]
|
||||
def __init__(self, ifh: bytes = ..., prefix: Any | None = ...) -> None: ...
|
||||
prefix: Any
|
||||
offset: Any
|
||||
def __init__(self, ifh: bytes = ..., prefix: bytes | None = ..., group: int | None = ...) -> None: ...
|
||||
@property
|
||||
def prefix(self) -> bytes: ...
|
||||
@property
|
||||
def offset(self) -> int | None: ...
|
||||
@property
|
||||
def legacy_api(self) -> bool: ...
|
||||
def reset(self) -> None: ...
|
||||
|
||||
@@ -1,27 +1,45 @@
|
||||
from typing import Any
|
||||
from typing import Any, Dict, NamedTuple, Tuple, Union
|
||||
from typing_extensions import Literal
|
||||
|
||||
class TagInfo:
|
||||
class _TagInfo(NamedTuple):
|
||||
value: Any
|
||||
name: str
|
||||
type: _TagType
|
||||
length: int
|
||||
enum: dict[str, int]
|
||||
|
||||
class TagInfo(_TagInfo):
|
||||
def __new__(
|
||||
cls, value: Any | None = ..., name: str = ..., type: Any | None = ..., length: Any | None = ..., enum: Any | None = ...
|
||||
cls,
|
||||
value: Any | None = ...,
|
||||
name: str = ...,
|
||||
type: _TagType | None = ...,
|
||||
length: int | None = ...,
|
||||
enum: dict[str, int] | None = ...,
|
||||
): ...
|
||||
def cvt_enum(self, value): ...
|
||||
|
||||
def lookup(tag): ...
|
||||
def lookup(tag: int, group: int | None = ...) -> _TagInfo: ...
|
||||
|
||||
BYTE: int
|
||||
ASCII: int
|
||||
SHORT: int
|
||||
LONG: int
|
||||
RATIONAL: int
|
||||
SIGNED_BYTE: int
|
||||
UNDEFINED: int
|
||||
SIGNED_SHORT: int
|
||||
SIGNED_LONG: int
|
||||
SIGNED_RATIONAL: int
|
||||
FLOAT: int
|
||||
DOUBLE: int
|
||||
IFD: int
|
||||
TAGS_V2: Any
|
||||
TAGS: Any
|
||||
TYPES: Any
|
||||
LIBTIFF_CORE: Any
|
||||
BYTE: Literal[1]
|
||||
ASCII: Literal[2]
|
||||
SHORT: Literal[3]
|
||||
LONG: Literal[4]
|
||||
RATIONAL: Literal[5]
|
||||
SIGNED_BYTE: Literal[6]
|
||||
UNDEFINED: Literal[7]
|
||||
SIGNED_SHORT: Literal[8]
|
||||
SIGNED_LONG: Literal[9]
|
||||
SIGNED_RATIONAL: Literal[10]
|
||||
FLOAT: Literal[11]
|
||||
DOUBLE: Literal[12]
|
||||
IFD: Literal[13]
|
||||
|
||||
_TagType = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
|
||||
_TagTuple = Union[Tuple[str, _TagType, int], Tuple[str, _TagInfo, int, Dict[str, int]]]
|
||||
|
||||
TAGS_V2: dict[int, _TagTuple]
|
||||
TAGS_V2_GROUPS: dict[int, dict[int, _TagTuple]]
|
||||
TAGS: dict[int, str]
|
||||
TYPES: dict[int, str]
|
||||
LIBTIFF_CORE: set[int]
|
||||
|
||||
Reference in New Issue
Block a user