Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions stdlib/2/_collections.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,14 @@ class deque(Generic[_T]):
def count(self, x: Any) -> int: ...
def extend(self, iterable: Iterator[_T]) -> None: ...
def extendleft(self, iterable: Iterator[_T]) -> None: ...
def pop(self) -> _T:
raise IndexError()
def popleft(self) -> _T:
raise IndexError()
def remove(self, value: _T) -> None:
raise IndexError()
def pop(self) -> _T: ...
def popleft(self) -> _T: ...
def remove(self, value: _T) -> None: ...
def reverse(self) -> None: ...
def rotate(self, n: int = ...) -> None: ...
def __contains__(self, o: Any) -> bool: ...
def __copy__(self) -> deque[_T]: ...
def __getitem__(self, i: int) -> _T:
raise IndexError()
def __getitem__(self, i: int) -> _T: ...
def __iadd__(self, other: deque[_T2]) -> deque[Union[_T, _T2]]: ...
def __iter__(self) -> Iterator[_T]: ...
def __len__(self) -> int: ...
Expand Down
20 changes: 5 additions & 15 deletions stdlib/2/_hotshot.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,19 @@
from typing import Any, List, Tuple, Dict, Generic

def coverage(a: str) -> Any: ...

def logreader(a: str) -> LogReaderType:
raise IOError()
raise RuntimeError()

def profiler(a: str, *args, **kwargs) -> Any:
raise IOError()

def logreader(a: str) -> LogReaderType: ...
def profiler(a: str, *args, **kwargs) -> Any: ...
def resolution() -> Tuple[Any, ...]: ...


class LogReaderType(object):
def close(self) -> None: ...
def fileno(self) -> int:
raise ValueError()
def fileno(self) -> int: ...

class ProfilerType(object):
def addinfo(self, a: str, b: str) -> None: ...
def close(self) -> None: ...
def fileno(self) -> int:
raise ValueError()
def fileno(self) -> int: ...
def runcall(self, *args, **kwargs) -> Any: ...
def runcode(self, a, b, *args, **kwargs) -> Any:
raise TypeError()
def runcode(self, a, b, *args, **kwargs) -> Any: ...
def start(self) -> None: ...
def stop(self) -> None: ...
10 changes: 3 additions & 7 deletions stdlib/2/_socket.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -256,23 +256,19 @@ class SocketType(object):
def accept(self) -> Tuple[SocketType, Tuple[Any, ...]]: ...
def bind(self, address: Tuple[Any, ...]) -> None: ...
def close(self) -> None: ...
def connect(self, address: Tuple[Any, ...]) -> None:
raise gaierror
raise timeout
def connect(self, address: Tuple[Any, ...]) -> None: ...
def connect_ex(self, address: Tuple[Any, ...]) -> int: ...
def dup(self) -> SocketType: ...
def fileno(self) -> int: ...
def getpeername(self) -> Tuple[Any, ...]: ...
def getsockname(self) -> Tuple[Any, ...]: ...
def getsockopt(self, level: int, option: int, buffersize: int = ...) -> str: ...
def gettimeout(self) -> float: ...
def listen(self, backlog: int) -> None:
raise error
def listen(self, backlog: int) -> None: ...
def makefile(self, mode: str = ..., buffersize: int = ...) -> IO[Any]: ...
def recv(self, buffersize: int, flags: int = ...) -> str: ...
def recv_into(self, buffer: bytearray, nbytes: int = ..., flags: int = ...) -> int: ...
def recvfrom(self, buffersize: int, flags: int = ...) -> Tuple[Any, ...]:
raise error
def recvfrom(self, buffersize: int, flags: int = ...) -> Tuple[Any, ...]: ...
def recvfrom_into(self, buffer: bytearray, nbytes: int = ...,
flags: int = ...) -> int: ...
def send(self, data: str, flags: int = ...) -> int: ...
Expand Down
22 changes: 11 additions & 11 deletions stdlib/2/_sre.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,16 @@ MAXREPEAT: long
copyright: str

