mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-11 04:01:29 +08:00
Bump Pillow to 10.0.* (#10411)
This commit is contained in:
@@ -27,3 +27,9 @@ PIL.XVThumbImagePlugin.r
|
||||
|
||||
# Forwarded arguments
|
||||
PIL\.TiffImagePlugin\.IFDRational\.__[a-z]+__
|
||||
|
||||
# Already removed in the 10.0.x branch, but still present in 10.0.0
|
||||
PIL.Image.MEDIANCUT
|
||||
PIL.Image.MAXCOVERAGE
|
||||
PIL.Image.FASTOCTREE
|
||||
PIL.Image.LIBIMAGEQUANT
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
version = "9.5.*"
|
||||
version = "10.0.*"
|
||||
partial_stub = true
|
||||
|
||||
[tool.stubtest]
|
||||
|
||||
@@ -8,26 +8,16 @@ from .ImageFile import ImageFile, PyDecoder, PyEncoder
|
||||
class Format(IntEnum):
|
||||
JPEG: int
|
||||
|
||||
BLP_FORMAT_JPEG: Literal[Format.JPEG]
|
||||
|
||||
class Encoding(IntEnum):
|
||||
UNCOMPRESSED: int
|
||||
DXT: int
|
||||
UNCOMPRESSED_RAW_BGRA: int
|
||||
|
||||
BLP_ENCODING_UNCOMPRESSED: Literal[Encoding.UNCOMPRESSED]
|
||||
BLP_ENCODING_DXT: Literal[Encoding.DXT]
|
||||
BLP_ENCODING_UNCOMPRESSED_RAW_BGRA: Literal[Encoding.UNCOMPRESSED_RAW_BGRA]
|
||||
|
||||
class AlphaEncoding(IntEnum):
|
||||
DXT1: int
|
||||
DXT3: int
|
||||
DXT5: int
|
||||
|
||||
BLP_ALPHA_ENCODING_DXT1: Literal[AlphaEncoding.DXT1]
|
||||
BLP_ALPHA_ENCODING_DXT3: Literal[AlphaEncoding.DXT3]
|
||||
BLP_ALPHA_ENCODING_DXT5: Literal[AlphaEncoding.DXT5]
|
||||
|
||||
def unpack_565(i): ...
|
||||
def decode_dxt1(data, alpha: bool = False): ...
|
||||
def decode_dxt3(data): ...
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
from typing import ClassVar
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .ImageFile import StubImageFile
|
||||
|
||||
def register_handler(handler) -> None: ...
|
||||
|
||||
class FITSStubImageFile(StubImageFile):
|
||||
format: ClassVar[Literal["FITS"]]
|
||||
format_description: ClassVar[str]
|
||||
@@ -10,9 +10,6 @@ class Format(IntEnum):
|
||||
DXT1: int
|
||||
UNCOMPRESSED: int
|
||||
|
||||
FORMAT_DXT1: Literal[Format.DXT1]
|
||||
FORMAT_UNCOMPRESSED: Literal[Format.UNCOMPRESSED]
|
||||
|
||||
class FtexImageFile(ImageFile):
|
||||
format: ClassVar[Literal["FTEX"]]
|
||||
format_description: ClassVar[str]
|
||||
|
||||
@@ -3,7 +3,7 @@ from collections.abc import Callable, Iterable, Iterator, MutableMapping, Sequen
|
||||
from enum import IntEnum
|
||||
from pathlib import Path
|
||||
from typing import Any, ClassVar, Protocol, SupportsBytes
|
||||
from typing_extensions import Literal, Self, TypeAlias
|
||||
from typing_extensions import Final, Literal, Self, TypeAlias, TypeGuard
|
||||
|
||||
from PIL.PyAccess import PyAccess
|
||||
|
||||
@@ -36,21 +36,14 @@ _Color: TypeAlias = (
|
||||
class _Writeable(SupportsWrite[bytes], Protocol):
|
||||
def seek(self, __offset: int) -> Any: ...
|
||||
|
||||
NORMAL: Literal[0] # deprecated
|
||||
SEQUENCE: Literal[1] # deprecated
|
||||
CONTAINER: Literal[2] # deprecated
|
||||
|
||||
class DecompressionBombWarning(RuntimeWarning): ...
|
||||
class DecompressionBombError(Exception): ...
|
||||
|
||||
MAX_IMAGE_PIXELS: int | None
|
||||
USE_CFFI_ACCESS: Incomplete
|
||||
MAX_IMAGE_PIXELS: Final[int]
|
||||
|
||||
LINEAR: Literal[Resampling.BILINEAR] # deprecated
|
||||
CUBIC: Literal[Resampling.BICUBIC] # deprecated
|
||||
ANTIALIAS: Literal[Resampling.LANCZOS] # deprecated
|
||||
USE_CFFI_ACCESS: bool
|
||||
|
||||
def isImageType(t): ...
|
||||
def isImageType(t: object) -> TypeGuard[Image]: ...
|
||||
|
||||
class Transpose(IntEnum):
|
||||
FLIP_LEFT_RIGHT: Literal[0]
|
||||
@@ -126,12 +119,6 @@ class Quantize(IntEnum):
|
||||
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]
|
||||
@@ -149,20 +136,19 @@ def getmodebandnames(mode: _Mode) -> tuple[str, ...]: ...
|
||||
def getmodebands(mode: _Mode) -> int: ...
|
||||
def preinit() -> None: ...
|
||||
def init() -> None: ...
|
||||
def coerce_e(value) -> _E: ...
|
||||
|
||||
class _E:
|
||||
scale: Incomplete
|
||||
data: Incomplete
|
||||
def __init__(self, scale, data) -> None: ...
|
||||
def __neg__(self): ...
|
||||
offset: Incomplete
|
||||
def __init__(self, scale, offset) -> None: ...
|
||||
def __neg__(self) -> _E: ...
|
||||
def __add__(self, other) -> _E: ...
|
||||
__radd__ = __add__
|
||||
def __sub__(self, other): ...
|
||||
def __rsub__(self, other): ...
|
||||
def __mul__(self, other) -> _E: ...
|
||||
__rmul__ = __mul__
|
||||
def __truediv__(self, other): ...
|
||||
def __truediv__(self, other) -> _E: ...
|
||||
|
||||
_ImageState: TypeAlias = tuple[dict[str, Any], str, tuple[int, int], Any, bytes]
|
||||
|
||||
@@ -220,7 +206,7 @@ class Image:
|
||||
def draft(self, mode: _Mode, size: _Size) -> None: ...
|
||||
def filter(self, filter: Filter | Callable[[], Filter]) -> Image: ...
|
||||
def getbands(self) -> tuple[str, ...]: ...
|
||||
def getbbox(self) -> tuple[int, int, int, int] | None: ...
|
||||
def getbbox(self, *, alpha_only: bool = True) -> tuple[int, int, int, int] | None: ...
|
||||
def getcolors(self, maxcolors: int = 256) -> list[tuple[int, int]]: ...
|
||||
def getdata(self, band: int | None = None): ...
|
||||
def getextrema(self): ...
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import sys
|
||||
from _typeshed import Incomplete, Unused
|
||||
from enum import IntEnum
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .Image import ImagePointHandler
|
||||
|
||||
@@ -15,20 +14,11 @@ class Intent(IntEnum):
|
||||
SATURATION: int
|
||||
ABSOLUTE_COLORIMETRIC: int
|
||||
|
||||
INTENT_PERCEPTUAL: Literal[Intent.PERCEPTUAL]
|
||||
INTENT_RELATIVE_COLORIMETRIC: Literal[Intent.RELATIVE_COLORIMETRIC]
|
||||
INTENT_SATURATION: Literal[Intent.SATURATION]
|
||||
INTENT_ABSOLUTE_COLORIMETRIC: Literal[Intent.ABSOLUTE_COLORIMETRIC]
|
||||
|
||||
class Direction(IntEnum):
|
||||
INPUT: int
|
||||
OUTPUT: int
|
||||
PROOF: int
|
||||
|
||||
DIRECTION_INPUT: Literal[Direction.INPUT]
|
||||
DIRECTION_OUTPUT: Literal[Direction.OUTPUT]
|
||||
DIRECTION_PROOF: Literal[Direction.PROOF]
|
||||
|
||||
FLAGS: Incomplete
|
||||
|
||||
class ImageCmsProfile:
|
||||
|
||||
@@ -47,6 +47,7 @@ class ImageDraw:
|
||||
rotation: float = 0,
|
||||
fill: _Ink | None = None,
|
||||
outline: _Ink | None = None,
|
||||
width: float = 1,
|
||||
) -> None: ...
|
||||
def rectangle(
|
||||
self,
|
||||
@@ -99,26 +100,6 @@ class ImageDraw:
|
||||
stroke_fill: _Ink | None = None,
|
||||
embedded_color: bool = False,
|
||||
) -> None: ...
|
||||
def textsize(
|
||||
self,
|
||||
text: str | bytes,
|
||||
font: _Font | None = None,
|
||||
spacing: float = 4,
|
||||
direction: Literal["rtl", "ltr", "ttb"] | None = None,
|
||||
features: Sequence[str] | None = None,
|
||||
language: str | None = None,
|
||||
stroke_width: int = 0,
|
||||
) -> tuple[int, int]: ...
|
||||
def multiline_textsize(
|
||||
self,
|
||||
text: str | bytes,
|
||||
font: _Font | None = None,
|
||||
spacing: float = 4,
|
||||
direction: Literal["rtl", "ltr", "ttb"] | None = None,
|
||||
features: Sequence[str] | None = None,
|
||||
language: str | None = None,
|
||||
stroke_width: int = 0,
|
||||
) -> tuple[int, int]: ...
|
||||
def textlength(
|
||||
self,
|
||||
text: str | bytes,
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
from _typeshed import Incomplete
|
||||
|
||||
from .Image import Image
|
||||
from .ImageDraw import ImageDraw
|
||||
|
||||
class Pen:
|
||||
color: Incomplete
|
||||
width: Incomplete
|
||||
@@ -15,11 +18,11 @@ class Font:
|
||||
def __init__(self, color, file, size: int = 12) -> None: ...
|
||||
|
||||
class Draw:
|
||||
draw: Incomplete
|
||||
image: Incomplete
|
||||
transform: Incomplete
|
||||
draw: ImageDraw
|
||||
image: Image
|
||||
transform: Incomplete | None
|
||||
def __init__(self, image, size: Incomplete | None = None, color: Incomplete | None = None) -> None: ...
|
||||
def flush(self): ...
|
||||
def flush(self) -> Image: ...
|
||||
def render(self, op, xy, pen, brush: Incomplete | None = None) -> None: ...
|
||||
def settransform(self, offset) -> None: ...
|
||||
def arc(self, xy, start, end, *options) -> None: ...
|
||||
@@ -30,6 +33,5 @@ class Draw:
|
||||
def polygon(self, xy, *options) -> None: ...
|
||||
def rectangle(self, xy, *options) -> None: ...
|
||||
def text(self, xy, text, font) -> None: ...
|
||||
def textsize(self, text, font): ...
|
||||
def textbbox(self, xy, text, font): ...
|
||||
def textlength(self, text, font): ...
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
from _typeshed import FileDescriptorOrPath, Incomplete, SupportsRead
|
||||
from enum import IntEnum
|
||||
from typing import Protocol
|
||||
from typing_extensions import Literal
|
||||
from typing_extensions import Final, Literal
|
||||
|
||||
from PIL.Image import Transpose
|
||||
|
||||
class Layout(IntEnum):
|
||||
BASIC: Literal[0]
|
||||
RAQM: Literal[1]
|
||||
|
||||
LAYOUT_BASIC: Literal[Layout.BASIC]
|
||||
LAYOUT_RAQM: Literal[Layout.RAQM]
|
||||
MAX_STRING_LENGTH: Final[int] = 1_000_000
|
||||
|
||||
class _Font(Protocol):
|
||||
def getmask(self, text: str | bytes, mode: str = ..., direction=..., features=...): ...
|
||||
|
||||
class ImageFont:
|
||||
def getsize(self, text: str | bytes, *args, **kwargs) -> tuple[int, int]: ...
|
||||
def getmask(self, text: str | bytes, mode: str = "", direction=..., features=...): ...
|
||||
def getbbox(self, text, *args, **kwargs): ...
|
||||
def getlength(self, text, *args, **kwargs): ...
|
||||
@@ -25,7 +25,7 @@ class FreeTypeFont:
|
||||
index: int
|
||||
encoding: str
|
||||
layout_engine: Layout
|
||||
font_bytes: Incomplete
|
||||
font_bytes: bytes # Only exists under some circumstances.
|
||||
font: Incomplete
|
||||
def __init__(
|
||||
self,
|
||||
@@ -55,24 +55,6 @@ class FreeTypeFont:
|
||||
stroke_width: int = 0,
|
||||
anchor: str | None = None,
|
||||
) -> tuple[int, int, int, int]: ...
|
||||
def getsize(
|
||||
self,
|
||||
text: str | bytes,
|
||||
direction: Literal["ltr", "rtl", "ttb"] | None = None,
|
||||
features: Incomplete | None = None,
|
||||
language: str | None = None,
|
||||
stroke_width: int = 0,
|
||||
) -> tuple[int, int]: ...
|
||||
def getsize_multiline(
|
||||
self,
|
||||
text: str | bytes,
|
||||
direction: Literal["ltr", "rtl", "ttb"] | None = None,
|
||||
spacing: float = 4,
|
||||
features: Incomplete | None = None,
|
||||
language: str | None = None,
|
||||
stroke_width: float = 0,
|
||||
) -> tuple[int, int]: ...
|
||||
def getoffset(self, text: str | bytes) -> tuple[int, int]: ...
|
||||
def getmask(
|
||||
self,
|
||||
text: str | bytes,
|
||||
@@ -89,7 +71,6 @@ class FreeTypeFont:
|
||||
self,
|
||||
text: str | bytes,
|
||||
mode: str = "",
|
||||
fill=...,
|
||||
direction: Literal["ltr", "rtl", "ttb"] | None = None,
|
||||
features: Incomplete | None = None,
|
||||
language: str | None = None,
|
||||
@@ -114,10 +95,9 @@ class FreeTypeFont:
|
||||
def set_variation_by_axes(self, axes): ...
|
||||
|
||||
class TransposedFont:
|
||||
font: Incomplete
|
||||
orientation: Incomplete
|
||||
def __init__(self, font: _Font, orientation: int | None = None) -> None: ...
|
||||
def getsize(self, text: str | bytes, *args, **kwargs) -> tuple[int, int]: ...
|
||||
font: _Font
|
||||
orientation: Transpose | None
|
||||
def __init__(self, font: _Font, orientation: Transpose | None = None) -> None: ...
|
||||
def getmask(self, text: str | bytes, mode: str = "", *args, **kwargs): ...
|
||||
def getbbox(self, text, *args, **kwargs): ...
|
||||
def getlength(self, text, *args, **kwargs): ...
|
||||
|
||||
@@ -45,4 +45,4 @@ def invert(image: Image) -> Image: ...
|
||||
def mirror(image: Image) -> Image: ...
|
||||
def posterize(image: Image, bits: int) -> Image: ...
|
||||
def solarize(image: Image, threshold: int = 128) -> Image: ...
|
||||
def exif_transpose(image: Image) -> Image: ...
|
||||
def exif_transpose(image: Image, *, in_place: bool = False) -> Image: ...
|
||||
|
||||
@@ -8,7 +8,7 @@ class ImagePalette:
|
||||
palette: Incomplete
|
||||
colors: Incomplete
|
||||
dirty: Incomplete
|
||||
def __init__(self, mode: str = "RGB", palette: Incomplete | None = None, size: int = 0) -> None: ...
|
||||
def __init__(self, mode: str = "RGB", palette: Incomplete | None = None) -> None: ...
|
||||
def copy(self) -> ImagePalette: ...
|
||||
def getdata(self): ...
|
||||
def tobytes(self) -> bytes: ...
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from _typeshed import Incomplete
|
||||
from _typeshed import Incomplete, Unused
|
||||
from typing import Any
|
||||
from typing_extensions import Literal
|
||||
|
||||
def register(viewer, order: int = 1) -> None: ...
|
||||
@@ -9,42 +10,50 @@ class Viewer:
|
||||
format: Incomplete
|
||||
options: Incomplete
|
||||
def get_format(self, image): ...
|
||||
def get_command(self, file, **options) -> None: ...
|
||||
# Abstract method
|
||||
def get_command(self, file: str, **options: Any) -> str: ...
|
||||
def save_image(self, image): ...
|
||||
def show_image(self, image, **options): ...
|
||||
def show_file(self, path: Incomplete | None = None, **options): ...
|
||||
def show_file(self, path: str, **options: Any) -> Literal[1]: ...
|
||||
|
||||
class WindowsViewer(Viewer):
|
||||
format: str
|
||||
options: Incomplete
|
||||
def get_command(self, file, **options): ...
|
||||
def get_command(self, file: str, **options: Unused) -> str: ...
|
||||
|
||||
class MacViewer(Viewer):
|
||||
format: str
|
||||
options: Incomplete
|
||||
def get_command(self, file, **options): ...
|
||||
def show_file(self, path: Incomplete | None = None, **options): ...
|
||||
def get_command(self, file: str, **options: Unused) -> str: ...
|
||||
def show_file(self, path: str, **options: Unused) -> Literal[1]: ...
|
||||
|
||||
class UnixViewer(Viewer):
|
||||
format: str
|
||||
options: Incomplete
|
||||
def get_command(self, file, **options): ...
|
||||
def show_file(self, path: Incomplete | None = None, **options): ...
|
||||
# Unix viewer expects the following method to be implemented on all
|
||||
# subclasses, but it isn't defined on the base class.
|
||||
# def get_command_ex(self, file: str, **options: Any) -> tuple[str, str]: ...
|
||||
def get_command(self, file: str, **options: Any) -> str: ...
|
||||
|
||||
class XDGViewer(UnixViewer):
|
||||
def get_command_ex(self, file, **options) -> tuple[Literal["xdg-open"], Literal["xdg-open"]]: ...
|
||||
def get_command_ex(self, file: str, **options: Unused) -> tuple[str, str]: ...
|
||||
def show_file(self, path: str, **options: Unused) -> Literal[1]: ...
|
||||
|
||||
class DisplayViewer(UnixViewer):
|
||||
def get_command_ex(self, file, title: str | None = None, **options): ...
|
||||
def get_command_ex(self, file: str, title: str | None = None, **options: Unused) -> tuple[str, str]: ...
|
||||
def show_file(self, path: str, *, title: str | None = None, **options: Unused) -> Literal[1]: ...
|
||||
|
||||
class GmDisplayViewer(UnixViewer):
|
||||
def get_command_ex(self, file, **options): ...
|
||||
def get_command_ex(self, file: str, **options: Unused) -> tuple[str, str]: ...
|
||||
def show_file(self, path: str, **options: Unused) -> Literal[1]: ...
|
||||
|
||||
class EogViewer(UnixViewer):
|
||||
def get_command_ex(self, file, **options): ...
|
||||
def get_command_ex(self, file: str, **options: Unused) -> tuple[str, str]: ...
|
||||
def show_file(self, path: str, **options: Unused) -> Literal[1]: ...
|
||||
|
||||
class XVViewer(UnixViewer):
|
||||
def get_command_ex(self, file, title: Incomplete | None = None, **options): ...
|
||||
def get_command_ex(self, file, title: str | None = None, **options: Unused) -> tuple[str, str]: ...
|
||||
def show_file(self, path: str, *, title: str | None = None, **options: Unused) -> Literal[1]: ...
|
||||
|
||||
class IPythonViewer(Viewer):
|
||||
def show_image(self, image, **options): ...
|
||||
def show_image(self, image, **options: Unused) -> Literal[1]: ...
|
||||
|
||||
@@ -3,7 +3,7 @@ import tkinter
|
||||
from _typeshed import ReadableBuffer, StrOrBytesPath, SupportsRead
|
||||
from typing import Any
|
||||
|
||||
from PIL.Image import Image, _Box, _Mode, _Size
|
||||
from PIL.Image import Image, _Mode, _Size
|
||||
|
||||
class PhotoImage(tkinter._PhotoImageLike):
|
||||
tk: _tkinter.TkappType
|
||||
@@ -26,8 +26,7 @@ class PhotoImage(tkinter._PhotoImageLike):
|
||||
def __del__(self) -> None: ...
|
||||
def width(self) -> int: ...
|
||||
def height(self) -> int: ...
|
||||
# box is deprecated and unused
|
||||
def paste(self, im: Image, box: _Box | None = None) -> None: ...
|
||||
def paste(self, im: Image) -> None: ...
|
||||
|
||||
class BitmapImage(tkinter._BitmapImageLike):
|
||||
def __init__(
|
||||
|
||||
@@ -28,6 +28,5 @@ RAWMODE: Incomplete
|
||||
zigzag_index: Incomplete
|
||||
samplings: Incomplete
|
||||
|
||||
def convert_dict_qtables(qtables): ...
|
||||
def get_sampling(im): ...
|
||||
def jpeg_factory(fp: Incomplete | None = None, filename: Incomplete | None = None): ...
|
||||
|
||||
@@ -15,17 +15,10 @@ class Disposal(IntEnum):
|
||||
OP_BACKGROUND: int
|
||||
OP_PREVIOUS: int
|
||||
|
||||
APNG_DISPOSE_OP_NONE: Literal[Disposal.OP_NONE]
|
||||
APNG_DISPOSE_OP_BACKGROUND: Literal[Disposal.OP_BACKGROUND]
|
||||
APNG_DISPOSE_OP_PREVIOUS: Literal[Disposal.OP_PREVIOUS]
|
||||
|
||||
class Blend(IntEnum):
|
||||
OP_SOURCE: int
|
||||
OP_OVER: int
|
||||
|
||||
APNG_BLEND_OP_SOURCE: Literal[Blend.OP_SOURCE]
|
||||
APNG_BLEND_OP_OVER: Literal[Blend.OP_OVER]
|
||||
|
||||
class ChunkStream:
|
||||
fp: Incomplete
|
||||
queue: Incomplete
|
||||
|
||||
Reference in New Issue
Block a user