Use PEP 585 syntax wherever possible (#6717)

This commit is contained in:
Alex Waygood
2021-12-28 10:31:43 +00:00
committed by GitHub
parent e6cb341d94
commit 8d5d2520ac
237 changed files with 966 additions and 1069 deletions

View File

@@ -1,22 +1,22 @@
from tkinter import Canvas, Frame, PhotoImage
from typing import Any, Callable, ClassVar, Dict, Sequence, Tuple, TypeVar, Union, overload
from typing import Any, Callable, ClassVar, Sequence, TypeVar, Union, overload
# Note: '_Color' is the alias we use for arguments and _AnyColor is the
# alias we use for return types. Really, these two aliases should be the
# same, but as per the "no union returns" typeshed policy, we'll return
# Any instead.
_Color = Union[str, Tuple[float, float, float]]
_Color = Union[str, tuple[float, float, float]]
_AnyColor = Any
# TODO: Replace this with a TypedDict once it becomes standardized.
_PenState = Dict[str, Any]
_PenState = dict[str, Any]
_Speed = Union[str, float]
_PolygonCoords = Sequence[Tuple[float, float]]
_PolygonCoords = Sequence[tuple[float, float]]
# TODO: Type this more accurately
# Vec2D is actually a custom subclass of 'tuple'.
Vec2D = Tuple[float, float]
Vec2D = tuple[float, float]
class ScrolledCanvas(Frame): ...
@@ -251,7 +251,7 @@ class RawTurtle(TPen, TNavigator):
# a compound stamp or not. So, as per the "no Union return" policy,
# we return Any.
def stamp(self) -> Any: ...
def clearstamp(self, stampid: int | Tuple[int, ...]) -> None: ...
def clearstamp(self, stampid: int | tuple[int, ...]) -> None: ...
def clearstamps(self, n: int | None = ...) -> None: ...
def filling(self) -> bool: ...
def begin_fill(self) -> None: ...
@@ -516,7 +516,7 @@ def tilt(angle: float) -> None: ...
# a compound stamp or not. So, as per the "no Union return" policy,
# we return Any.
def stamp() -> Any: ...
def clearstamp(stampid: int | Tuple[int, ...]) -> None: ...
def clearstamp(stampid: int | tuple[int, ...]) -> None: ...
def clearstamps(n: int | None = ...) -> None: ...
def filling() -> bool: ...
def begin_fill() -> None: ...