mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-03-15 11:16:46 +08:00
clean python 3 specific stuff from stdlib/@python2 stubs (#5451)
This commit is contained in:
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user