Use PEP 570 syntax in third party stubs (#11554)

This commit is contained in:
Shantanu
2024-03-10 06:11:43 -07:00
committed by GitHub
parent f94bbfbcc4
commit 88fa182253
97 changed files with 625 additions and 632 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ _Color: TypeAlias = (
)
class _Writeable(SupportsWrite[bytes], Protocol):
def seek(self, __offset: int) -> Any: ...
def seek(self, offset: int, /) -> Any: ...
# Ref: https://numpy.org/doc/stable/reference/arrays.interface.html#python-side
class _SupportsArrayInterface(Protocol):
+1 -1
View File
@@ -12,7 +12,7 @@ class Layout(IntEnum):
MAX_STRING_LENGTH: Final[int] = 1_000_000
class _Font(Protocol):
def getmask(self, __text: str | bytes, __mode: str = ..., direction=..., features=...): ...
def getmask(self, text: str | bytes, mode: str = ..., /, direction=..., features=...): ...
class ImageFont:
def getmask(self, text: str | bytes, mode: str = "", direction=..., features=...): ...
+1 -1
View File
@@ -9,7 +9,7 @@ from .ImageColor import _Ink
_Border: TypeAlias = int | tuple[int, int] | tuple[int, int, int, int]
class _Deformer(Protocol):
def getmesh(self, __image: Image): ...
def getmesh(self, image: Image, /): ...
def autocontrast(
image: Image,
+6 -6
View File
@@ -17,13 +17,13 @@ class _PixelAccessor(Protocol): # noqa: Y046
#
# This protocol describes that interface.
# TODO: should the color args and getter return types be _Color?
def __setitem__(self, __xy: tuple[int, int], __color: Incomplete) -> None: ...
def __getitem__(self, __xy: tuple[int, int]) -> Incomplete: ...
def putpixel(self, __xy: tuple[int, int], __color: Incomplete) -> None: ...
def getpixel(self, __xy: tuple[int, int]) -> Incomplete: ...
def __setitem__(self, xy: tuple[int, int], color: Incomplete, /) -> None: ...
def __getitem__(self, xy: tuple[int, int], /) -> Incomplete: ...
def putpixel(self, xy: tuple[int, int], color: Incomplete, /) -> None: ...
def getpixel(self, xy: tuple[int, int], /) -> Incomplete: ...
class _Path:
def __getattr__(self, item: str) -> Incomplete: ...
def path(__x: Sequence[tuple[float, float]] | Sequence[float]) -> _Path: ...
def __getattr__(__name: str) -> Incomplete: ...
def path(x: Sequence[tuple[float, float]] | Sequence[float], /) -> _Path: ...
def __getattr__(name: str, /) -> Incomplete: ...