Skip to content

Commit 88fa182

Browse files
authored
Use PEP 570 syntax in third party stubs (#11554)
1 parent f94bbfb commit 88fa182

File tree

97 files changed

+626
-633
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+626
-633
lines changed

stubs/Deprecated/deprecated/classic.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class ClassicAdapter:
1919
def __call__(self, wrapped: _F) -> Callable[[_F], _F]: ...
2020

2121
@overload
22-
def deprecated(__wrapped: _F) -> _F: ...
22+
def deprecated(wrapped: _F, /) -> _F: ...
2323
@overload
2424
def deprecated(
2525
reason: str = ..., *, version: str = ..., action: _Actions | None = ..., category: type[Warning] | None = ...

stubs/ExifRead/exifread/_types.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ TagDict: TypeAlias = dict[int, tuple[str] | tuple[str, Any]]
99

1010
class Reader(Protocol):
1111
def __iter__(self) -> bytes: ...
12-
def read(self, __size: int) -> bytes: ...
12+
def read(self, size: int, /) -> bytes: ...
1313
def tell(self) -> int: ...
14-
def seek(self, __offset: int, __whence: Literal[0, 1] = ...) -> object: ...
14+
def seek(self, offset: int, whence: Literal[0, 1] = ..., /) -> object: ...

stubs/Flask-SocketIO/flask_socketio/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class SocketIO:
5454
def on_error_default(self, exception_handler: _ExceptionHandler[_R_co]) -> _ExceptionHandler[_R_co]: ...
5555
def on_event(self, message: str, handler: _Handler[[Incomplete], object], namespace: str | None = None) -> None: ...
5656
@overload
57-
def event(self, __event_handler: _Handler[_P, _R_co]) -> _Handler[_P, _R_co]: ...
57+
def event(self, event_handler: _Handler[_P, _R_co], /) -> _Handler[_P, _R_co]: ...
5858
@overload
5959
def event(self, namespace: str | None = None, *args, **kwargs) -> _HandlerDecorator: ...
6060
def on_namespace(self, namespace_handler: Namespace) -> None: ...

stubs/Markdown/markdown/core.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ from .util import HtmlStash, Registry
1010
# TODO: The following protocols can be replaced by their counterparts from
1111
# codecs, once they have been propagated to all type checkers.
1212
class _WritableStream(Protocol):
13-
def write(self, __data: bytes) -> object: ...
14-
def seek(self, __offset: int, __whence: int) -> object: ...
13+
def write(self, data: bytes, /) -> object: ...
14+
def seek(self, offset: int, whence: int, /) -> object: ...
1515
def close(self) -> object: ...
1616

1717
class _ReadableStream(Protocol):
18-
def read(self, __size: int = ...) -> bytes: ...
19-
def seek(self, __offset: int, __whence: int) -> object: ...
18+
def read(self, size: int = ..., /) -> bytes: ...
19+
def seek(self, offset: int, whence: int, /) -> object: ...
2020
def close(self) -> object: ...
2121

2222
class Markdown:

stubs/Pillow/PIL/Image.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ _Color: TypeAlias = (
3434
)
3535

3636
class _Writeable(SupportsWrite[bytes], Protocol):
37-
def seek(self, __offset: int) -> Any: ...
37+
def seek(self, offset: int, /) -> Any: ...
3838

3939
# Ref: https://numpy.org/doc/stable/reference/arrays.interface.html#python-side
4040
class _SupportsArrayInterface(Protocol):

stubs/Pillow/PIL/ImageFont.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Layout(IntEnum):
1212
MAX_STRING_LENGTH: Final[int] = 1_000_000
1313

1414
class _Font(Protocol):
15-
def getmask(self, __text: str | bytes, __mode: str = ..., direction=..., features=...): ...
15+
def getmask(self, text: str | bytes, mode: str = ..., /, direction=..., features=...): ...
1616

1717
class ImageFont:
1818
def getmask(self, text: str | bytes, mode: str = "", direction=..., features=...): ...

stubs/Pillow/PIL/ImageOps.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ from .ImageColor import _Ink
99
_Border: TypeAlias = int | tuple[int, int] | tuple[int, int, int, int]
1010

1111
class _Deformer(Protocol):
12-
def getmesh(self, __image: Image): ...
12+
def getmesh(self, image: Image, /): ...
1313

1414
def autocontrast(
1515
image: Image,

stubs/Pillow/PIL/_imaging.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ class _PixelAccessor(Protocol): # noqa: Y046
1717
#
1818
# This protocol describes that interface.
1919
# TODO: should the color args and getter return types be _Color?
20-
def __setitem__(self, __xy: tuple[int, int], __color: Incomplete) -> None: ...
21-
def __getitem__(self, __xy: tuple[int, int]) -> Incomplete: ...
22-
def putpixel(self, __xy: tuple[int, int], __color: Incomplete) -> None: ...
23-
def getpixel(self, __xy: tuple[int, int]) -> Incomplete: ...
20+
def __setitem__(self, xy: tuple[int, int], color: Incomplete, /) -> None: ...
21+
def __getitem__(self, xy: tuple[int, int], /) -> Incomplete: ...
22+
def putpixel(self, xy: tuple[int, int], color: Incomplete, /) -> None: ...
23+
def getpixel(self, xy: tuple[int, int], /) -> Incomplete: ...
2424

2525
class _Path:
2626
def __getattr__(self, item: str) -> Incomplete: ...
2727

28-
def path(__x: Sequence[tuple[float, float]] | Sequence[float]) -> _Path: ...
29-
def __getattr__(__name: str) -> Incomplete: ...
28+
def path(x: Sequence[tuple[float, float]] | Sequence[float], /) -> _Path: ...
29+
def __getattr__(name: str, /) -> Incomplete: ...

stubs/PyYAML/yaml/emitter.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ from .events import Event
88
_T_contra = TypeVar("_T_contra", str, bytes, contravariant=True)
99

1010
class _WriteStream(Protocol[_T_contra]):
11-
def write(self, __data: _T_contra) -> object: ...
11+
def write(self, data: _T_contra, /) -> object: ...
1212
# Optional fields:
1313
# encoding: str
1414
# def flush(self) -> object: ...

stubs/WTForms/wtforms/fields/core.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ _FieldT_contra = TypeVar("_FieldT_contra", bound=Field, contravariant=True)
1717
_Filter: TypeAlias = Callable[[Any], Any]
1818

1919
class _Validator(Protocol[_FormT_contra, _FieldT_contra]):
20-
def __call__(self, __form: _FormT_contra, __field: _FieldT_contra) -> object: ...
20+
def __call__(self, form: _FormT_contra, field: _FieldT_contra, /) -> object: ...
2121

2222
class _Widget(Protocol[_FieldT_contra]):
2323
def __call__(self, field: _FieldT_contra, **kwargs: Any) -> Markup: ...

0 commit comments

Comments
 (0)