mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-20 02:41:16 +08:00
Type obj parameter of PIL.Image.fromarray (#11176)
This commit is contained in:
@@ -36,6 +36,11 @@ _Color: TypeAlias = (
|
||||
class _Writeable(SupportsWrite[bytes], Protocol):
|
||||
def seek(self, __offset: int) -> Any: ...
|
||||
|
||||
# Ref: https://numpy.org/doc/stable/reference/arrays.interface.html#python-side
|
||||
class _SupportsArrayInterface(Protocol):
|
||||
@property
|
||||
def __array_interface__(self) -> dict[str, Any]: ...
|
||||
|
||||
class DecompressionBombWarning(RuntimeWarning): ...
|
||||
class DecompressionBombError(Exception): ...
|
||||
|
||||
@@ -294,7 +299,9 @@ class ImageTransformHandler: ...
|
||||
def new(mode: _Mode, size: tuple[int, int], color: _Color = 0) -> Image: ...
|
||||
def frombytes(mode: _Mode, size: tuple[int, int], data, decoder_name: str = "raw", *args) -> Image: ...
|
||||
def frombuffer(mode: _Mode, size: tuple[int, int], data, decoder_name: str = "raw", *args) -> Image: ...
|
||||
def fromarray(obj, mode: _Mode | None = None) -> Image: ...
|
||||
|
||||
# If the __array_interface__ has "strides", then `obj` must also support `tobytes` or `tostring`, but we can't enforce that
|
||||
def fromarray(obj: _SupportsArrayInterface, mode: _Mode | None = None) -> Image: ...
|
||||
def fromqimage(im) -> Image: ...
|
||||
def fromqpixmap(im) -> Image: ...
|
||||
def open(
|
||||
|
||||
Reference in New Issue
Block a user