class SRE_Match(object):
def start(self, group: int = ...) -> int:
raise IndexError()
def end(self, group: int = ...) -> int:
raise IndexError()
def start(self, group: int = ...) -> int: ...
def end(self, group: int = ...) -> int: ...
def expand(self, s: str) -> Any: ...
@overload
def group(self) -> str: ...
@overload
def group(self, group: int = ...) -> Optional[str]: ...
def groupdict(self) -> Dict[int, Optional[str]]: ...
def groups(self) -> Tuple[Optional[str], ...]: ...
def span(self) -> Tuple[int, int]:
raise IndexError()
def span(self) -> Tuple[int, int]: ...
@property
def regs(self) -> Tuple[Tuple[int, int], ...]: ... # undocumented

Expand All @@ -44,11 +41,14 @@ class SRE_Pattern(object):
def sub(self, repl: str, string: str, count: int = ...) -> Tuple[Any, ...]: ...
def subn(self, repl: str, string: str, count: int = ...) -> Tuple[Any, ...]: ...

def compile(pattern: str, flags: int, code: List[int],
groups: int = ...,
groupindex: Mapping[str, int] = ...,
indexgroup: Sequence[int] = ...) -> SRE_Pattern:
raise OverflowError()
def compile(
pattern: str,
flags: int,
code: List[int],
groups: int = ...,
groupindex: Mapping[str, int] = ...,
indexgroup: Sequence[int] = ...,
) -> SRE_Pattern: ...

def getcodesize() -> int: ...

Expand Down
6 changes: 2 additions & 4 deletions stdlib/2/heapq.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ class _Sortable(Protocol):

def cmp_lt(x, y) -> bool: ...
def heappush(heap: List[_T], item: _T) -> None: ...
def heappop(heap: List[_T]) -> _T:
raise IndexError() # if heap is empty
def heappop(heap: List[_T]) -> _T: ...
def heappushpop(heap: List[_T], item: _T) -> _T: ...
def heapify(x: List[_T]) -> None: ...
def heapreplace(heap: List[_T], item: _T) -> _T:
raise IndexError() # if heap is empty
def heapreplace(heap: List[_T], item: _T) -> _T: ...
def merge(*iterables: Iterable[_T]) -> Iterable[_T]: ...
def nlargest(n: int, iterable: Iterable[_T],
key: Optional[Callable[[_T], _Sortable]] = ...) -> List[_T]: ...
Expand Down
15 changes: 5 additions & 10 deletions stdlib/2/posix.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,8 @@ def fchmod(fd: int, mode: int) -> None: ...
def fchown(fd: int, uid: int, gid: int) -> None: ...
def fdatasync(fd: int) -> None: ...
def fdopen(fd: int, mode: str = ..., bufsize: int = ...) -> IO[str]: ...
def fork() -> int:
raise OSError()
def forkpty() -> Tuple[int, int]:
raise OSError()
def fork() -> int: ...
def forkpty() -> Tuple[int, int]: ...
def fpathconf(fd: int, name: str) -> None: ...
def fstat(fd: int) -> stat_result: ...
def fstatvfs(fd: int) -> statvfs_result: ...
Expand All @@ -128,8 +126,7 @@ def getegid() -> int: ...
def geteuid() -> int: ...
def getgid() -> int: ...
def getgroups() -> List[int]: ...
def getloadavg() -> Tuple[float, float, float]:
raise OSError()
def getloadavg() -> Tuple[float, float, float]: ...
def getlogin() -> str: ...
def getpgid(pid: int) -> int: ...
def getpgrp() -> int: ...
Expand Down Expand Up @@ -195,12 +192,10 @@ def uname() -> Tuple[str, str, str, str, str]: ...
def unlink(path: unicode) -> None: ...
def unsetenv(varname: str) -> None: ...
def urandom(n: int) -> str: ...
def utime(path: unicode, times: Optional[Tuple[int, int]]) -> None:
raise OSError
def utime(path: unicode, times: Optional[Tuple[int, int]]) -> None: ...
def wait() -> int: ...
_r = Tuple[float, float, int, int, int, int, int, int, int, int, int, int, int, int, int, int]
def wait3(options: int) -> Tuple[int, int, _r]: ...
def wait4(pid: int, options: int) -> Tuple[int, int, _r]: ...
def waitpid(pid: int, options: int) -> int:
raise OSError()
def waitpid(pid: int, options: int) -> int: ...
def write(fd: int, str: str) -> int: ...
9 changes: 3 additions & 6 deletions stdlib/2/signal.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ def pause() -> None: ...
def setitimer(which: int, seconds: float, interval: float = ...) -> Tuple[float, float]: ...
def getitimer(which: int) -> Tuple[float, float]: ...
def set_wakeup_fd(fd: int) -> int: ...
def siginterrupt(signalnum: int, flag: bool) -> None:
raise RuntimeError()
def signal(signalnum: int, handler: _HANDLER) -> _HANDLER:
raise RuntimeError()
def default_int_handler(signum: int, frame: FrameType) -> None:
raise KeyboardInterrupt()
def siginterrupt(signalnum: int, flag: bool) -> None: ...
def signal(signalnum: int, handler: _HANDLER) -> _HANDLER: ...
def default_int_handler(signum: int, frame: FrameType) -> None: ...
5 changes: 1 addition & 4 deletions stdlib/2/string.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ class Formatter(object):
def parse(self, format_string: str) -> Iterable[Tuple[str, str, str, str]]: ...
def get_field(self, field_name: str, args: Sequence[Any],
kwargs: Mapping[str, Any]) -> Any: ...
def get_value(self, key: Union[int, str], args: Sequence[Any],
kwargs: Mapping[str, Any]) -> Any:
raise IndexError()
raise KeyError()
def get_value(self, key: Union[int, str], args: Sequence[Any], kwargs: Mapping[str, Any]) -> Any: ...
def check_unused_args(self, used_args: Sequence[Union[int, str]], args: Sequence[Any],
kwargs: Mapping[str, Any]) -> None: ...
def format_field(self, value: Any, format_spec: str) -> Any: ...
Expand Down
83 changes: 20 additions & 63 deletions stdlib/2/strop.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,67 +6,24 @@ lowercase: str
uppercase: str
whitespace: str

