Use typing_extensions.Self instead of _typeshed.Self (#9702)

This commit is contained in:
Alex Waygood
2023-02-15 11:32:43 +01:00
committed by GitHub
parent 8cd6d81f15
commit 7180d0223b
140 changed files with 597 additions and 610 deletions

View File

@@ -1,11 +1,10 @@
import sys
import threading
from _typeshed import Self
from collections.abc import Callable
from queue import Queue
from types import ModuleType, TracebackType
from typing import Any, ClassVar, Generic, TypeVar
from typing_extensions import ParamSpec, TypedDict
from typing_extensions import ParamSpec, Self, TypedDict
_T = TypeVar("_T")
_AbstractListener_T = TypeVar("_AbstractListener_T", bound=AbstractListener)
@@ -37,7 +36,7 @@ class AbstractListener(threading.Thread):
@property
def running(self) -> bool: ...
def stop(self) -> None: ...
def __enter__(self: Self) -> Self: ...
def __enter__(self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
@@ -60,11 +59,11 @@ class Events(Generic[_T, _AbstractListener_T]):
_listener: _AbstractListener_T # undocumented
start: Callable[[], None]
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def __enter__(self: Self) -> Self: ...
def __enter__(self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
def __iter__(self: Self) -> Self: ...
def __iter__(self) -> Self: ...
def __next__(self) -> _T: ...
def get(self, timeout: float | None = ...) -> _T | None: ...
def _event_mapper(self, event: Callable[_P, object]) -> Callable[_P, None]: ...

View File

@@ -1,9 +1,9 @@
import contextlib
import enum
import sys
from _typeshed import Self
from collections.abc import Callable, Iterable, Iterator
from typing import Any, ClassVar
from typing_extensions import Self
from pynput._util import AbstractListener
@@ -16,13 +16,13 @@ class KeyCode:
def __init__(self, vk: str | None = ..., char: str | None = ..., is_dead: bool = ..., **kwargs: str) -> None: ...
def __eq__(self, other: object) -> bool: ...
def __hash__(self) -> int: ...
def join(self: Self, key: Self) -> Self: ...
def join(self, key: Self) -> Self: ...
@classmethod
def from_vk(cls: type[Self], vk: int, **kwargs: Any) -> Self: ...
def from_vk(cls, vk: int, **kwargs: Any) -> Self: ...
@classmethod
def from_char(cls: type[Self], char: str, **kwargs: Any) -> Self: ...
def from_char(cls, char: str, **kwargs: Any) -> Self: ...
@classmethod
def from_dead(cls: type[Self], char: str, **kwargs: Any) -> Self: ...
def from_dead(cls, char: str, **kwargs: Any) -> Self: ...
class Key(enum.Enum):
alt: int

View File

@@ -1,9 +1,9 @@
import enum
import sys
from _typeshed import Self
from collections.abc import Callable
from types import TracebackType
from typing import Any
from typing_extensions import Self
from pynput._util import AbstractListener
@@ -55,7 +55,7 @@ class Controller:
def release(self, button: Button) -> None: ...
def move(self, dx: int, dy: int) -> None: ...
def click(self, button: Button, count: int = ...) -> None: ...
def __enter__(self: Self) -> Self: ...
def __enter__(self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...