From db4fad923df7a12249fbd1d8022a1eb184491cc3 Mon Sep 17 00:00:00 2001 From: Semyon Proshev Date: Thu, 19 Apr 2018 21:54:55 +0300 Subject: [PATCH] Sync with typeshed @ 5818893a7fd6e39425d1dbdb429695c15acbf384 --- .../2/multiprocessing/dummy/__init__.pyi | 53 +++++++++++++++++++ .../2/multiprocessing/dummy/connection.pyi | 27 ++++++++++ .../helpers/typeshed/stdlib/2and3/difflib.pyi | 2 +- .../helpers/typeshed/stdlib/3.4/selectors.pyi | 14 ++--- python/helpers/typeshed/stdlib/3/builtins.pyi | 5 ++ .../3/multiprocessing/dummy/__init__.pyi | 44 +++++++++++++++ .../3/multiprocessing/dummy/connection.pyi | 36 +++++++++++++ .../third_party/2and3/click/types.pyi | 4 +- .../third_party/3/werkzeug/exceptions.pyi | 4 +- 9 files changed, 178 insertions(+), 11 deletions(-) create mode 100644 python/helpers/typeshed/stdlib/2/multiprocessing/dummy/__init__.pyi create mode 100644 python/helpers/typeshed/stdlib/2/multiprocessing/dummy/connection.pyi create mode 100644 python/helpers/typeshed/stdlib/3/multiprocessing/dummy/__init__.pyi create mode 100644 python/helpers/typeshed/stdlib/3/multiprocessing/dummy/connection.pyi diff --git a/python/helpers/typeshed/stdlib/2/multiprocessing/dummy/__init__.pyi b/python/helpers/typeshed/stdlib/2/multiprocessing/dummy/__init__.pyi new file mode 100644 index 000000000000..c65811f951fa --- /dev/null +++ b/python/helpers/typeshed/stdlib/2/multiprocessing/dummy/__init__.pyi @@ -0,0 +1,53 @@ +from typing import Any, Optional, List, Type + +import threading +import sys +import weakref +import array +import itertools + +from multiprocessing import TimeoutError, cpu_count +from multiprocessing.dummy.connection import Pipe +from threading import Lock, RLock, Semaphore, BoundedSemaphore +from threading import Event +from Queue import Queue + +__all__ = ... # type: List[str] + + +class DummyProcess(threading.Thread): + _children = ... # type: weakref.WeakKeyDictionary + _parent = ... # type: threading.Thread + _pid = ... # type: None + _start_called = ... # type: bool + def __init__(self, group=..., target=..., name=..., args=..., kwargs=...) -> None: ... + @property + def exitcode(self) -> Optional[int]: ... + + +Process = DummyProcess + +# This should be threading._Condition but threading.pyi exports it as Condition +class Condition(threading.Condition): + notify_all = ... # type: Any + +class Namespace(object): + def __init__(self, **kwds) -> None: ... + +class Value(object): + _typecode = ... # type: Any + _value = ... # type: Any + value = ... # type: Any + def __init__(self, typecode, value, lock=...) -> None: ... + def _get(self) -> Any: ... + def _set(self, value) -> None: ... + +JoinableQueue = Queue + +def Array(typecode, sequence, lock=...) -> array.array: ... +def Manager() -> Any: ... +def Pool(processes=..., initializer=..., initargs=...) -> Any: ... +def active_children() -> List: ... +def current_process() -> threading.Thread: ... +def freeze_support() -> None: ... +def shutdown() -> None: ... diff --git a/python/helpers/typeshed/stdlib/2/multiprocessing/dummy/connection.pyi b/python/helpers/typeshed/stdlib/2/multiprocessing/dummy/connection.pyi new file mode 100644 index 000000000000..4fa500a9ed0c --- /dev/null +++ b/python/helpers/typeshed/stdlib/2/multiprocessing/dummy/connection.pyi @@ -0,0 +1,27 @@ +from Queue import Queue +from typing import Any, List, Optional, Tuple, Type + +__all__ = ... # type: List[str] +families = ... # type: List[None] + +class Connection(object): + _in = ... # type: Any + _out = ... # type: Any + recv = ... # type: Any + recv_bytes = ... # type: Any + send = ... # type: Any + send_bytes = ... # type: Any + def __init__(self, _in, _out) -> None: ... + def close(self) -> None: ... + def poll(self, timeout=...) -> Any: ... + +class Listener(object): + _backlog_queue = ... # type: Optional[Queue] + address = ... # type: Any + def __init__(self, address=..., family=..., backlog=...) -> None: ... + def accept(self) -> Connection: ... + def close(self) -> None: ... + + +def Client(address) -> Connection: ... +def Pipe(duplex=...) -> Tuple[Connection, Connection]: ... diff --git a/python/helpers/typeshed/stdlib/2and3/difflib.pyi b/python/helpers/typeshed/stdlib/2and3/difflib.pyi index 4701e32a2ab2..f62864fc20cf 100644 --- a/python/helpers/typeshed/stdlib/2and3/difflib.pyi +++ b/python/helpers/typeshed/stdlib/2and3/difflib.pyi @@ -33,7 +33,7 @@ class SequenceMatcher(Generic[_T]): def quick_ratio(self) -> float: ... def real_quick_ratio(self) -> float: ... -def get_close_matches(word: Sequence[_T], possibilities: List[Sequence[_T]], +def get_close_matches(word: Sequence[_T], possibilities: Iterable[Sequence[_T]], n: int = ..., cutoff: float = ...) -> List[Sequence[_T]]: ... class Differ: diff --git a/python/helpers/typeshed/stdlib/3.4/selectors.pyi b/python/helpers/typeshed/stdlib/3.4/selectors.pyi index 547ae02182a6..38f49fe38dd1 100644 --- a/python/helpers/typeshed/stdlib/3.4/selectors.pyi +++ b/python/helpers/typeshed/stdlib/3.4/selectors.pyi @@ -37,7 +37,7 @@ class BaseSelector(metaclass=ABCMeta): def modify(self, fileobj: _FileObject, events: _EventMask, data: Any = ...) -> SelectorKey: ... @abstractmethod - def select(self, timeout: Optional[int] = ...) -> List[Tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: Optional[float] = ...) -> List[Tuple[SelectorKey, _EventMask]]: ... def close(self) -> None: ... @@ -53,38 +53,38 @@ class BaseSelector(metaclass=ABCMeta): class SelectSelector(BaseSelector): def register(self, fileobj: _FileObject, events: _EventMask, data: Any = ...) -> SelectorKey: ... def unregister(self, fileobj: _FileObject) -> SelectorKey: ... - def select(self, timeout: Optional[int] = ...) -> List[Tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: Optional[float] = ...) -> List[Tuple[SelectorKey, _EventMask]]: ... def get_map(self) -> Mapping[_FileObject, SelectorKey]: ... class PollSelector(BaseSelector): def register(self, fileobj: _FileObject, events: _EventMask, data: Any = ...) -> SelectorKey: ... def unregister(self, fileobj: _FileObject) -> SelectorKey: ... - def select(self, timeout: Optional[int] = ...) -> List[Tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: Optional[float] = ...) -> List[Tuple[SelectorKey, _EventMask]]: ... def get_map(self) -> Mapping[_FileObject, SelectorKey]: ... class EpollSelector(BaseSelector): def fileno(self) -> int: ... def register(self, fileobj: _FileObject, events: _EventMask, data: Any = ...) -> SelectorKey: ... def unregister(self, fileobj: _FileObject) -> SelectorKey: ... - def select(self, timeout: Optional[int] = ...) -> List[Tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: Optional[float] = ...) -> List[Tuple[SelectorKey, _EventMask]]: ... def get_map(self) -> Mapping[_FileObject, SelectorKey]: ... class DevpollSelector(BaseSelector): def fileno(self) -> int: ... def register(self, fileobj: _FileObject, events: _EventMask, data: Any = ...) -> SelectorKey: ... def unregister(self, fileobj: _FileObject) -> SelectorKey: ... - def select(self, timeout: Optional[int] = ...) -> List[Tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: Optional[float] = ...) -> List[Tuple[SelectorKey, _EventMask]]: ... def get_map(self) -> Mapping[_FileObject, SelectorKey]: ... class KqueueSelector(BaseSelector): def fileno(self) -> int: ... def register(self, fileobj: _FileObject, events: _EventMask, data: Any = ...) -> SelectorKey: ... def unregister(self, fileobj: _FileObject) -> SelectorKey: ... - def select(self, timeout: Optional[int] = ...) -> List[Tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: Optional[float] = ...) -> List[Tuple[SelectorKey, _EventMask]]: ... def get_map(self) -> Mapping[_FileObject, SelectorKey]: ... class DefaultSelector(BaseSelector): def register(self, fileobj: _FileObject, events: _EventMask, data: Any = ...) -> SelectorKey: ... def unregister(self, fileobj: _FileObject) -> SelectorKey: ... - def select(self, timeout: Optional[int] = ...) -> List[Tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: Optional[float] = ...) -> List[Tuple[SelectorKey, _EventMask]]: ... def get_map(self) -> Mapping[_FileObject, SelectorKey]: ... diff --git a/python/helpers/typeshed/stdlib/3/builtins.pyi b/python/helpers/typeshed/stdlib/3/builtins.pyi index f919fbc2eac7..a8650269fed4 100644 --- a/python/helpers/typeshed/stdlib/3/builtins.pyi +++ b/python/helpers/typeshed/stdlib/3/builtins.pyi @@ -143,6 +143,7 @@ class int: def __neg__(self) -> int: ... def __pos__(self) -> int: ... def __invert__(self) -> int: ... + def __round__(self, ndigits: int = ...) -> int: ... def __eq__(self, x: object) -> bool: ... def __ne__(self, x: object) -> bool: ... @@ -182,6 +183,10 @@ class float: def __rmod__(self, x: float) -> float: ... def __rdivmod__(self, x: float) -> Tuple[float, float]: ... def __rpow__(self, x: float) -> float: ... + @overload + def __round__(self) -> int: ... + @overload + def __round__(self, ndigits: int) -> float: ... def __eq__(self, x: object) -> bool: ... def __ne__(self, x: object) -> bool: ... diff --git a/python/helpers/typeshed/stdlib/3/multiprocessing/dummy/__init__.pyi b/python/helpers/typeshed/stdlib/3/multiprocessing/dummy/__init__.pyi new file mode 100644 index 000000000000..69f786988252 --- /dev/null +++ b/python/helpers/typeshed/stdlib/3/multiprocessing/dummy/__init__.pyi @@ -0,0 +1,44 @@ +from typing import Any, Optional, List, Type + +import array +import sys +import threading +import weakref + +from .connection import Pipe +from threading import Lock, RLock, Semaphore, BoundedSemaphore +from threading import Event, Condition, Barrier +from queue import Queue + +JoinableQueue = Queue + +__all__ = ... # type: List[str] + + +class DummyProcess(threading.Thread): + _children = ... # type: weakref.WeakKeyDictionary + _parent = ... # type: threading.Thread + _pid = ... # type: None + _start_called = ... # type: int + exitcode = ... # type: Optional[int] + def __init__(self, group=..., target=..., name=..., args=..., kwargs=...) -> None: ... + +Process = DummyProcess + +class Namespace(object): + def __init__(self, **kwds) -> None: ... + +class Value(object): + _typecode = ... # type: Any + _value = ... # type: Any + value = ... # type: Any + def __init__(self, typecode, value, lock=...) -> None: ... + + +def Array(typecode, sequence, lock=...) -> array.array: ... +def Manager() -> Any: ... +def Pool(processes=..., initializer=..., initargs=...) -> Any: ... +def active_children() -> List: ... +def current_process() -> threading.Thread: ... +def freeze_support() -> None: ... +def shutdown() -> None: ... diff --git a/python/helpers/typeshed/stdlib/3/multiprocessing/dummy/connection.pyi b/python/helpers/typeshed/stdlib/3/multiprocessing/dummy/connection.pyi new file mode 100644 index 000000000000..efcd08fef66a --- /dev/null +++ b/python/helpers/typeshed/stdlib/3/multiprocessing/dummy/connection.pyi @@ -0,0 +1,36 @@ +from typing import Any, List, Optional, Tuple, Type, TypeVar + +from queue import Queue + +__all__ = ... # type: List[str] +families = ... # type: List[None] + +_TConnection = TypeVar('_TConnection', bound=Connection) +_TListener = TypeVar('_TListener', bound=Listener) + +class Connection(object): + _in = ... # type: Any + _out = ... # type: Any + recv = ... # type: Any + recv_bytes = ... # type: Any + send = ... # type: Any + send_bytes = ... # type: Any + def __enter__(self: _TConnection) -> _TConnection: ... + def __exit__(self, exc_type, exc_value, exc_tb) -> None: ... + def __init__(self, _in, _out) -> None: ... + def close(self) -> None: ... + def poll(self, timeout: float=...) -> bool: ... + +class Listener(object): + _backlog_queue = ... # type: Optional[Queue] + @property + def address(self) -> Optional[Queue]: ... + def __enter__(self: _TListener) -> _TListener: ... + def __exit__(self, exc_type, exc_value, exc_tb) -> None: ... + def __init__(self, address=..., family=..., backlog=...) -> None: ... + def accept(self) -> Connection: ... + def close(self) -> None: ... + + +def Client(address) -> Connection: ... +def Pipe(duplex: bool=...) -> Tuple[Connection, Connection]: ... diff --git a/python/helpers/typeshed/third_party/2and3/click/types.pyi b/python/helpers/typeshed/third_party/2and3/click/types.pyi index 80642d8f66dd..59325f45d827 100644 --- a/python/helpers/typeshed/third_party/2and3/click/types.pyi +++ b/python/helpers/typeshed/third_party/2and3/click/types.pyi @@ -1,4 +1,4 @@ -from typing import Any, Callable, IO, Iterable, List, Optional, TypeVar, Union, Tuple as _PyTuple +from typing import Any, Callable, IO, Iterable, List, Optional, TypeVar, Union, Tuple as _PyTuple, Type import uuid from click.core import Context, Parameter @@ -184,7 +184,7 @@ class Path(ParamType): readable: bool = ..., resolve_path: bool = ..., allow_dash: bool = ..., - path_type: Optional[_PathType] = ..., + path_type: Optional[Type[_PathType]] = ..., ) -> None: ... diff --git a/python/helpers/typeshed/third_party/3/werkzeug/exceptions.pyi b/python/helpers/typeshed/third_party/3/werkzeug/exceptions.pyi index a91abba92b2f..6289d80fa9b7 100644 --- a/python/helpers/typeshed/third_party/3/werkzeug/exceptions.pyi +++ b/python/helpers/typeshed/third_party/3/werkzeug/exceptions.pyi @@ -1,4 +1,4 @@ -from typing import Any +from typing import Any, Dict class HTTPException(Exception): code = ... # type: Any @@ -15,6 +15,8 @@ class HTTPException(Exception): def get_response(self, environ=None): ... def __call__(self, environ, start_response): ... +default_exceptions: Dict[int, HTTPException] + class BadRequest(HTTPException): code = ... # type: Any description = ... # type: Any