def atof(a: str) -> float:
raise DeprecationWarning()

def atoi(a: str, base: int = ...) -> int:
raise DeprecationWarning()

def atol(a: str, base: int = ...) -> long:
raise DeprecationWarning()

def capitalize(s: str) -> str:
raise DeprecationWarning()

def count(s: str, sub: str, start: int = ..., end: int = ...) -> int:
raise DeprecationWarning()

def expandtabs(string: str, tabsize: int = ...) -> str:
raise DeprecationWarning()
raise OverflowError()

def find(s: str, sub: str, start: int = ..., end: int = ...) -> int:
raise DeprecationWarning()

def join(list: Sequence[str], sep: str = ...) -> str:
raise DeprecationWarning()
raise OverflowError()

def joinfields(list: Sequence[str], sep: str = ...) -> str:
raise DeprecationWarning()
raise OverflowError()

def lower(s: str) -> str:
raise DeprecationWarning()

def lstrip(s: str) -> str:
raise DeprecationWarning()

def atof(a: str) -> float: ...
def atoi(a: str, base: int = ...) -> int: ...
def atol(a: str, base: int = ...) -> long: ...
def capitalize(s: str) -> str: ...
def count(s: str, sub: str, start: int = ..., end: int = ...) -> int: ...
def expandtabs(string: str, tabsize: int = ...) -> str: ...
def find(s: str, sub: str, start: int = ..., end: int = ...) -> int: ...
def join(list: Sequence[str], sep: str = ...) -> str: ...
def joinfields(list: Sequence[str], sep: str = ...) -> str: ...
def lower(s: str) -> str: ...
def lstrip(s: str) -> str: ...
def maketrans(frm: str, to: str) -> str: ...

def replace(s: str, old: str, new: str, maxsplit: int = ...) -> str:
raise DeprecationWarning()

def rfind(s: str, sub: str, start: int = ..., end: int = ...) -> int:
raise DeprecationWarning()

def rstrip(s: str) -> str:
raise DeprecationWarning()

def split(s: str, sep: str, maxsplit: int = ...) -> List[str]:
raise DeprecationWarning()

def splitfields(s: str, sep: str, maxsplit: int = ...) -> List[str]:
raise DeprecationWarning()

def strip(s: str) -> str:
raise DeprecationWarning()

def swapcase(s: str) -> str:
raise DeprecationWarning()

def translate(s: str, table: str, deletechars: str = ...) -> str:
raise DeprecationWarning()

