mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +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,4 +1,3 @@
|
||||
import sys
|
||||
import types
|
||||
from _weakrefset import WeakSet as WeakSet
|
||||
from typing import (
|
||||
@@ -29,9 +28,6 @@ from _weakref import (
|
||||
ref as ref,
|
||||
)
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
from exceptions import ReferenceError as ReferenceError
|
||||
|
||||
_S = TypeVar("_S")
|
||||
_T = TypeVar("_T")
|
||||
_KT = TypeVar("_KT")
|
||||
@@ -39,10 +35,9 @@ _VT = TypeVar("_VT")
|
||||
|
||||
ProxyTypes: Tuple[Type[Any], ...]
|
||||
|
||||
if sys.version_info >= (3, 4):
|
||||
class WeakMethod(ref[types.MethodType]):
|
||||
def __new__(cls, meth: types.MethodType, callback: Optional[Callable[[types.MethodType], Any]] = ...) -> WeakMethod: ...
|
||||
def __call__(self) -> Optional[types.MethodType]: ...
|
||||
class WeakMethod(ref[types.MethodType]):
|
||||
def __new__(cls, meth: types.MethodType, callback: Optional[Callable[[types.MethodType], Any]] = ...) -> WeakMethod: ...
|
||||
def __call__(self) -> Optional[types.MethodType]: ...
|
||||
|
||||
class WeakValueDictionary(MutableMapping[_KT, _VT]):
|
||||
@overload
|
||||
@@ -53,24 +48,14 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]):
|
||||
def __getitem__(self, k: _KT) -> _VT: ...
|
||||
def __setitem__(self, k: _KT, v: _VT) -> None: ...
|
||||
def __delitem__(self, v: _KT) -> None: ...
|
||||
if sys.version_info < (3, 0):
|
||||
def has_key(self, key: object) -> bool: ...
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[_KT]: ...
|
||||
def __str__(self) -> str: ...
|
||||
def copy(self) -> WeakValueDictionary[_KT, _VT]: ...
|
||||
if sys.version_info >= (3, 0):
|
||||
# These are incompatible with Mapping
|
||||
def keys(self) -> Iterator[_KT]: ... # type: ignore
|
||||
def values(self) -> Iterator[_VT]: ... # type: ignore
|
||||
def items(self) -> Iterator[Tuple[_KT, _VT]]: ... # type: ignore
|
||||
else:
|
||||
def keys(self) -> List[_KT]: ...
|
||||
def values(self) -> List[_VT]: ...
|
||||
def items(self) -> List[Tuple[_KT, _VT]]: ...
|
||||
def iterkeys(self) -> Iterator[_KT]: ...
|
||||
def itervalues(self) -> Iterator[_VT]: ...
|
||||
def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ...
|
||||
# These are incompatible with Mapping
|
||||
def keys(self) -> Iterator[_KT]: ... # type: ignore
|
||||
def values(self) -> Iterator[_VT]: ... # type: ignore
|
||||
def items(self) -> Iterator[Tuple[_KT, _VT]]: ... # type: ignore
|
||||
def itervaluerefs(self) -> Iterator[KeyedRef[_KT, _VT]]: ...
|
||||
def valuerefs(self) -> List[KeyedRef[_KT, _VT]]: ...
|
||||
|
||||
@@ -89,32 +74,20 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]):
|
||||
def __getitem__(self, k: _KT) -> _VT: ...
|
||||
def __setitem__(self, k: _KT, v: _VT) -> None: ...
|
||||
def __delitem__(self, v: _KT) -> None: ...
|
||||
if sys.version_info < (3, 0):
|
||||
def has_key(self, key: object) -> bool: ...
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[_KT]: ...
|
||||
def __str__(self) -> str: ...
|
||||
def copy(self) -> WeakKeyDictionary[_KT, _VT]: ...
|
||||
if sys.version_info >= (3, 0):
|
||||
# These are incompatible with Mapping
|
||||
def keys(self) -> Iterator[_KT]: ... # type: ignore
|
||||
def values(self) -> Iterator[_VT]: ... # type: ignore
|
||||
def items(self) -> Iterator[Tuple[_KT, _VT]]: ... # type: ignore
|
||||
else:
|
||||
def keys(self) -> List[_KT]: ...
|
||||
def values(self) -> List[_VT]: ...
|
||||
def items(self) -> List[Tuple[_KT, _VT]]: ...
|
||||
def iterkeys(self) -> Iterator[_KT]: ...
|
||||
def itervalues(self) -> Iterator[_VT]: ...
|
||||
def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ...
|
||||
def iterkeyrefs(self) -> Iterator[ref[_KT]]: ...
|
||||
# These are incompatible with Mapping
|
||||
def keys(self) -> Iterator[_KT]: ... # type: ignore
|
||||
def values(self) -> Iterator[_VT]: ... # type: ignore
|
||||
def items(self) -> Iterator[Tuple[_KT, _VT]]: ... # type: ignore
|
||||
def keyrefs(self) -> List[ref[_KT]]: ...
|
||||
|
||||
if sys.version_info >= (3, 4):
|
||||
class finalize:
|
||||
def __init__(self, __obj: object, __func: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ...
|
||||
def __call__(self, _: Any = ...) -> Optional[Any]: ...
|
||||
def detach(self) -> Optional[Tuple[Any, Any, Tuple[Any, ...], Dict[str, Any]]]: ...
|
||||
def peek(self) -> Optional[Tuple[Any, Any, Tuple[Any, ...], Dict[str, Any]]]: ...
|
||||
alive: bool
|
||||
atexit: bool
|
||||
class finalize:
|
||||
def __init__(self, __obj: object, __func: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ...
|
||||
def __call__(self, _: Any = ...) -> Optional[Any]: ...
|
||||
def detach(self) -> Optional[Tuple[Any, Any, Tuple[Any, ...], Dict[str, Any]]]: ...
|
||||
def peek(self) -> Optional[Tuple[Any, Any, Tuple[Any, ...], Dict[str, Any]]]: ...
|
||||
alive: bool
|
||||
atexit: bool
|
||||
|
||||
Reference in New Issue
Block a user