Use typing_extensions.Self in the stdlib (#9694)

This commit is contained in:
Alex Waygood
2023-02-09 09:12:13 +00:00
committed by GitHub
parent 10086c06a1
commit 9ed39d8796
98 changed files with 627 additions and 654 deletions

View File

@@ -1,8 +1,7 @@
from _typeshed import Self
from collections.abc import Callable, Sequence
from tkinter import Canvas, Frame, Misc, PhotoImage, Scrollbar
from typing import Any, ClassVar, overload
from typing_extensions import TypeAlias
from typing_extensions import Self, TypeAlias
__all__ = [
"ScrolledCanvas",
@@ -143,7 +142,7 @@ _Speed: TypeAlias = str | float
_PolygonCoords: TypeAlias = Sequence[tuple[float, float]]
class Vec2D(tuple[float, float]):
def __new__(cls: type[Self], x: float, y: float) -> Self: ...
def __new__(cls, x: float, y: float) -> Self: ...
def __add__(self, other: tuple[float, float]) -> Vec2D: ... # type: ignore[override]
@overload # type: ignore[override]
def __mul__(self, other: Vec2D) -> float: ...
@@ -366,7 +365,7 @@ class RawTurtle(TPen, TNavigator):
def setundobuffer(self, size: int | None) -> None: ...
def undobufferentries(self) -> int: ...
def clear(self) -> None: ...
def clone(self: Self) -> Self: ...
def clone(self) -> Self: ...
@overload
def shape(self, name: None = None) -> str: ...
@overload
@@ -411,7 +410,7 @@ class RawTurtle(TPen, TNavigator):
def end_poly(self) -> None: ...
def get_poly(self) -> _PolygonCoords | None: ...
def getscreen(self) -> TurtleScreen: ...
def getturtle(self: Self) -> Self: ...
def getturtle(self) -> Self: ...
getpen = getturtle
def onclick(self, fun: Callable[[float, float], object], btn: int = 1, add: bool | None = None) -> None: ...
def onrelease(self, fun: Callable[[float, float], object], btn: int = 1, add: bool | None = None) -> None: ...