def upper(s: str) -> str:
raise DeprecationWarning()
def replace(s: str, old: str, new: str, maxsplit: int = ...) -> str: ...
def rfind(s: str, sub: str, start: int = ..., end: int = ...) -> int: ...
def rstrip(s: str) -> str: ...
def split(s: str, sep: str, maxsplit: int = ...) -> List[str]: ...
def splitfields(s: str, sep: str, maxsplit: int = ...) -> List[str]: ...
def strip(s: str) -> str: ...
def swapcase(s: str) -> str: ...
def translate(s: str, table: str, deletechars: str = ...) -> str: ...
def upper(s: str) -> str: ...
6 changes: 2 additions & 4 deletions stdlib/2/sys.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,11 @@ def _getframe(depth: int = ...) -> FrameType: ...
def call_tracing(fn: Any, args: Any) -> Any: ...
def __displayhook__(value: int) -> None: ...
def __excepthook__(type_: type, value: BaseException, traceback: TracebackType) -> None: ...
def exc_clear() -> None:
raise DeprecationWarning()
def exc_clear() -> None: ...
def exc_info() -> _OptExcInfo: ...

# sys.exit() accepts an optional argument of anything printable
def exit(arg: Any = ...) -> NoReturn:
raise SystemExit()
def exit(arg: Any = ...) -> NoReturn: ...
def getcheckinterval() -> int: ... # deprecated
def getdefaultencoding() -> str: ...
def getdlopenflags() -> int: ...
Expand Down
6 changes: 2 additions & 4 deletions stdlib/2/thread.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ class _localdummy(object): ...
def start_new(function: Callable[..., Any], args: Any, kwargs: Any = ...) -> int: ...
def start_new_thread(function: Callable[..., Any], args: Any, kwargs: Any = ...) -> int: ...
def interrupt_main() -> None: ...
def exit() -> None:
raise SystemExit()
def exit_thread() -> Any:
raise SystemExit()
def exit() -> None: ...
def exit_thread() -> Any: ...
def allocate_lock() -> LockType: ...
def get_ident() -> int: ...
def stack_size(size: int = ...) -> int: ...
6 changes: 2 additions & 4 deletions stdlib/2and3/_heapq.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ import sys
_T = TypeVar("_T")

def heapify(heap: List[_T]) -> None: ...
def heappop(heap: List[_T]) -> _T:
raise IndexError() # if list is empty
def heappop(heap: List[_T]) -> _T: ...
def heappush(heap: List[_T], item: _T) -> None: ...
def heappushpop(heap: List[_T], item: _T) -> _T: ...
def heapreplace(heap: List[_T], item: _T) -> _T:
raise IndexError() # if list is empty
def heapreplace(heap: List[_T], item: _T) -> _T: ...
if sys.version_info < (3,):
def nlargest(n: int, iterable: Iterable[_T]) -> List[_T]: ...
def nsmallest(n: int, iterable: Iterable[_T]) -> List[_T]: ...
14 changes: 2 additions & 12 deletions stdlib/3/_tracemalloc.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,11 @@
from typing import Any, Tuple

def _get_object_traceback(*args, **kwargs) -> Any: ...

def _get_traces() -> Any:
raise MemoryError()

def _get_traces() -> Any: ...
def clear_traces() -> None: ...

def get_traceback_limit() -> int: ...

def get_traced_memory() -> Tuple[Any, ...]: ...

def get_tracemalloc_memory() -> Any: ...

def is_tracing() -> bool: ...

def start(*args, **kwargs) -> None:
raise ValueError()

def start(*args, **kwargs) -> None: ...
def stop() -> None: ...
9 changes: 3 additions & 6 deletions stdlib/3/collections/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -220,18 +220,15 @@ class deque(MutableSequence[_T], Generic[_T]):
@overload
def __getitem__(self, index: int) -> _T: ...
@overload
def __getitem__(self, s: slice) -> MutableSequence[_T]:
raise TypeError
def __getitem__(self, s: slice) -> MutableSequence[_T]: ...
@overload
def __setitem__(self, i: int, x: _T) -> None: ...
@overload
def __setitem__(self, s: slice, o: Iterable[_T]) -> None:
raise TypeError
def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ...
@overload
def __delitem__(self, i: int) -> None: ...
@overload
def __delitem__(self, s: slice) -> None:
raise TypeError
def __delitem__(self, s: slice) -> None: ...

def __contains__(self, o: object) -> bool: ...
def __reversed__(self) -> Iterator[_T]: ...
Expand Down
Loading