clean python 3 specific stuff from stdlib/@python2 stubs (#5451)

This commit is contained in:
Akuli
2021-05-15 01:19:05 +03:00
committed by GitHub
parent f94d838814
commit 5ec4f06263
121 changed files with 1024 additions and 4801 deletions

View File

@@ -1,12 +1,9 @@
import sys
from typing import Any, Callable, Dict, List, Optional, Sequence, Text, Tuple, TypeVar, Union, overload
if sys.version_info >= (3,):
from tkinter import Canvas, PhotoImage
else:
# TODO: Replace these aliases once we have Python 2 stubs for the Tkinter module.
Canvas = Any
PhotoImage = Any
# TODO: Replace these aliases once we have Python 2 stubs for the Tkinter module.
Canvas = Any
PhotoImage = Any
# 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
@@ -32,17 +29,6 @@ class TurtleScreenBase(object):
xscale: float = ...
yscale: float = ...
def __init__(self, cv: Canvas) -> None: ...
if sys.version_info >= (3,):
def mainloop(self) -> None: ...
def textinput(self, title: str, prompt: str) -> Optional[str]: ...
def numinput(
self,
title: str,
prompt: str,
default: Optional[float] = ...,
minval: Optional[float] = ...,
maxval: Optional[float] = ...,
) -> Optional[float]: ...
class Terminator(Exception): ...
class TurtleGraphicsError(Exception): ...
@@ -102,9 +88,6 @@ class TurtleScreen(TurtleScreenBase):
resetscreen = reset
clearscreen = clear
addshape = register_shape
if sys.version_info >= (3,):
def onkeypress(self, fun: Callable[[], Any], key: Optional[str] = ...) -> None: ...
onkeyrelease = onkey
class TNavigator(object):
START_ORIENTATION: Dict[str, Vec2D] = ...
@@ -239,19 +222,6 @@ class RawTurtle(TPen, TNavigator):
def shapesize(
self, stretch_wid: Optional[float] = ..., stretch_len: Optional[float] = ..., outline: Optional[float] = ...
) -> None: ...
if sys.version_info >= (3,):
@overload
def shearfactor(self, shear: None = ...) -> float: ...
@overload
def shearfactor(self, shear: float) -> None: ...
# Unsafely overlaps when no arguments are provided
@overload
def shapetransform(self) -> Tuple[float, float, float, float]: ... # type: ignore
@overload
def shapetransform(
self, t11: Optional[float] = ..., t12: Optional[float] = ..., t21: Optional[float] = ..., t22: Optional[float] = ...
) -> None: ...
def get_shapepoly(self) -> Optional[_PolygonCoords]: ...
def settiltangle(self, angle: float) -> None: ...
@overload
def tiltangle(self, angle: None = ...) -> float: ...
@@ -318,12 +288,6 @@ def write_docstringdict(filename: str = ...) -> None: ...
# TurtleScreenBase in Python 3.0
def mainloop() -> None: ...
if sys.version_info >= (3,):
def textinput(title: str, prompt: str) -> Optional[str]: ...
def numinput(
title: str, prompt: str, default: Optional[float] = ..., minval: Optional[float] = ..., maxval: Optional[float] = ...
) -> Optional[float]: ...
# Functions copied from TurtleScreen:
def clear() -> None: ...
@@ -375,10 +339,6 @@ onscreenclick = onclick
resetscreen = reset
clearscreen = clear
addshape = register_shape
if sys.version_info >= (3,):
def onkeypress(fun: Callable[[], Any], key: Optional[str] = ...) -> None: ...
onkeyrelease = onkey
# Functions copied from _Screen:
def setup(width: float = ..., height: float = ..., startx: Optional[int] = ..., starty: Optional[int] = ...) -> None: ...
@@ -508,21 +468,6 @@ def shape(name: str) -> None: ...
def shapesize() -> Tuple[float, float, float]: ... # type: ignore
@overload
def shapesize(stretch_wid: Optional[float] = ..., stretch_len: Optional[float] = ..., outline: Optional[float] = ...) -> None: ...
if sys.version_info >= (3,):
@overload
def shearfactor(shear: None = ...) -> float: ...
@overload
def shearfactor(shear: float) -> None: ...
# Unsafely overlaps when no arguments are provided
@overload
def shapetransform() -> Tuple[float, float, float, float]: ... # type: ignore
@overload
def shapetransform(
t11: Optional[float] = ..., t12: Optional[float] = ..., t21: Optional[float] = ..., t22: Optional[float] = ...
) -> None: ...
def get_shapepoly() -> Optional[_PolygonCoords]: ...
def settiltangle(angle: float) -> None: ...
@overload
def tiltangle(angle: None = ...) -> float: ...