From c04bdeb092ebe3a7da30498b5b3f02930ac591e2 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Wed, 9 Aug 2023 11:52:54 +0300 Subject: [PATCH 1/4] Update `turtle` to 3.12 --- stdlib/turtle.pyi | 10 ++++++++++ tests/stubtest_allowlists/py312.txt | 5 ----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/stdlib/turtle.pyi b/stdlib/turtle.pyi index 5df3e4b90cb5..a6b76febfab5 100644 --- a/stdlib/turtle.pyi +++ b/stdlib/turtle.pyi @@ -1,3 +1,4 @@ +import sys from collections.abc import Callable, Sequence from tkinter import Canvas, Frame, Misc, PhotoImage, Scrollbar from typing import Any, ClassVar, overload @@ -127,6 +128,8 @@ __all__ = [ "done", "Terminator", ] +if sys.version_info >= (3, 12): + __all__ += ["teleport"] # 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 @@ -249,6 +252,8 @@ class TNavigator: def reset(self) -> None: ... def degrees(self, fullcircle: float = 360.0) -> None: ... def radians(self) -> None: ... + if sys.version_info >= (3, 12): + def teleport(self, x: float | None = None, y: float | None = None, *, fill_gap: bool = False) -> None: ... def forward(self, distance: float) -> None: ... def back(self, distance: float) -> None: ... def right(self, angle: float) -> None: ... @@ -321,6 +326,8 @@ class TPen: def color(self, r: float, g: float, b: float) -> None: ... @overload def color(self, color1: _Color, color2: _Color) -> None: ... + if sys.version_info >= (3, 12): + def teleport(self, x: float | None = None, y: float | None = None, *, fill_gap: bool = False) -> None: ... def showturtle(self) -> None: ... def hideturtle(self) -> None: ... def isvisible(self) -> bool: ... @@ -641,6 +648,9 @@ def shape(name: None = None) -> str: ... @overload def shape(name: str) -> None: ... +if sys.version_info >= (3, 12): + def teleport(x: float | None = None, y: float | None = None, *, fill_gap: bool = False) -> None: ... + # Unsafely overlaps when no arguments are provided @overload def shapesize() -> tuple[float, float, float]: ... # type: ignore[misc] diff --git a/tests/stubtest_allowlists/py312.txt b/tests/stubtest_allowlists/py312.txt index 6222c60f0505..bce6f00276a4 100644 --- a/tests/stubtest_allowlists/py312.txt +++ b/tests/stubtest_allowlists/py312.txt @@ -60,11 +60,6 @@ smtplib.SMTP_SSL.__init__ sre_parse.Tokenizer.checkgroupname sre_parse.expand_template sre_parse.parse_template -turtle.RawTurtle.teleport -turtle.TNavigator.teleport -turtle.TPen.teleport -turtle.__all__ -turtle.teleport typing.ParamSpec.__mro_entries__ typing.ParamSpecArgs.__mro_entries__ typing.ParamSpecKwargs.__mro_entries__ From 1fafc3291b1d5e517d7f42586df66759d8e69793 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 9 Aug 2023 08:54:19 +0000 Subject: [PATCH 2/4] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stdlib/turtle.pyi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stdlib/turtle.pyi b/stdlib/turtle.pyi index a6b76febfab5..089dc7c9e358 100644 --- a/stdlib/turtle.pyi +++ b/stdlib/turtle.pyi @@ -254,6 +254,7 @@ class TNavigator: def radians(self) -> None: ... if sys.version_info >= (3, 12): def teleport(self, x: float | None = None, y: float | None = None, *, fill_gap: bool = False) -> None: ... + def forward(self, distance: float) -> None: ... def back(self, distance: float) -> None: ... def right(self, angle: float) -> None: ... @@ -328,6 +329,7 @@ class TPen: def color(self, color1: _Color, color2: _Color) -> None: ... if sys.version_info >= (3, 12): def teleport(self, x: float | None = None, y: float | None = None, *, fill_gap: bool = False) -> None: ... + def showturtle(self) -> None: ... def hideturtle(self) -> None: ... def isvisible(self) -> bool: ... From 285c7d7bc819630ff99c2217a5bde9641862c0c7 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Thu, 10 Aug 2023 13:31:00 +0300 Subject: [PATCH 3/4] Revert module level `teleport` --- stdlib/turtle.pyi | 3 --- tests/stubtest_allowlists/py312.txt | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/stdlib/turtle.pyi b/stdlib/turtle.pyi index 089dc7c9e358..3c182232d161 100644 --- a/stdlib/turtle.pyi +++ b/stdlib/turtle.pyi @@ -650,9 +650,6 @@ def shape(name: None = None) -> str: ... @overload def shape(name: str) -> None: ... -if sys.version_info >= (3, 12): - def teleport(x: float | None = None, y: float | None = None, *, fill_gap: bool = False) -> None: ... - # Unsafely overlaps when no arguments are provided @overload def shapesize() -> tuple[float, float, float]: ... # type: ignore[misc] diff --git a/tests/stubtest_allowlists/py312.txt b/tests/stubtest_allowlists/py312.txt index bce6f00276a4..0d66a8462508 100644 --- a/tests/stubtest_allowlists/py312.txt +++ b/tests/stubtest_allowlists/py312.txt @@ -93,6 +93,10 @@ zipfile.Path.match zipfile.Path.relative_to zipfile.Path.rglob +# TODO: remove after rc2 release +turtle.__all__ +turtle.teleport + # Errors that also existed on Python 3.11 _collections_abc.AsyncGenerator.ag_await _collections_abc.AsyncGenerator.ag_code From 67278e01623904605348f98a6ec32293a1347709 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Thu, 10 Aug 2023 13:34:01 +0300 Subject: [PATCH 4/4] Revert module level `teleport` --- stdlib/turtle.pyi | 2 -- 1 file changed, 2 deletions(-) diff --git a/stdlib/turtle.pyi b/stdlib/turtle.pyi index 3c182232d161..80ea40879dee 100644 --- a/stdlib/turtle.pyi +++ b/stdlib/turtle.pyi @@ -128,8 +128,6 @@ __all__ = [ "done", "Terminator", ] -if sys.version_info >= (3, 12): - __all__ += ["teleport"] # 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