mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-22 03:41:28 +08:00
[Pillow] Add all missing items (#10114)
This commit is contained in:
@@ -1,4 +1,26 @@
|
||||
PIL.__main__
|
||||
|
||||
# Requires Pyside or PyQt to be installed.
|
||||
# Not worth adding to tool.stubtest.stubtest_requirements
|
||||
# because it's only used as a base type and it's a long install.
|
||||
PIL.ImageQt.ImageQt
|
||||
|
||||
# Only stubbing what's necessary from private modules
|
||||
PIL\._imaging\.\w+?
|
||||
|
||||
# Internal logger variable
|
||||
PIL\..+?\.logger
|
||||
|
||||
# Loop variables leaked in global scope
|
||||
PIL.BmpImagePlugin.BmpImageFile.k
|
||||
PIL.BmpImagePlugin.BmpImageFile.v
|
||||
PIL.Image.enum
|
||||
PIL.Image.item
|
||||
PIL.ImageCms.flag
|
||||
PIL.ImageMath.k
|
||||
PIL.ImageMath.v
|
||||
PIL.ImageQt.qt_module
|
||||
PIL.ImImagePlugin.i
|
||||
PIL.XVThumbImagePlugin.b
|
||||
PIL.XVThumbImagePlugin.g
|
||||
PIL.XVThumbImagePlugin.r
|
||||
|
||||
2
stubs/Pillow/@tests/stubtest_allowlist_win32.txt
Normal file
2
stubs/Pillow/@tests/stubtest_allowlist_win32.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
# Loop variables leaked in global scope
|
||||
PIL.EpsImagePlugin.binary
|
||||
@@ -2,4 +2,5 @@ version = "9.5.*"
|
||||
|
||||
[tool.stubtest]
|
||||
stubtest_requirements = ["olefile"]
|
||||
ignore_missing_stub = true
|
||||
# darwin checks don't affect stubtest
|
||||
platforms = ["linux", "win32"]
|
||||
|
||||
@@ -2,7 +2,7 @@ from enum import IntEnum
|
||||
from typing import Any, ClassVar
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .ImageFile import ImageFile, PyDecoder
|
||||
from .ImageFile import ImageFile, PyDecoder, PyEncoder
|
||||
|
||||
class Format(IntEnum):
|
||||
JPEG: int
|
||||
@@ -44,3 +44,6 @@ class _BLPBaseDecoder(PyDecoder):
|
||||
|
||||
class BLP1Decoder(_BLPBaseDecoder): ...
|
||||
class BLP2Decoder(_BLPBaseDecoder): ...
|
||||
|
||||
class BLPEncoder(PyEncoder):
|
||||
def encode(self, bufsize): ...
|
||||
|
||||
@@ -1,15 +1,24 @@
|
||||
from typing import Any, ClassVar
|
||||
from typing_extensions import Literal
|
||||
from typing_extensions import Final, Literal
|
||||
|
||||
from .ImageFile import ImageFile
|
||||
from .ImageFile import ImageFile, PyDecoder
|
||||
|
||||
BIT2MODE: Any
|
||||
|
||||
class BmpImageFile(ImageFile):
|
||||
RAW: Final = 0
|
||||
RLE8: Final = 1
|
||||
RLE4: Final = 2
|
||||
BITFIELDS: Final = 3
|
||||
JPEG: Final = 4
|
||||
PNG: Final = 5
|
||||
format_description: ClassVar[str]
|
||||
format: ClassVar[Literal["BMP", "DIB", "CUR"]]
|
||||
COMPRESSIONS: Any
|
||||
|
||||
class BmpRleDecoder(PyDecoder):
|
||||
def decode(self, buffer): ...
|
||||
|
||||
class DibImageFile(BmpImageFile):
|
||||
format: ClassVar[Literal["DIB"]]
|
||||
|
||||
|
||||
@@ -1,43 +1,46 @@
|
||||
from typing import ClassVar
|
||||
from typing_extensions import Literal
|
||||
from typing_extensions import Final, Literal
|
||||
|
||||
from .ImageFile import ImageFile
|
||||
|
||||
DDS_MAGIC: int
|
||||
DDSD_CAPS: int
|
||||
DDSD_HEIGHT: int
|
||||
DDSD_WIDTH: int
|
||||
DDSD_PITCH: int
|
||||
DDSD_PIXELFORMAT: int
|
||||
DDSD_MIPMAPCOUNT: int
|
||||
DDSD_LINEARSIZE: int
|
||||
DDSD_DEPTH: int
|
||||
DDSCAPS_COMPLEX: int
|
||||
DDSCAPS_TEXTURE: int
|
||||
DDSCAPS_MIPMAP: int
|
||||
DDSCAPS2_CUBEMAP: int
|
||||
DDSCAPS2_CUBEMAP_POSITIVEX: int
|
||||
DDSCAPS2_CUBEMAP_NEGATIVEX: int
|
||||
DDSCAPS2_CUBEMAP_POSITIVEY: int
|
||||
DDSCAPS2_CUBEMAP_NEGATIVEY: int
|
||||
DDSCAPS2_CUBEMAP_POSITIVEZ: int
|
||||
DDSCAPS2_CUBEMAP_NEGATIVEZ: int
|
||||
DDSCAPS2_VOLUME: int
|
||||
DDS_MAGIC: Final = 0x20534444
|
||||
|
||||
DDPF_ALPHAPIXELS: Literal[0x1]
|
||||
DDPF_ALPHA: Literal[0x2]
|
||||
DDPF_FOURCC: Literal[0x4]
|
||||
DDPF_PALETTEINDEXED8: Literal[0x20]
|
||||
DDPF_RGB: Literal[0x40]
|
||||
DDPF_LUMINANCE: Literal[0x20000]
|
||||
DDSD_CAPS: Final = 0x1
|
||||
DDSD_HEIGHT: Final = 0x2
|
||||
DDSD_WIDTH: Final = 0x4
|
||||
DDSD_PITCH: Final = 0x8
|
||||
DDSD_PIXELFORMAT: Final = 0x1000
|
||||
DDSD_MIPMAPCOUNT: Final = 0x20000
|
||||
DDSD_LINEARSIZE: Final = 0x80000
|
||||
DDSD_DEPTH: Final = 0x800000
|
||||
|
||||
DDS_FOURCC: Literal[0x4]
|
||||
DDS_RGB: Literal[0x40]
|
||||
DDS_RGBA: Literal[0x41]
|
||||
DDS_LUMINANCE: Literal[0x20000]
|
||||
DDS_LUMINANCEA: Literal[0x20001]
|
||||
DDS_ALPHA: Literal[0x2]
|
||||
DDS_PAL8: Literal[0x20]
|
||||
DDSCAPS_COMPLEX: Final = 0x8
|
||||
DDSCAPS_TEXTURE: Final = 0x1000
|
||||
DDSCAPS_MIPMAP: Final = 0x400000
|
||||
|
||||
DDSCAPS2_CUBEMAP: Final = 0x200
|
||||
DDSCAPS2_CUBEMAP_POSITIVEX: Final = 0x400
|
||||
DDSCAPS2_CUBEMAP_NEGATIVEX: Final = 0x800
|
||||
DDSCAPS2_CUBEMAP_POSITIVEY: Final = 0x1000
|
||||
DDSCAPS2_CUBEMAP_NEGATIVEY: Final = 0x2000
|
||||
DDSCAPS2_CUBEMAP_POSITIVEZ: Final = 0x4000
|
||||
DDSCAPS2_CUBEMAP_NEGATIVEZ: Final = 0x8000
|
||||
DDSCAPS2_VOLUME: Final = 0x200000
|
||||
|
||||
DDPF_ALPHAPIXELS: Final = 0x1
|
||||
DDPF_ALPHA: Final = 0x2
|
||||
DDPF_FOURCC: Final = 0x4
|
||||
DDPF_PALETTEINDEXED8: Final = 0x20
|
||||
DDPF_RGB: Final = 0x40
|
||||
DDPF_LUMINANCE: Final = 0x20000
|
||||
|
||||
DDS_FOURCC: Final = 0x4
|
||||
DDS_RGB: Final = 0x40
|
||||
DDS_RGBA: Final = 0x41
|
||||
DDS_LUMINANCE: Final = 0x20000
|
||||
DDS_LUMINANCEA: Final = 0x20001
|
||||
DDS_ALPHA: Final = 0x2
|
||||
DDS_PAL8: Final = 0x20
|
||||
|
||||
DDS_HEADER_FLAGS_TEXTURE: int
|
||||
DDS_HEADER_FLAGS_MIPMAP: int
|
||||
@@ -55,15 +58,22 @@ DDS_CUBEMAP_POSITIVEY: int
|
||||
DDS_CUBEMAP_NEGATIVEY: int
|
||||
DDS_CUBEMAP_POSITIVEZ: int
|
||||
DDS_CUBEMAP_NEGATIVEZ: int
|
||||
DXT1_FOURCC: int
|
||||
DXT3_FOURCC: int
|
||||
DXT5_FOURCC: int
|
||||
DXGI_FORMAT_R8G8B8A8_TYPELESS: int
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM: int
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: int
|
||||
DXGI_FORMAT_BC7_TYPELESS: int
|
||||
DXGI_FORMAT_BC7_UNORM: int
|
||||
DXGI_FORMAT_BC7_UNORM_SRGB: int
|
||||
|
||||
DXT1_FOURCC: Final = 0x31545844
|
||||
DXT3_FOURCC: Final = 0x33545844
|
||||
DXT5_FOURCC: Final = 0x35545844
|
||||
|
||||
DXGI_FORMAT_R8G8B8A8_TYPELESS: Final = 27
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM: Final = 28
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: Final = 29
|
||||
DXGI_FORMAT_BC5_TYPELESS: Final = 82
|
||||
DXGI_FORMAT_BC5_UNORM: Final = 83
|
||||
DXGI_FORMAT_BC5_SNORM: Final = 84
|
||||
DXGI_FORMAT_BC6H_UF16: Final = 95
|
||||
DXGI_FORMAT_BC6H_SF16: Final = 96
|
||||
DXGI_FORMAT_BC7_TYPELESS: Final = 97
|
||||
DXGI_FORMAT_BC7_UNORM: Final = 98
|
||||
DXGI_FORMAT_BC7_UNORM_SRGB: Final = 99
|
||||
|
||||
class DdsImageFile(ImageFile):
|
||||
format: ClassVar[Literal["DDS"]]
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import sys
|
||||
from typing import Any, ClassVar
|
||||
from typing_extensions import Literal
|
||||
|
||||
@@ -6,7 +7,10 @@ from .ImageFile import ImageFile
|
||||
|
||||
split: Any
|
||||
field: Any
|
||||
gs_windows_binary: Any
|
||||
if sys.platform == "win32":
|
||||
gs_windows_binary: Literal["gswin32c", "gswin64c", "gs", False]
|
||||
else:
|
||||
gs_windows_binary: None
|
||||
|
||||
def has_ghostscript(): ...
|
||||
def Ghostscript(tile, size, fp, scale: int = 1, transparency: bool = False): ...
|
||||
|
||||
7
stubs/Pillow/PIL/FitsImagePlugin.pyi
Normal file
7
stubs/Pillow/PIL/FitsImagePlugin.pyi
Normal file
@@ -0,0 +1,7 @@
|
||||
from typing import ClassVar
|
||||
|
||||
from . import Image as Image, ImageFile as ImageFile
|
||||
|
||||
class FitsImageFile(ImageFile.ImageFile):
|
||||
format: ClassVar[str]
|
||||
format_description: ClassVar[str]
|
||||
@@ -1,9 +1,17 @@
|
||||
from _typeshed import Incomplete
|
||||
from enum import IntEnum
|
||||
from typing import Any, ClassVar
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .ImageFile import ImageFile
|
||||
|
||||
class LoadingStrategy(IntEnum):
|
||||
RGB_AFTER_FIRST = 0
|
||||
RGB_AFTER_DIFFERENT_PALETTE_ONLY = 1
|
||||
RGB_ALWAYS = 2
|
||||
|
||||
LOADING_STRATEGY: LoadingStrategy
|
||||
|
||||
class GifImageFile(ImageFile):
|
||||
format: ClassVar[Literal["GIF"]]
|
||||
format_description: ClassVar[str]
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
from _typeshed import Incomplete
|
||||
from typing import Any, ClassVar
|
||||
from typing_extensions import Literal
|
||||
from typing_extensions import Final, Literal
|
||||
|
||||
from ._imaging import _PixelAccessor
|
||||
from .ImageFile import ImageFile
|
||||
|
||||
enable_jpeg2k: Any
|
||||
HEADERSIZE: int
|
||||
MAGIC: Final = b"icns"
|
||||
HEADERSIZE: Final = 8
|
||||
|
||||
def nextheader(fobj): ...
|
||||
def read_32t(fobj, start_length, size): ...
|
||||
|
||||
@@ -42,11 +42,14 @@ class DecompressionBombWarning(RuntimeWarning): ...
|
||||
class DecompressionBombError(Exception): ...
|
||||
|
||||
MAX_IMAGE_PIXELS: int | None
|
||||
USE_CFFI_ACCESS: Incomplete
|
||||
|
||||
LINEAR: Literal[Resampling.BILINEAR] # deprecated
|
||||
CUBIC: Literal[Resampling.BICUBIC] # deprecated
|
||||
ANTIALIAS: Literal[Resampling.LANCZOS] # deprecated
|
||||
|
||||
def isImageType(t): ...
|
||||
|
||||
class Transpose(IntEnum):
|
||||
FLIP_LEFT_RIGHT: Literal[0]
|
||||
FLIP_TOP_BOTTOM: Literal[1]
|
||||
@@ -147,9 +150,17 @@ def init() -> None: ...
|
||||
def coerce_e(value) -> _E: ...
|
||||
|
||||
class _E:
|
||||
scale: Incomplete
|
||||
data: Incomplete
|
||||
def __init__(self, scale, data) -> None: ...
|
||||
def __neg__(self): ...
|
||||
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): ...
|
||||
|
||||
_ImageState: TypeAlias = tuple[dict[str, Any], str, tuple[int, int], Any, bytes]
|
||||
|
||||
@@ -176,6 +187,8 @@ class Image:
|
||||
def __exit__(self, *args: Unused) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
@property
|
||||
def __array_interface__(self): ...
|
||||
def __getstate__(self) -> _ImageState: ...
|
||||
def __setstate__(self, state: _ImageState) -> None: ...
|
||||
def tobytes(self, encoder_name: str = "raw", *args) -> bytes: ...
|
||||
@@ -213,6 +226,7 @@ class Image:
|
||||
def get_child_images(self) -> list[Image]: ...
|
||||
def getim(self): ...
|
||||
def getpalette(self, rawmode: str | None = "RGB") -> list[int] | None: ...
|
||||
def apply_transparency(self) -> None: ...
|
||||
def getpixel(self, xy: tuple[int, int]): ...
|
||||
def getprojection(self) -> tuple[list[int], list[int]]: ...
|
||||
def histogram(self, mask: Image | None = None, extrema: tuple[int, int] | tuple[float, float] | None = None) -> list[int]: ...
|
||||
@@ -304,7 +318,10 @@ def linear_gradient(mode: _Mode) -> Image: ...
|
||||
def radial_gradient(mode: _Mode) -> Image: ...
|
||||
|
||||
class Exif(MutableMapping[int, Any]):
|
||||
endian: Incomplete
|
||||
bigtiff: bool
|
||||
def load(self, data: bytes) -> None: ...
|
||||
def load_from_fp(self, fp, offset: Incomplete | None = None) -> None: ...
|
||||
def tobytes(self, offset: int = 8) -> bytes: ...
|
||||
def get_ifd(self, tag: int): ...
|
||||
def hide_offsets(self) -> None: ...
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from _typeshed import Incomplete
|
||||
import sys
|
||||
from _typeshed import Incomplete, Unused
|
||||
from enum import IntEnum
|
||||
from typing import Any
|
||||
from typing_extensions import Literal
|
||||
@@ -55,7 +56,11 @@ class ImageCmsTransform(ImagePointHandler):
|
||||
def apply(self, im, imOut: Incomplete | None = None): ...
|
||||
def apply_in_place(self, im): ...
|
||||
|
||||
def get_display_profile(handle: Incomplete | None = None): ...
|
||||
if sys.platform == "win32":
|
||||
def get_display_profile(handle: Incomplete | None = None) -> ImageCmsProfile | None: ...
|
||||
|
||||
else:
|
||||
def get_display_profile(handle: Unused = None) -> None: ...
|
||||
|
||||
class PyCMSError(Exception): ...
|
||||
|
||||
|
||||
@@ -11,6 +11,14 @@ _XY: TypeAlias = Sequence[float | tuple[float, float]]
|
||||
_Outline: TypeAlias = Any
|
||||
|
||||
class ImageDraw:
|
||||
font: Incomplete
|
||||
palette: Incomplete
|
||||
im: Incomplete
|
||||
draw: Incomplete
|
||||
mode: Incomplete
|
||||
ink: Incomplete
|
||||
fontmode: str
|
||||
fill: bool
|
||||
def __init__(self, im: Image, mode: str | None = None) -> None: ...
|
||||
def getfont(self): ...
|
||||
def arc(self, xy: _XY, start: float, end: float, fill: _Ink | None = None, width: float = 1) -> None: ...
|
||||
|
||||
@@ -32,3 +32,5 @@ class Draw:
|
||||
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): ...
|
||||
|
||||
@@ -53,6 +53,18 @@ class PyCodecState:
|
||||
yoff: int
|
||||
def extents(self) -> tuple[int, int, int, int]: ...
|
||||
|
||||
class PyCodec:
|
||||
im: Incomplete
|
||||
state: Incomplete
|
||||
fd: Incomplete
|
||||
mode: Incomplete
|
||||
def __init__(self, mode, *args) -> None: ...
|
||||
args: Incomplete
|
||||
def init(self, args) -> None: ...
|
||||
def cleanup(self) -> None: ...
|
||||
def setfd(self, fd) -> None: ...
|
||||
def setimage(self, im, extents: Incomplete | None = None) -> None: ...
|
||||
|
||||
class PyDecoder:
|
||||
im: Any
|
||||
state: Any
|
||||
@@ -68,3 +80,10 @@ class PyDecoder:
|
||||
def setfd(self, fd) -> None: ...
|
||||
def setimage(self, im, extents: Incomplete | None = None) -> None: ...
|
||||
def set_as_raw(self, data, rawmode: Incomplete | None = None) -> None: ...
|
||||
|
||||
class PyEncoder(PyCodec):
|
||||
@property
|
||||
def pushes_fd(self): ...
|
||||
def encode(self, bufsize) -> None: ...
|
||||
def encode_to_pyfd(self): ...
|
||||
def encode_to_file(self, fh, bufsize): ...
|
||||
|
||||
@@ -16,6 +16,8 @@ class _Font(Protocol):
|
||||
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): ...
|
||||
|
||||
class FreeTypeFont:
|
||||
path: str | bytes | SupportsRead[bytes] | None
|
||||
@@ -23,6 +25,8 @@ class FreeTypeFont:
|
||||
index: int
|
||||
encoding: str
|
||||
layout_engine: Layout
|
||||
font_bytes: Incomplete
|
||||
font: Incomplete
|
||||
def __init__(
|
||||
self,
|
||||
font: str | bytes | SupportsRead[bytes] | None = None,
|
||||
@@ -110,9 +114,13 @@ 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]: ...
|
||||
def getmask(self, text: str | bytes, mode: str = "", *args, **kwargs): ...
|
||||
def getbbox(self, text, *args, **kwargs): ...
|
||||
def getlength(self, text, *args, **kwargs): ...
|
||||
|
||||
def load(filename: FileDescriptorOrPath) -> ImageFont: ...
|
||||
def truetype(
|
||||
|
||||
@@ -1,8 +1,36 @@
|
||||
from _typeshed import Incomplete
|
||||
import sys
|
||||
from _typeshed import Incomplete, Unused
|
||||
|
||||
from PIL.BmpImagePlugin import DibImageFile
|
||||
from PIL.PngImagePlugin import PngImageFile
|
||||
|
||||
from .Image import Image, _Box
|
||||
|
||||
def grab(
|
||||
bbox: _Box | None = None, include_layered_windows: bool = False, all_screens: bool = False, xdisplay: Incomplete | None = None
|
||||
) -> Image: ...
|
||||
def grabclipboard() -> Image | None: ...
|
||||
# include_layered_windows and all_screens are Windows only
|
||||
# xdisplay must be None on non-linux platforms7
|
||||
if sys.platform == "linux":
|
||||
def grab(
|
||||
bbox: _Box | None = None,
|
||||
include_layered_windows: Unused = False,
|
||||
all_screens: Unused = False,
|
||||
xdisplay: Incomplete | None = None,
|
||||
) -> Image: ...
|
||||
|
||||
elif sys.platform == "win32":
|
||||
def grab(
|
||||
bbox: _Box | None = None, include_layered_windows: bool = False, all_screens: bool = False, xdisplay: None = None
|
||||
) -> Image: ...
|
||||
|
||||
else:
|
||||
def grab(
|
||||
bbox: _Box | None = None, include_layered_windows: Unused = False, all_screens: Unused = False, xdisplay: None = None
|
||||
) -> Image: ...
|
||||
|
||||
if sys.platform == "darwin":
|
||||
def grabclipboard() -> Image | None: ...
|
||||
|
||||
elif sys.platform == "win32":
|
||||
def grabclipboard() -> list[str] | PngImageFile | DibImageFile | None: ...
|
||||
|
||||
else:
|
||||
def grabclipboard() -> Image: ...
|
||||
|
||||
@@ -1,9 +1,21 @@
|
||||
from _typeshed import Incomplete
|
||||
from typing import Any, ClassVar
|
||||
from typing_extensions import Literal
|
||||
|
||||
from ._imaging import _PixelAccessor
|
||||
from .ImageFile import ImageFile
|
||||
|
||||
class BoxReader:
|
||||
fp: Incomplete
|
||||
has_length: Incomplete
|
||||
length: Incomplete
|
||||
remaining_in_box: int
|
||||
def __init__(self, fp, length: int = -1) -> None: ...
|
||||
def read_fields(self, field_format): ...
|
||||
def read_boxes(self): ...
|
||||
def has_next_box(self): ...
|
||||
def next_box_type(self): ...
|
||||
|
||||
class Jpeg2KImageFile(ImageFile):
|
||||
format: ClassVar[Literal["JPEG2000"]]
|
||||
format_description: ClassVar[str]
|
||||
|
||||
@@ -3,8 +3,6 @@ from typing_extensions import Literal
|
||||
|
||||
from .ImageFile import ImageFile
|
||||
|
||||
logger: Any
|
||||
|
||||
class PcxImageFile(ImageFile):
|
||||
format: ClassVar[Literal["PCX", "DCX"]]
|
||||
format_description: ClassVar[str]
|
||||
|
||||
@@ -6,7 +6,6 @@ from typing_extensions import Literal
|
||||
from ._binary import o8 as o8
|
||||
from .ImageFile import ImageFile
|
||||
|
||||
logger: Any
|
||||
is_cid: Any
|
||||
MAX_TEXT_CHUNK: Any
|
||||
MAX_TEXT_MEMORY: Any
|
||||
@@ -104,6 +103,7 @@ class PngImageFile(ImageFile):
|
||||
im: Any
|
||||
def load_end(self) -> None: ...
|
||||
def getexif(self): ...
|
||||
def getxmp(self): ...
|
||||
|
||||
def putchunk(fp, cid, *data) -> None: ...
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from typing import Any, ClassVar
|
||||
from typing_extensions import Literal
|
||||
|
||||
from .ImageFile import ImageFile
|
||||
from .ImageFile import ImageFile, PyDecoder
|
||||
|
||||
b_whitespace: bytes
|
||||
MODES: Any
|
||||
@@ -9,3 +9,9 @@ MODES: Any
|
||||
class PpmImageFile(ImageFile):
|
||||
format: ClassVar[Literal["PPM"]]
|
||||
format_description: ClassVar[str]
|
||||
|
||||
class PpmPlainDecoder(PyDecoder):
|
||||
def decode(self, buffer): ...
|
||||
|
||||
class PpmDecoder(PyDecoder):
|
||||
def decode(self, buffer): ...
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
from logging import Logger
|
||||
from typing import Any
|
||||
|
||||
from PIL._imaging import _PixelAccessor
|
||||
|
||||
ffi: Any
|
||||
logger: Logger
|
||||
|
||||
class PyAccess(_PixelAccessor):
|
||||
readonly: Any
|
||||
|
||||
11
stubs/Pillow/PIL/QoiImagePlugin.pyi
Normal file
11
stubs/Pillow/PIL/QoiImagePlugin.pyi
Normal file
@@ -0,0 +1,11 @@
|
||||
from typing import ClassVar
|
||||
|
||||
from . import Image as Image, ImageFile as ImageFile
|
||||
from ._binary import o8 as o8
|
||||
|
||||
class QoiImageFile(ImageFile.ImageFile):
|
||||
format: ClassVar[str]
|
||||
format_description: ClassVar[str]
|
||||
|
||||
class QoiDecoder(ImageFile.PyDecoder):
|
||||
def decode(self, buffer): ...
|
||||
@@ -3,56 +3,63 @@ from collections.abc import MutableMapping
|
||||
from numbers import Rational
|
||||
from types import TracebackType
|
||||
from typing import Any, ClassVar
|
||||
from typing_extensions import Literal
|
||||
from typing_extensions import Final, Literal
|
||||
|
||||
from ._imaging import _PixelAccessor
|
||||
from .ImageFile import ImageFile
|
||||
|
||||
logger: Any
|
||||
# These are meant to be overridable
|
||||
READ_LIBTIFF: bool
|
||||
WRITE_LIBTIFF: bool
|
||||
IFD_LEGACY_API: bool
|
||||
II: bytes
|
||||
MM: bytes
|
||||
IMAGEWIDTH: int
|
||||
IMAGELENGTH: int
|
||||
BITSPERSAMPLE: int
|
||||
COMPRESSION: int
|
||||
PHOTOMETRIC_INTERPRETATION: int
|
||||
FILLORDER: int
|
||||
IMAGEDESCRIPTION: int
|
||||
STRIPOFFSETS: int
|
||||
SAMPLESPERPIXEL: int
|
||||
ROWSPERSTRIP: int
|
||||
STRIPBYTECOUNTS: int
|
||||
X_RESOLUTION: int
|
||||
Y_RESOLUTION: int
|
||||
PLANAR_CONFIGURATION: int
|
||||
RESOLUTION_UNIT: int
|
||||
TRANSFERFUNCTION: int
|
||||
SOFTWARE: int
|
||||
DATE_TIME: int
|
||||
ARTIST: int
|
||||
PREDICTOR: int
|
||||
COLORMAP: int
|
||||
TILEOFFSETS: int
|
||||
SUBIFD: int
|
||||
EXTRASAMPLES: int
|
||||
SAMPLEFORMAT: int
|
||||
JPEGTABLES: int
|
||||
REFERENCEBLACKWHITE: int
|
||||
COPYRIGHT: int
|
||||
IPTC_NAA_CHUNK: int
|
||||
PHOTOSHOP_CHUNK: int
|
||||
ICCPROFILE: int
|
||||
EXIFIFD: int
|
||||
XMP: int
|
||||
JPEGQUALITY: int
|
||||
IMAGEJ_META_DATA_BYTE_COUNTS: int
|
||||
IMAGEJ_META_DATA: int
|
||||
STRIP_SIZE: int
|
||||
|
||||
II: Final = b"II"
|
||||
MM: Final = b"MM"
|
||||
IMAGEWIDTH: Final = 256
|
||||
IMAGELENGTH: Final = 257
|
||||
BITSPERSAMPLE: Final = 258
|
||||
COMPRESSION: Final = 259
|
||||
PHOTOMETRIC_INTERPRETATION: Final = 262
|
||||
FILLORDER: Final = 266
|
||||
IMAGEDESCRIPTION: Final = 270
|
||||
STRIPOFFSETS: Final = 273
|
||||
SAMPLESPERPIXEL: Final = 277
|
||||
ROWSPERSTRIP: Final = 278
|
||||
STRIPBYTECOUNTS: Final = 279
|
||||
X_RESOLUTION: Final = 282
|
||||
Y_RESOLUTION: Final = 283
|
||||
PLANAR_CONFIGURATION: Final = 284
|
||||
RESOLUTION_UNIT: Final = 296
|
||||
TRANSFERFUNCTION: Final = 301
|
||||
SOFTWARE: Final = 305
|
||||
DATE_TIME: Final = 306
|
||||
ARTIST: Final = 315
|
||||
PREDICTOR: Final = 317
|
||||
COLORMAP: Final = 320
|
||||
TILEWIDTH: Final = 322
|
||||
TILELENGTH: Final = 323
|
||||
TILEOFFSETS: Final = 324
|
||||
TILEBYTECOUNTS: Final = 325
|
||||
SUBIFD: Final = 330
|
||||
EXTRASAMPLES: Final = 338
|
||||
SAMPLEFORMAT: Final = 339
|
||||
JPEGTABLES: Final = 347
|
||||
YCBCRSUBSAMPLING: Final = 530
|
||||
REFERENCEBLACKWHITE: Final = 532
|
||||
COPYRIGHT: Final = 33432
|
||||
IPTC_NAA_CHUNK: Final = 33723
|
||||
PHOTOSHOP_CHUNK: Final = 34377
|
||||
ICCPROFILE: Final = 34675
|
||||
EXIFIFD: Final = 34665
|
||||
XMP: Final = 700
|
||||
JPEGQUALITY: Final = 65537
|
||||
IMAGEJ_META_DATA_BYTE_COUNTS: Final = 50838
|
||||
IMAGEJ_META_DATA: Final = 50839
|
||||
COMPRESSION_INFO: Any
|
||||
COMPRESSION_INFO_REV: Any
|
||||
OPEN_INFO: Any
|
||||
MAX_SAMPLESPERPIXEL: Final = 6
|
||||
PREFIXES: Any
|
||||
|
||||
class IFDRational(Rational):
|
||||
@@ -124,6 +131,22 @@ class ImageFileDirectory_v2(MutableMapping[int, Any]):
|
||||
def load(self, fp) -> None: ...
|
||||
def tobytes(self, offset: int = 0): ...
|
||||
def save(self, fp): ...
|
||||
load_double: Incomplete
|
||||
load_float: Incomplete
|
||||
load_long: Incomplete
|
||||
load_long8: Incomplete
|
||||
load_short: Incomplete
|
||||
load_signed_byte: Incomplete
|
||||
load_signed_long: Incomplete
|
||||
load_signed_short: Incomplete
|
||||
write_double: Incomplete
|
||||
write_float: Incomplete
|
||||
write_long: Incomplete
|
||||
write_long8: Incomplete
|
||||
write_short: Incomplete
|
||||
write_signed_byte: Incomplete
|
||||
write_signed_long: Incomplete
|
||||
write_signed_short: Incomplete
|
||||
|
||||
class ImageFileDirectory_v1(ImageFileDirectory_v2):
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
@@ -154,6 +177,8 @@ class TiffImageFile(ImageFile):
|
||||
im: Any
|
||||
def seek(self, frame) -> None: ...
|
||||
def tell(self): ...
|
||||
def getxmp(self): ...
|
||||
def get_photoshop_blocks(self): ...
|
||||
def load(self) -> _PixelAccessor: ...
|
||||
def load_end(self) -> None: ...
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
from _typeshed import Incomplete
|
||||
from typing import Any, NamedTuple
|
||||
from typing_extensions import Literal, TypeAlias
|
||||
from typing_extensions import Final, Literal, TypeAlias
|
||||
|
||||
_TagType: TypeAlias = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16]
|
||||
_TagTuple: TypeAlias = tuple[str, _TagType, int] | tuple[str, _TagInfo, int, dict[str, int]]
|
||||
|
||||
class _TagInfo(NamedTuple):
|
||||
value: Any
|
||||
@@ -22,23 +25,20 @@ class TagInfo(_TagInfo):
|
||||
|
||||
def lookup(tag: int, group: int | None = None) -> _TagInfo: ...
|
||||
|
||||
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: TypeAlias = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
|
||||
_TagTuple: TypeAlias = tuple[str, _TagType, int] | tuple[str, _TagInfo, int, dict[str, int]]
|
||||
|
||||
BYTE: Final = 1
|
||||
ASCII: Final = 2
|
||||
SHORT: Final = 3
|
||||
LONG: Final = 4
|
||||
RATIONAL: Final = 5
|
||||
SIGNED_BYTE: Final = 6
|
||||
UNDEFINED: Final = 7
|
||||
SIGNED_SHORT: Final = 8
|
||||
SIGNED_LONG: Final = 9
|
||||
SIGNED_RATIONAL: Final = 10
|
||||
FLOAT: Final = 11
|
||||
DOUBLE: Final = 12
|
||||
IFD: Final = 13
|
||||
LONG8: Final = 16
|
||||
TAGS_V2: dict[int, _TagTuple]
|
||||
TAGS_V2_GROUPS: dict[int, dict[int, _TagTuple]]
|
||||
TAGS: dict[int, str]
|
||||
|
||||
@@ -2,6 +2,7 @@ def i8(c): ...
|
||||
def o8(i): ...
|
||||
def i16le(c, o: int = 0): ...
|
||||
def si16le(c, o: int = 0): ...
|
||||
def si16be(c, o: int = 0): ...
|
||||
def i32le(c, o: int = 0): ...
|
||||
def si32le(c, o: int = 0): ...
|
||||
def i16be(c, o: int = 0): ...
|
||||
|
||||
Reference in New Issue
Block a user