Bump Pillow to 9.4 (#9453)

Closes #9448
This commit is contained in:
Avasam
2023-01-04 17:38:41 -05:00
committed by GitHub
parent 70025c3723
commit 7fdbb7228c
9 changed files with 107 additions and 53 deletions

View File

@@ -3,4 +3,3 @@ PIL.ImageQt.ImageQt
PIL.ImageQt.QImage # Does exist at runtime usually, but stubtest can't see it
PIL.ImageQt.QPixmap # Does exist at runtime usually, but stubtest can't see it
PIL.MicImagePlugin
PIL.WmfImagePlugin.WmfHandler

View File

@@ -1 +1 @@
version = "9.3.*"
version = "9.4.*"

View File

@@ -1,4 +1,42 @@
from collections.abc import Mapping
from enum import IntEnum
TAGS: Mapping[int, str]
GPSTAGS: Mapping[int, str]
class Interop(IntEnum):
InteropIndex: int
InteropVersion: int
RelatedImageFileFormat: int
RelatedImageWidth: int
RleatedImageHeight: int
class IFD(IntEnum):
Exif: int
GPSInfo: int
Makernote: int
Interop: int
IFD1: int
class LightSource(IntEnum):
Unknown: int
Daylight: int
Fluorescent: int
Tungsten: int
Flash: int
Fine: int
Cloudy: int
Shade: int
DaylightFluorescent: int
DayWhiteFluorescent: int
CoolWhiteFluorescent: int
WhiteFluorescent: int
StandardLightA: int
StandardLightB: int
StandardLightC: int
D55: int
D65: int
D75: int
D50: int
ISO: int
Other: int

View File

@@ -1,10 +1,12 @@
from _typeshed import Self, SupportsRead, SupportsWrite
from _typeshed import Incomplete, Self, SupportsRead, SupportsWrite
from collections.abc import Callable, Iterable, Iterator, MutableMapping, Sequence
from enum import IntEnum
from pathlib import Path
from typing import Any, ClassVar, Protocol, SupportsBytes, Union
from typing_extensions import Literal, TypeAlias
from PIL.PyAccess import PyAccess
from ._imaging import (
DEFAULT_STRATEGY as DEFAULT_STRATEGY,
FILTERED as FILTERED,
@@ -31,53 +33,18 @@ _Color: TypeAlias = Union[int, tuple[int], tuple[int, int, int], tuple[int, int,
class _Writeable(SupportsWrite[bytes], Protocol):
def seek(self, __offset: int) -> Any: ...
# obsolete
NORMAL: Literal[0]
SEQUENCE: Literal[1]
CONTAINER: Literal[2]
NORMAL: Literal[0] # deprecated
SEQUENCE: Literal[1] # deprecated
CONTAINER: Literal[2] # deprecated
class DecompressionBombWarning(RuntimeWarning): ...
class DecompressionBombError(Exception): ...
MAX_IMAGE_PIXELS: int | None
NONE: Literal[0]
FLIP_LEFT_RIGHT: Literal[0]
FLIP_TOP_BOTTOM: Literal[1]
ROTATE_90: Literal[2]
ROTATE_180: Literal[3]
ROTATE_270: Literal[4]
TRANSPOSE: Literal[5]
TRANSVERSE: Literal[6]
AFFINE: Literal[0]
EXTENT: Literal[1]
PERSPECTIVE: Literal[2]
QUAD: Literal[3]
MESH: Literal[4]
NEAREST: Literal[0]
BOX: Literal[4]
BILINEAR: Literal[2]
LINEAR: Literal[2]
HAMMING: Literal[5]
BICUBIC: Literal[3]
CUBIC: Literal[3]
LANCZOS: Literal[1]
ANTIALIAS: Literal[1]
ORDERED: Literal[1]
RASTERIZE: Literal[2]
FLOYDSTEINBERG: Literal[3]
WEB: Literal[0]
ADAPTIVE: Literal[1]
MEDIANCUT: Literal[0]
MAXCOVERAGE: Literal[1]
FASTOCTREE: Literal[2]
LIBIMAGEQUANT: Literal[3]
LINEAR: Literal[2] # deprecated
CUBIC: Literal[3] # deprecated
ANTIALIAS: Literal[1] # deprecated
class Transpose(IntEnum):
FLIP_LEFT_RIGHT: Literal[0]
@@ -88,6 +55,15 @@ class Transpose(IntEnum):
TRANSPOSE: Literal[5]
TRANSVERSE: Literal[6]
# All Transpose items
FLIP_LEFT_RIGHT: Literal[0]
FLIP_TOP_BOTTOM: Literal[1]
ROTATE_90: Literal[2]
ROTATE_180: Literal[3]
ROTATE_270: Literal[4]
TRANSPOSE: Literal[5]
TRANSVERSE: Literal[6]
class Transform(IntEnum):
AFFINE: Literal[0]
EXTENT: Literal[1]
@@ -95,6 +71,13 @@ class Transform(IntEnum):
QUAD: Literal[3]
MESH: Literal[4]
# All Transform items
AFFINE: Literal[0]
EXTENT: Literal[1]
PERSPECTIVE: Literal[2]
QUAD: Literal[3]
MESH: Literal[4]
class Resampling(IntEnum):
NEAREST: Literal[0]
LANCZOS: Literal[1]
@@ -103,22 +86,46 @@ class Resampling(IntEnum):
BOX: Literal[4]
HAMMING: Literal[5]
# All Resampling items
NEAREST: Literal[0]
LANCZOS: Literal[1]
BILINEAR: Literal[2]
BICUBIC: Literal[3]
BOX: Literal[4]
HAMMING: Literal[5]
class Dither(IntEnum):
NONE: Literal[0]
ORDERED: Literal[1]
RASTERIZE: Literal[2]
FLOYDSTEINBERG: Literal[3]
# All Dither items
NONE: Literal[0]
ORDERED: Literal[1]
RASTERIZE: Literal[2]
FLOYDSTEINBERG: Literal[3]
class Palette(IntEnum):
WEB: Literal[0]
ADAPTIVE: Literal[1]
# All Palette items
WEB: Literal[0]
ADAPTIVE: Literal[1]
class Quantize(IntEnum):
MEDIANCUT: Literal[0]
MAXCOVERAGE: Literal[1]
FASTOCTREE: Literal[2]
LIBIMAGEQUANT: Literal[3]
# All Quantize items
MEDIANCUT: Literal[0]
MAXCOVERAGE: Literal[1]
FASTOCTREE: Literal[2]
LIBIMAGEQUANT: Literal[3]
ID: list[str]
OPEN: dict[str, Any]
MIME: dict[str, str]
@@ -153,9 +160,11 @@ class Image:
palette: Any
info: dict[Any, Any]
readonly: int
pyaccess: Any
pyaccess: PyAccess | None
is_animated: bool # not present on all Image objects
n_frames: int # not present on all Image objects
# Only defined after a call to save().
encoderconfig: tuple[Incomplete, ...]
@property
def width(self) -> int: ...
@property
@@ -200,6 +209,7 @@ class Image:
def getdata(self, band: int | None = ...): ...
def getextrema(self): ...
def getexif(self) -> Exif: ...
def get_child_images(self) -> list[Image]: ...
def getim(self): ...
def getpalette(self, rawmode: str | None = ...) -> list[int] | None: ...
def getpixel(self, xy: tuple[int, int]): ...
@@ -296,6 +306,7 @@ class Exif(MutableMapping[int, Any]):
def load(self, data: bytes) -> None: ...
def tobytes(self, offset: int = ...) -> bytes: ...
def get_ifd(self, tag: int): ...
def hide_offsets(self) -> None: ...
def __len__(self) -> int: ...
def __getitem__(self, tag: int) -> Any: ...
def __contains__(self, tag: object) -> bool: ...

View File

@@ -1,4 +1,4 @@
from _typeshed import Self
from _typeshed import Incomplete, Self
from typing import Any, NoReturn
from .Image import Image
@@ -12,7 +12,7 @@ def raise_oserror(error) -> NoReturn: ...
class ImageFile(Image):
custom_mimetype: Any
tile: Any
tile: list[Incomplete] | None
readonly: int
decoderconfig: Any
decodermaxblock: Any

View File

@@ -74,6 +74,7 @@ class FreeTypeFont:
stroke_width: float = ...,
anchor: str | None = ...,
ink=...,
start: tuple[float, float] | None = ...,
): ...
def getmask2(
self,
@@ -86,6 +87,7 @@ class FreeTypeFont:
stroke_width: float = ...,
anchor: str | None = ...,
ink=...,
start: tuple[float, float] | None = ...,
*args,
**kwargs,
): ...

View File

@@ -109,7 +109,7 @@ class ImageFileDirectory_v2(MutableMapping[int, Any]):
def load_byte(self, data, legacy_api: bool = ...): ...
def write_byte(self, data): ...
def load_string(self, data, legacy_api: bool = ...): ...
def write_string(self, value): ...
def write_string(self, value: int | str | bytes) -> bytes: ...
def load_rational(self, data, legacy_api: bool = ...): ...
def write_rational(self, *values): ...
def load_undefined(self, data, legacy_api: bool = ...): ...

View File

@@ -1,13 +1,15 @@
from typing import Any, ClassVar
from typing_extensions import Literal
from typing_extensions import Literal, TypeAlias
from .ImageFile import ImageFile
SUPPORTED: bool
_XMP_Tags: TypeAlias = dict[str, str | _XMP_Tags]
class WebPImageFile(ImageFile):
format: ClassVar[Literal["WEBP"]]
format_description: ClassVar[str]
def getxmp(self) -> _XMP_Tags: ...
def seek(self, frame) -> None: ...
fp: Any
tile: Any

View File

@@ -1,3 +1,4 @@
import sys
from typing import Any, ClassVar
from typing_extensions import Literal
@@ -5,10 +6,11 @@ from .ImageFile import StubImageFile
def register_handler(handler) -> None: ...
class WmfHandler:
bbox: Any
def open(self, im) -> None: ...
def load(self, im): ...
if sys.platform == "win32":
class WmfHandler:
bbox: Any
def open(self, im) -> None: ...
def load(self, im): ...
class WmfStubImageFile(StubImageFile):
format: ClassVar[Literal["WMF"]]