types-Pillow: Allow stubtest to validate PIL.FpxImagePlugin and PIL.MicImagePlugin (#9531)

This commit is contained in:
Avasam
2023-01-17 11:37:17 -05:00
committed by GitHub
parent 5b0488928d
commit a991234832
5 changed files with 35 additions and 20 deletions

View File

@@ -0,0 +1 @@
olefile

View File

@@ -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

View File

@@ -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): ...

View File

@@ -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: ...

View File

@@ -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]