mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-15 16:27:08 +08:00
types-Pillow: Allow stubtest to validate PIL.FpxImagePlugin and PIL.MicImagePlugin (#9531)
This commit is contained in:
1
stubs/Pillow/@tests/requirements-stubtest.txt
Normal file
1
stubs/Pillow/@tests/requirements-stubtest.txt
Normal file
@@ -0,0 +1 @@
|
||||
olefile
|
||||
@@ -1,7 +1,4 @@
|
||||
PIL.FpxImagePlugin
|
||||
# Requires Pyside or PyQt to be installed.
|
||||
# Not worth adding to requirements-stubtest.txt
|
||||
# because it's only used as a base type and it's a long install.
|
||||
PIL.ImageQt.ImageQt
|
||||
PIL.MicImagePlugin
|
||||
# Requires PySide or PyQt to be installed.
|
||||
# We don't install either in stubtest so it can't see it
|
||||
PIL.ImageQt.QImage
|
||||
PIL.ImageQt.QPixmap
|
||||
|
||||
@@ -1,12 +1,22 @@
|
||||
from _typeshed import Incomplete
|
||||
from typing import Any, ClassVar
|
||||
from typing_extensions import Literal
|
||||
from typing_extensions import Literal, TypeAlias
|
||||
|
||||
from .ImageFile import ImageFile
|
||||
|
||||
MODES: Any
|
||||
_OleFileIO: TypeAlias = Any # olefile.OleFileIO
|
||||
_OleStream: TypeAlias = Any # olefile.OleStream
|
||||
|
||||
MODES: dict[tuple[int, ...], tuple[str, str]]
|
||||
|
||||
class FpxImageFile(ImageFile):
|
||||
ole: _OleFileIO
|
||||
format: ClassVar[Literal["FPX"]]
|
||||
format_description: ClassVar[str]
|
||||
fp: Any
|
||||
fp: _OleStream | None
|
||||
maxid: int
|
||||
rawmode: str
|
||||
jpeg: dict[int, Incomplete]
|
||||
tile_prefix: Incomplete
|
||||
stream: list[str]
|
||||
def load(self): ...
|
||||
|
||||
@@ -3,20 +3,20 @@ from typing_extensions import Literal, TypeAlias
|
||||
|
||||
from .Image import Image
|
||||
|
||||
QImage: TypeAlias = Any # imported from either of {PyQt6,PySide6,PyQt5,PySide2}.QtGui
|
||||
QPixmap: TypeAlias = Any
|
||||
_QImage: TypeAlias = Any # imported from either of {PyQt6,PySide6,PyQt5,PySide2}.QtGui
|
||||
_QPixmap: TypeAlias = Any
|
||||
|
||||
qt_versions: Any
|
||||
qt_is_installed: bool
|
||||
qt_version: Any
|
||||
|
||||
def rgb(r: int, g: int, b: int, a: int = ...) -> int: ...
|
||||
def fromqimage(im: Image | QImage) -> Image: ...
|
||||
def fromqpixmap(im: Image | QImage) -> Image: ...
|
||||
def fromqimage(im: ImageQt | _QImage) -> Image: ...
|
||||
def fromqpixmap(im: ImageQt | _QImage) -> Image: ...
|
||||
def align8to32(bytes: bytes, width: int, mode: Literal["1", "L", "P"]) -> bytes: ...
|
||||
|
||||
class ImageQt(QImage):
|
||||
class ImageQt(_QImage):
|
||||
def __init__(self, im: Image) -> None: ...
|
||||
|
||||
def toqimage(im: Image) -> ImageQt: ...
|
||||
def toqpixmap(im: Image) -> QPixmap: ...
|
||||
def toqpixmap(im: Image) -> _QPixmap: ...
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
from typing import Any, ClassVar
|
||||
from typing_extensions import Literal
|
||||
from typing_extensions import Literal, TypeAlias
|
||||
|
||||
from .TiffImagePlugin import TiffImageFile
|
||||
|
||||
_OleFileIO: TypeAlias = Any # olefile.OleFileIO
|
||||
_OleStream: TypeAlias = Any # olefile.OleStream
|
||||
|
||||
class MicImageFile(TiffImageFile):
|
||||
ole: _OleFileIO
|
||||
format: ClassVar[Literal["MIC"]]
|
||||
fp: Any
|
||||
frame: Any
|
||||
def seek(self, frame) -> None: ...
|
||||
def tell(self): ...
|
||||
format_description: ClassVar[str]
|
||||
fp: _OleStream
|
||||
frame: int | None
|
||||
images: list[list[str]]
|
||||
is_animated: bool
|
||||
def seek(self, frame: int) -> None: ...
|
||||
def tell(self) -> int | None: ... # type: ignore[override]
|
||||
|
||||
Reference in New Issue
Block a user