mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-20 08:38:26 +08:00
make sure typevars defined in stubs are private (#989)
And also a few type aliases I noticed in the process.
Found using 59f9cac095
This commit is contained in:
committed by
Guido van Rossum
parent
984307bf45
commit
eb07fd3c1a
@@ -815,12 +815,12 @@ class ellipsis: ...
|
||||
Ellipsis = ... # type: ellipsis
|
||||
|
||||
# TODO: buffer support is incomplete; e.g. some_string.startswith(some_buffer) doesn't type check.
|
||||
AnyBuffer = TypeVar('AnyBuffer', str, unicode, bytearray, buffer)
|
||||
_AnyBuffer = TypeVar('_AnyBuffer', str, unicode, bytearray, buffer)
|
||||
|
||||
class buffer(Sized):
|
||||
def __init__(self, object: AnyBuffer, offset: int = ..., size: int = ...) -> None: ...
|
||||
def __add__(self, other: AnyBuffer) -> str: ...
|
||||
def __cmp__(self, other: AnyBuffer) -> bool: ...
|
||||
def __init__(self, object: _AnyBuffer, offset: int = ..., size: int = ...) -> None: ...
|
||||
def __add__(self, other: _AnyBuffer) -> str: ...
|
||||
def __cmp__(self, other: _AnyBuffer) -> bool: ...
|
||||
def __getitem__(self, key: Union[int, slice]) -> str: ...
|
||||
def __getslice__(self, i: int, j: int) -> str: ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
from typing import (Any, Generic, IO, Iterable, Sequence, TypeVar,
|
||||
Union, overload, Iterator, Tuple, BinaryIO, List)
|
||||
|
||||
T = TypeVar('T')
|
||||
_T = TypeVar('_T')
|
||||
|
||||
class array(Generic[T]):
|
||||
def __init__(self, typecode: str, init: Iterable[T] = ...) -> None: ...
|
||||
def __add__(self, y: "array[T]") -> "array[T]": ...
|
||||
class array(Generic[_T]):
|
||||
def __init__(self, typecode: str, init: Iterable[_T] = ...) -> None: ...
|
||||
def __add__(self, y: "array[_T]") -> "array[_T]": ...
|
||||
def __contains__(self, y: Any) -> bool: ...
|
||||
def __copy__(self) -> "array[T]": ...
|
||||
def __copy__(self) -> "array[_T]": ...
|
||||
def __deepcopy__(self) -> "array": ...
|
||||
def __delitem__(self, y: Union[slice, int]) -> None: ...
|
||||
def __delslice__(self, i: int, j: int) -> None: ...
|
||||
@@ -17,39 +17,39 @@ class array(Generic[T]):
|
||||
def __getitem__(self, i: int) -> Any: ...
|
||||
@overload
|
||||
def __getitem__(self, s: slice) -> "array": ...
|
||||
def __iadd__(self, y: "array[T]") -> "array[T]": ...
|
||||
def __imul__(self, y: int) -> "array[T]": ...
|
||||
def __iter__(self) -> Iterator[T]: ...
|
||||
def __iadd__(self, y: "array[_T]") -> "array[_T]": ...
|
||||
def __imul__(self, y: int) -> "array[_T]": ...
|
||||
def __iter__(self) -> Iterator[_T]: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __mul__(self, n: int) -> "array[T]": ...
|
||||
def __rmul__(self, n: int) -> "array[T]": ...
|
||||
def __mul__(self, n: int) -> "array[_T]": ...
|
||||
def __rmul__(self, n: int) -> "array[_T]": ...
|
||||
@overload
|
||||
def __setitem__(self, i: int, y: T) -> None: ...
|
||||
def __setitem__(self, i: int, y: _T) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, i: slice, y: "array[T]") -> None: ...
|
||||
def __setitem__(self, i: slice, y: "array[_T]") -> None: ...
|
||||
|
||||
def append(self, x: T) -> None: ...
|
||||
def append(self, x: _T) -> None: ...
|
||||
def buffer_info(self) -> Tuple[int, int]: ...
|
||||
def byteswap(self) -> None:
|
||||
raise RuntimeError()
|
||||
def count(self) -> int: ...
|
||||
def extend(self, x: Sequence[T]) -> None: ...
|
||||
def fromlist(self, list: List[T]) -> None:
|
||||
def extend(self, x: Sequence[_T]) -> None: ...
|
||||
def fromlist(self, list: List[_T]) -> None:
|
||||
raise EOFError()
|
||||
raise IOError()
|
||||
def fromfile(self, f: BinaryIO, n: int) -> None: ...
|
||||
def fromstring(self, s: str) -> None: ...
|
||||
def fromunicode(self, u: unicode) -> None: ...
|
||||
def index(self, x: T) -> int: ...
|
||||
def insert(self, i: int, x: T) -> None: ...
|
||||
def pop(self, i: int = ...) -> T: ...
|
||||
def index(self, x: _T) -> int: ...
|
||||
def insert(self, i: int, x: _T) -> None: ...
|
||||
def pop(self, i: int = ...) -> _T: ...
|
||||
def read(self, f: IO[str], n: int) -> None:
|
||||
raise DeprecationWarning()
|
||||
def remove(self, x: T) -> None: ...
|
||||
def remove(self, x: _T) -> None: ...
|
||||
def reverse(self) -> None: ...
|
||||
def tofile(self, f: BinaryIO) -> None:
|
||||
raise IOError()
|
||||
def tolist(self) -> List[T]: ...
|
||||
def tolist(self) -> List[_T]: ...
|
||||
def tostring(self) -> str: ...
|
||||
def tounicode(self) -> unicode: ...
|
||||
def write(self, f: IO[str]) -> None:
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
from typing import Any, Sequence, TypeVar
|
||||
|
||||
T = TypeVar('T')
|
||||
def bisect(a: Sequence[T], x: T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def bisect_left(a: Sequence[T], x: T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def bisect_right(a: Sequence[T], x: T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def insort(a: Sequence[T], x: T, lo: int = ..., hi: int = ...) -> None: ...
|
||||
def insort_left(a: Sequence[T], x: T, lo: int = ..., hi: int = ...) -> None: ...
|
||||
def insort_right(a: Sequence[T], x: T, lo: int = ..., hi: int = ...) -> None: ...
|
||||
_T = TypeVar('_T')
|
||||
def bisect(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def bisect_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
|
||||
def insort(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> None: ...
|
||||
def insort_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> None: ...
|
||||
def insort_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> None: ...
|
||||
|
||||
@@ -4,7 +4,7 @@ from .coroutines import coroutine
|
||||
from .events import AbstractEventLoop
|
||||
from .futures import Future
|
||||
|
||||
T = TypeVar('T')
|
||||
_T = TypeVar('_T')
|
||||
|
||||
__all__ = ... # type: str
|
||||
|
||||
@@ -44,7 +44,7 @@ class Condition(_ContextManagerMixin):
|
||||
@coroutine
|
||||
def wait(self) -> Generator[Any, None, bool]: ...
|
||||
@coroutine
|
||||
def wait_for(self, predicate: Callable[[], T]) -> Generator[Any, None, T]: ...
|
||||
def wait_for(self, predicate: Callable[[], _T]) -> Generator[Any, None, _T]: ...
|
||||
def notify(self, n: int = 1) -> None: ...
|
||||
def notify_all(self) -> None: ...
|
||||
|
||||
|
||||
@@ -10,13 +10,13 @@ __all__ = ... # type: str
|
||||
class QueueEmpty(Exception): ...
|
||||
class QueueFull(Exception): ...
|
||||
|
||||
T = TypeVar('T')
|
||||
_T = TypeVar('_T')
|
||||
|
||||
class Queue(Generic[T]):
|
||||
class Queue(Generic[_T]):
|
||||
def __init__(self, maxsize: int = ..., *, loop: AbstractEventLoop = ...) -> None: ...
|
||||
def _init(self, maxsize: int) -> None: ...
|
||||
def _get(self) -> T: ...
|
||||
def _put(self, item: T) -> None: ...
|
||||
def _get(self) -> _T: ...
|
||||
def _put(self, item: _T) -> None: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
def _format(self) -> str: ...
|
||||
@@ -28,11 +28,11 @@ class Queue(Generic[T]):
|
||||
def empty(self) -> bool: ...
|
||||
def full(self) -> bool: ...
|
||||
@coroutine
|
||||
def put(self, item: T) -> Generator[Any, None, None]: ...
|
||||
def put_nowait(self, item: T) -> None: ...
|
||||
def put(self, item: _T) -> Generator[Any, None, None]: ...
|
||||
def put_nowait(self, item: _T) -> None: ...
|
||||
@coroutine
|
||||
def get(self) -> Generator[Any, None, T]: ...
|
||||
def get_nowait(self) -> T: ...
|
||||
def get(self) -> Generator[Any, None, _T]: ...
|
||||
def get_nowait(self) -> _T: ...
|
||||
if sys.version_info >= (3, 4):
|
||||
@coroutine
|
||||
def join(self) -> Generator[Any, None, bool]: ...
|
||||
|
||||
Reference in New Issue
Block a user