gh-104876: Remove deprecated turtle.RawTurtle.settiltangle (#104877)

Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
Hugo van Kemenade 2023-05-26 07:25:52 +03:00 committed by GitHub
parent 705e387dd8
commit 10c45838e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 60 deletions

View file

@ -166,7 +166,6 @@ Turtle state
| :func:`resizemode` | :func:`resizemode`
| :func:`shapesize` | :func:`turtlesize` | :func:`shapesize` | :func:`turtlesize`
| :func:`shearfactor` | :func:`shearfactor`
| :func:`settiltangle`
| :func:`tiltangle` | :func:`tiltangle`
| :func:`tilt` | :func:`tilt`
| :func:`shapetransform` | :func:`shapetransform`
@ -1301,28 +1300,6 @@ Appearance
>>> turtle.fd(50) >>> turtle.fd(50)
.. function:: settiltangle(angle)
:param angle: a number
Rotate the turtleshape to point in the direction specified by *angle*,
regardless of its current tilt-angle. *Do not* change the turtle's heading
(direction of movement).
.. doctest::
:skipif: _tkinter is None or 'always; deprecated method'
>>> turtle.reset()
>>> turtle.shape("circle")
>>> turtle.shapesize(5,2)
>>> turtle.settiltangle(45)
>>> turtle.fd(50)
>>> turtle.settiltangle(-45)
>>> turtle.fd(50)
.. deprecated:: 3.1
.. function:: tiltangle(angle=None) .. function:: tiltangle(angle=None)
:param angle: a number (optional) :param angle: a number (optional)
@ -2529,8 +2506,7 @@ Changes since Python 3.0
:func:`get_shapepoly` have been added. Thus the full range of :func:`get_shapepoly` have been added. Thus the full range of
regular linear transforms is now available for transforming turtle shapes. regular linear transforms is now available for transforming turtle shapes.
:func:`tiltangle` has been enhanced in functionality: it now can :func:`tiltangle` has been enhanced in functionality: it now can
be used to get or set the tilt angle. :func:`settiltangle` has been be used to get or set the tilt angle.
deprecated.
- The :class:`Screen` method :func:`onkeypress` has been added as a complement to - The :class:`Screen` method :func:`onkeypress` has been added as a complement to
:func:`onkey`. As the latter binds actions to the key release event, :func:`onkey`. As the latter binds actions to the key release event,

View file

@ -1817,7 +1817,7 @@ Standard Library
They will be removed in Python 3.13. They will be removed in Python 3.13.
(Contributed by Serhiy Storchaka and Miro Hrončok in :gh:`92728`.) (Contributed by Serhiy Storchaka and Miro Hrončok in :gh:`92728`.)
* :func:`turtle.settiltangle` has been deprecated since Python 3.1; * :func:`!turtle.settiltangle` has been deprecated since Python 3.1;
it now emits a deprecation warning and will be removed in Python 3.13. Use it now emits a deprecation warning and will be removed in Python 3.13. Use
:func:`turtle.tiltangle` instead (it was earlier incorrectly marked :func:`turtle.tiltangle` instead (it was earlier incorrectly marked
as deprecated, and its docstring is now corrected). as deprecated, and its docstring is now corrected).

View file

@ -118,6 +118,11 @@ Removed
* Remove support for using :class:`pathlib.Path` objects as context managers. * Remove support for using :class:`pathlib.Path` objects as context managers.
This functionality was deprecated and made a no-op in Python 3.9. This functionality was deprecated and made a no-op in Python 3.9.
* Remove the :meth:`!turtle.RawTurtle.settiltangle` method,
deprecated in docs since Python 3.1
and with a deprecation warning since Python 3.11.
(Contributed by Hugo van Kemenade in :gh:`104876`.)
* Removed the following :mod:`unittest` functions, deprecated in Python 3.11: * Removed the following :mod:`unittest` functions, deprecated in Python 3.11:
* :func:`!unittest.findTestCases` * :func:`!unittest.findTestCases`
@ -130,8 +135,6 @@ Removed
* :meth:`unittest.TestLoader.loadTestsFromTestCase` * :meth:`unittest.TestLoader.loadTestsFromTestCase`
* :meth:`unittest.TestLoader.getTestCaseNames` * :meth:`unittest.TestLoader.getTestCaseNames`
(Contributed by Hugo van Kemenade in :gh:`104835`.)
* :pep:`594`: Remove the :mod:`!cgi`` and :mod:`!cgitb` modules, * :pep:`594`: Remove the :mod:`!cgi`` and :mod:`!cgitb` modules,
deprecated in Python 3.11. deprecated in Python 3.11.

View file

@ -127,7 +127,7 @@ _tg_turtle_functions = ['back', 'backward', 'begin_fill', 'begin_poly', 'bk',
'isvisible', 'left', 'lt', 'onclick', 'ondrag', 'onrelease', 'pd', 'isvisible', 'left', 'lt', 'onclick', 'ondrag', 'onrelease', 'pd',
'pen', 'pencolor', 'pendown', 'pensize', 'penup', 'pos', 'position', 'pen', 'pencolor', 'pendown', 'pensize', 'penup', 'pos', 'position',
'pu', 'radians', 'right', 'reset', 'resizemode', 'rt', 'pu', 'radians', 'right', 'reset', 'resizemode', 'rt',
'seth', 'setheading', 'setpos', 'setposition', 'settiltangle', 'seth', 'setheading', 'setpos', 'setposition',
'setundobuffer', 'setx', 'sety', 'shape', 'shapesize', 'shapetransform', 'shearfactor', 'showturtle', 'setundobuffer', 'setx', 'sety', 'shape', 'shapesize', 'shapetransform', 'shearfactor', 'showturtle',
'speed', 'st', 'stamp', 'teleport', 'tilt', 'tiltangle', 'towards', 'speed', 'st', 'stamp', 'teleport', 'tilt', 'tiltangle', 'towards',
'turtlesize', 'undo', 'undobufferentries', 'up', 'width', 'turtlesize', 'undo', 'undobufferentries', 'up', 'width',
@ -2896,33 +2896,6 @@ class RawTurtle(TPen, TNavigator):
return self._shearfactor return self._shearfactor
self.pen(resizemode="user", shearfactor=shear) self.pen(resizemode="user", shearfactor=shear)
def settiltangle(self, angle):
"""Rotate the turtleshape to point in the specified direction
Argument: angle -- number
Rotate the turtleshape to point in the direction specified by angle,
regardless of its current tilt-angle. DO NOT change the turtle's
heading (direction of movement).
Deprecated since Python 3.1
Examples (for a Turtle instance named turtle):
>>> turtle.shape("circle")
>>> turtle.shapesize(5,2)
>>> turtle.settiltangle(45)
>>> turtle.stamp()
>>> turtle.fd(50)
>>> turtle.settiltangle(-45)
>>> turtle.stamp()
>>> turtle.fd(50)
"""
warnings._deprecated("turtle.RawTurtle.settiltangle()",
"{name!r} is deprecated since Python 3.1 and scheduled "
"for removal in Python {remove}. Use tiltangle() instead.",
remove=(3, 13))
self.tiltangle(angle)
def tiltangle(self, angle=None): def tiltangle(self, angle=None):
"""Set or return the current tilt-angle. """Set or return the current tilt-angle.
@ -2935,9 +2908,6 @@ class RawTurtle(TPen, TNavigator):
between the orientation of the turtleshape and the heading of the between the orientation of the turtleshape and the heading of the
turtle (its direction of movement). turtle (its direction of movement).
(Incorrectly marked as deprecated since Python 3.1, it is really
settiltangle that is deprecated.)
Examples (for a Turtle instance named turtle): Examples (for a Turtle instance named turtle):
>>> turtle.shape("circle") >>> turtle.shape("circle")
>>> turtle.shapesize(5, 2) >>> turtle.shapesize(5, 2)

View file

@ -440,7 +440,7 @@ Added missing kw_only parameter to dataclasses.make_dataclass().
.. nonce: aGyr1I .. nonce: aGyr1I
.. section: Library .. section: Library
The :meth:`turtle.RawTurtle.settiltangle` is deprecated since Python 3.1, it The :meth:`!turtle.RawTurtle.settiltangle` is deprecated since Python 3.1, it
now emits a deprecation warning and will be removed in Python 3.13. now emits a deprecation warning and will be removed in Python 3.13.
Use :meth:`turtle.RawTurtle.tiltangle` instead. Use :meth:`turtle.RawTurtle.tiltangle` instead.

View file

@ -0,0 +1,3 @@
Remove the :meth:`!turtle.RawTurtle.settiltangle` method, deprecated in docs
since Python 3.1 and with a deprecation warning since Python 3.11. Patch by
Hugo van Kemenade.