Use _typeshed.Self in Python 2, too (#6932)

This commit is contained in:
Alex Waygood
2022-01-16 22:44:51 +00:00
committed by GitHub
parent 0949e9e90d
commit 6a88d5e7ae
29 changed files with 156 additions and 160 deletions

View File

@@ -1,4 +1,5 @@
from typing import Any, Callable, Dict, List, Sequence, Text, Tuple, TypeVar, Union, overload
from _typeshed import Self
from typing import Any, Callable, Dict, List, Sequence, Text, Tuple, Union, overload
# TODO: Replace these aliases once we have Python 2 stubs for the Tkinter module.
Canvas = Any
@@ -199,8 +200,6 @@ class TPen(object):
st = showturtle
ht = hideturtle
_T = TypeVar("_T")
class RawTurtle(TPen, TNavigator):
def __init__(
self, canvas: Canvas | TurtleScreen | None = ..., shape: str = ..., undobuffersize: int = ..., visible: bool = ...
@@ -209,7 +208,7 @@ class RawTurtle(TPen, TNavigator):
def setundobuffer(self, size: int | None) -> None: ...
def undobufferentries(self) -> int: ...
def clear(self) -> None: ...
def clone(self: _T) -> _T: ...
def clone(self: Self) -> Self: ...
@overload
def shape(self, name: None = ...) -> str: ...
@overload
@@ -242,7 +241,7 @@ class RawTurtle(TPen, TNavigator):
def end_poly(self) -> None: ...
def get_poly(self) -> _PolygonCoords | None: ...
def getscreen(self) -> TurtleScreen: ...
def getturtle(self: _T) -> _T: ...
def getturtle(self: Self) -> Self: ...
getpen = getturtle
def onclick(self, fun: Callable[[float, float], Any], btn: int = ..., add: bool | None = ...) -> None: ...
def onrelease(self, fun: Callable[[float, float], Any], btn: int = ..., add: bool | None = ...) -> None: ...