mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 13:34:58 +08:00
Akuli and srittau: Remove Python 2 branches from Python 3 stubs (#5461)
* run script and do some manual changes (Akuli) * do the whole thing manually (srittau) * merge changes (Akuli) Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
This commit is contained in:
@@ -1,13 +1,6 @@
|
||||
import sys
|
||||
from tkinter import Canvas, PhotoImage
|
||||
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
|
||||
|
||||
# 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
|
||||
@@ -32,17 +25,16 @@ 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]: ...
|
||||
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 +94,8 @@ 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
|
||||
def onkeypress(self, fun: Callable[[], Any], key: Optional[str] = ...) -> None: ...
|
||||
onkeyrelease = onkey
|
||||
|
||||
class TNavigator(object):
|
||||
START_ORIENTATION: Dict[str, Vec2D] = ...
|
||||
@@ -239,19 +230,18 @@ 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]: ...
|
||||
@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: ...
|
||||
@@ -317,12 +307,10 @@ def write_docstringdict(filename: str = ...) -> None: ...
|
||||
# Note: mainloop() was always present in the global scope, but was added to
|
||||
# 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]: ...
|
||||
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:
|
||||
|
||||
@@ -375,9 +363,10 @@ 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
|
||||
|
||||
def onkeypress(fun: Callable[[], Any], key: Optional[str] = ...) -> None: ...
|
||||
|
||||
onkeyrelease = onkey
|
||||
|
||||
# Functions copied from _Screen:
|
||||
|
||||
@@ -508,21 +497,19 @@ 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: ...
|
||||
@overload
|
||||
def shearfactor(shear: None = ...) -> float: ...
|
||||
@overload
|
||||
def shearfactor(shear: 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]: ...
|
||||
|
||||
# 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: ...
|
||||
|
||||
Reference in New Issue
Block a user