Sync with typeshed @ 43cf0ec87058b247188fd1c7d906265eef07214c (PY-42534, PY-41791)

Possibly PY-32905 and PY-32788 are fixed.
No more need to provide callable type for `typing.TypeVar` because of https://github.com/python/typeshed/pull/4150

GitOrigin-RevId: f45928ad3b6ab18866b543bd2f375faa92d79b41
This commit is contained in:
Semyon Proshev
2020-06-02 19:59:09 +03:00
committed by intellij-monorepo-bot
parent 09199dfc4a
commit f95d4aef98
151 changed files with 2939 additions and 1712 deletions
+14 -14
View File
@@ -1,22 +1,22 @@
# Some PEP8 deviations are considered irrelevant to stub files:
# (error counts as of 2017-05-22)
# 17952 E704 multiple statements on one line (def)
# 12197 E301 expected 1 blank line
# 7155 E302 expected 2 blank lines
# 1463 F401 imported but unused
# 967 E701 multiple statements on one line (colon)
# 457 F811 redefinition (should be fixed in pyflakes 2.1.2)
# 390 E305 expected 2 blank lines
# 4 E741 ambiguous variable name
# E301 expected 1 blank line
# E302 expected 2 blank lines
# E305 expected 2 blank lines
# E701 multiple statements on one line (colon)
# E741 ambiguous variable name
# F401 imported but unused
# F403 import *' used; unable to detect undefined names
# F405 defined from star imports
# F811 redefinition (should be fixed in pyflakes 2.1.2)
# F822 undefined name in __all__
# Nice-to-haves ignored for now
# 2307 E501 line too long
# Other ignored warnings
# W504 line break after binary operator
# E501 line too long
[flake8]
ignore = F401, F403, F405, F811, E301, E302, E305, E501, E701, E704, E741, B303, W504
per-file-ignores =
*.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F811, F822
# We are checking with Python 3 but many of the stubs are Python 2 stubs.
builtins = StandardError,apply,basestring,buffer,cmp,coerce,execfile,file,intern,long,raw_input,reduce,reload,unichr,unicode,xrange
exclude = .venv*,@*,.git
+42 -4
View File
@@ -2,6 +2,16 @@ dist: bionic
language: python
python: 3.8
aliases:
test_windows: &test_windows
os: windows
language: shell
env: &env_windows
PATH: /c/Python38:/c/Python38/Scripts:/c/Python37:/c/Python37/Scripts:/c/Python36:/c/Python36/Scripts:/c/Python35:/c/Python35/Scripts:$PATH
before_install:
- choco install python --version $PYTHON_VERSION
- python -m pip install -U pip
jobs:
include:
- name: "pytype"
@@ -31,17 +41,45 @@ jobs:
script: flake8
- name: "stubtest py38"
python: 3.8
install: pip install -U git+git://github.com/python/mypy@0a05e61a
install: pip install -U git+git://github.com/python/mypy@b3d43984
script: ./tests/stubtest_test.py
- name: "stubtest py37"
python: 3.7
install: pip install -U git+git://github.com/python/mypy@0a05e61a
install: pip install -U git+git://github.com/python/mypy@b3d43984
script: ./tests/stubtest_test.py
- name: "stubtest py36"
python: 3.6
install: pip install -U git+git://github.com/python/mypy@0a05e61a
install: pip install -U git+git://github.com/python/mypy@b3d43984
script: ./tests/stubtest_test.py
- name: "stubtest py35"
python: 3.5
install: pip install -U git+git://github.com/python/mypy@0a05e61a
install: pip install -U git+git://github.com/python/mypy@b3d43984
script: ./tests/stubtest_test.py
- name: "stubtest py38 (Windows)"
<<: *test_windows
env:
<<: *env_windows
PYTHON_VERSION: 3.8.3
install: pip install -U git+git://github.com/python/mypy@b3d43984
script: python ./tests/stubtest_test.py
- name: "stubtest py37 (Windows)"
<<: *test_windows
env:
<<: *env_windows
PYTHON_VERSION: 3.7.7
install: pip install -U git+git://github.com/python/mypy@b3d43984
script: python ./tests/stubtest_test.py
- name: "stubtest py36 (Windows)"
<<: *test_windows
env:
<<: *env_windows
PYTHON_VERSION: 3.6.8
install: pip install -U git+git://github.com/python/mypy@b3d43984
script: python ./tests/stubtest_test.py
- name: "stubtest py35 (Windows)"
<<: *test_windows
env:
<<: *env_windows
PYTHON_VERSION: 3.5.4
install: pip install -U git+git://github.com/python/mypy@b3d43984
script: python ./tests/stubtest_test.py
+12
View File
@@ -85,6 +85,8 @@ At present the core developers are (alphabetically):
* Greg Price (@gnprice)
* Sebastian Rittau (@srittau)
* Guido van Rossum (@gvanrossum)
* Shantanu (@hauntsaninja)
* Rune Tynan (@CraftSpider)
* Jelle Zijlstra (@JelleZijlstra)
NOTE: the process for preparing and submitting changes also applies to
@@ -373,3 +375,13 @@ Core developers should follow these rules when processing pull requests:
* Make sure commit messages to master are meaningful. For example, remove irrelevant
intermediate commit messages.
* If stubs for a new library are submitted, notify the library's maintainers.
When reviewing PRs, follow these guidelines:
* Typing is hard. Try to be helpful and explain issues with the PR,
especially to new contributors.
* When reviewing auto-generated stubs, just scan for red flags and obvious
errors. Leave possible manual improvements for separate PRs.
* When reviewing large, hand-crafted PRs, you only need to look for red flags
and general issues, and do a few spot checks.
* Review smaller, hand-crafted PRs thoroughly.
@@ -1,8 +1,8 @@
git+https://github.com/python/mypy.git@master
typed-ast>=1.0.4
black==19.3b0
flake8==3.7.8
flake8-bugbear==19.8.0
flake8-pyi==19.3.0
flake8==3.8.1
flake8-bugbear==20.1.4
flake8-pyi==20.5.0
isort==4.3.21
pytype>=2020.01.08
@@ -1,7 +1,7 @@
# NB: SocketServer.pyi and socketserver.pyi must remain consistent!
# Stubs for socketserver
from typing import Any, BinaryIO, Callable, List, Optional, Tuple, Type, Text, Union
from typing import Any, BinaryIO, Callable, ClassVar, List, Optional, Tuple, Type, Text, Union
from socket import SocketType
import sys
import types
@@ -63,23 +63,24 @@ if sys.platform != 'win32':
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...) -> None: ...
class ForkingMixIn:
timeout: Optional[float] # undocumented
active_children: Optional[List[int]] # undocumented
max_children: int # undocumented
if sys.version_info >= (3, 7):
block_on_close: bool
if sys.version_info >= (3, 6):
def collect_children(self, *, blocking: bool = ...) -> None: ... # undocumented
else:
def collect_children(self) -> None: ... # undocumented
def handle_timeout(self) -> None: ... # undocumented
if sys.version_info >= (3, 3):
def service_actions(self) -> None: ... # undocumented
def process_request(self, request: bytes,
client_address: Tuple[str, int]) -> None: ...
if sys.version_info >= (3, 6):
def server_close(self) -> None: ...
if sys.platform != "win32":
class ForkingMixIn:
timeout: Optional[float] # undocumented
active_children: Optional[List[int]] # undocumented
max_children: int # undocumented
if sys.version_info >= (3, 7):
block_on_close: bool
if sys.version_info >= (3, 6):
def collect_children(self, *, blocking: bool = ...) -> None: ... # undocumented
else:
def collect_children(self) -> None: ... # undocumented
def handle_timeout(self) -> None: ... # undocumented
if sys.version_info >= (3, 3):
def service_actions(self) -> None: ... # undocumented
def process_request(self, request: bytes,
client_address: Tuple[str, int]) -> None: ...
if sys.version_info >= (3, 6):
def server_close(self) -> None: ...
class ThreadingMixIn:
daemon_threads: bool
@@ -92,8 +93,9 @@ class ThreadingMixIn:
if sys.version_info >= (3, 6):
def server_close(self) -> None: ...
class ForkingTCPServer(ForkingMixIn, TCPServer): ...
class ForkingUDPServer(ForkingMixIn, UDPServer): ...
if sys.platform != "win32":
class ForkingTCPServer(ForkingMixIn, TCPServer): ...
class ForkingUDPServer(ForkingMixIn, UDPServer): ...
class ThreadingTCPServer(ThreadingMixIn, TCPServer): ...
class ThreadingUDPServer(ThreadingMixIn, UDPServer): ...
if sys.platform != 'win32':
@@ -118,9 +120,16 @@ class BaseRequestHandler:
def finish(self) -> None: ...
class StreamRequestHandler(BaseRequestHandler):
rbufsize: ClassVar[int] # Undocumented
wbufsize: ClassVar[int] # Undocumented
timeout: ClassVar[Optional[float]] # Undocumented
disable_nagle_algorithm: ClassVar[bool] # Undocumented
connection: SocketType # Undocumented
rfile: BinaryIO
wfile: BinaryIO
class DatagramRequestHandler(BaseRequestHandler):
packet: SocketType # Undocumented
socket: SocketType # Undocumented
rfile: BinaryIO
wfile: BinaryIO
@@ -9,8 +9,12 @@ from typing import (
ItemsView, KeysView, ValuesView, ByteString, Optional, AnyStr, Type, Text,
Protocol,
)
from abc import abstractmethod, ABCMeta
from abc import ABCMeta
from ast import mod, AST
from io import (
_OpenBinaryMode, _OpenTextMode, _OpenBinaryModeUpdating, _OpenBinaryModeWriting, _OpenBinaryModeReading,
TextIOWrapper, FileIO, BufferedRandom, BufferedReader, BufferedWriter
)
from types import TracebackType, CodeType
import sys
@@ -344,6 +348,9 @@ class unicode(basestring, Sequence[unicode]):
_str_base = basestring
class _FormatMapMapping(Protocol):
def __getitem__(self, __key: str) -> Any: ...
class str(Sequence[str], _str_base):
def __init__(self, o: object = ...) -> None: ...
@@ -931,6 +938,12 @@ def next(__i: Iterator[_T]) -> _T: ...
def next(__i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...
def oct(__number: Union[int, _SupportsIndex]) -> str: ...
def open(name: Union[unicode, int], mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
def ord(__c: Union[Text, bytes]) -> int: ...
@@ -940,12 +953,22 @@ class _Writer(Protocol):
# This is only available after from __future__ import print_function.
def print(*values: object, sep: Optional[Text] = ..., end: Optional[Text] = ..., file: Optional[_Writer] = ...) -> None: ...
_E = TypeVar("_E", contravariant=True)
_M = TypeVar("_M", contravariant=True)
class _SupportsPow2(Protocol[_E, _T_co]):
def __pow__(self, __other: _E) -> _T_co: ...
class _SupportsPow3(Protocol[_E, _M, _T_co]):
def __pow__(self, __other: _E, __modulo: _M) -> _T_co: ...
@overload
def pow(__base: int, __exp: int, __mod: None = ...) -> Any: ... # returns int or float depending on whether exp is non-negative
@overload
def pow(__base: int, __exp: int, __mod: int) -> int: ...
@overload
def pow(__base: float, __exp: float, __mod: None = ...) -> float: ...
@overload
def pow(__base: _SupportsPow2[_E, _T_co], __exp: _E) -> _T_co: ...
@overload
def pow(__base: _SupportsPow3[_E, _M, _T_co], __exp: _E, __mod: _M) -> _T_co: ...
def quit(code: object = ...) -> NoReturn: ...
def range(__x: int, __y: int = ..., __step: int = ...) -> List[int]: ...
def raw_input(__prompt: Any = ...) -> str: ...
@@ -978,6 +1001,7 @@ def sum(__iterable: Iterable[_T]) -> Union[_T, int]: ...
def sum(__iterable: Iterable[_T], __start: _S) -> Union[_T, _S]: ...
def unichr(__i: int) -> unicode: ...
def vars(__object: Any = ...) -> Dict[str, Any]: ...
@overload
def zip(__iter1: Iterable[_T1]) -> List[Tuple[_T1]]: ...
@overload
@@ -1056,10 +1080,10 @@ class ReferenceError(_StandardError): ...
class RuntimeError(_StandardError): ...
class SyntaxError(_StandardError):
msg: str
lineno: int
lineno: Optional[int]
offset: Optional[int]
text: Optional[str]
filename: str
filename: Optional[str]
class SystemError(_StandardError): ...
class TypeError(_StandardError): ...
class ValueError(_StandardError): ...
+27 -3
View File
@@ -9,8 +9,12 @@ from typing import (
ItemsView, KeysView, ValuesView, ByteString, Optional, AnyStr, Type, Text,
Protocol,
)
from abc import abstractmethod, ABCMeta
from abc import ABCMeta
from ast import mod, AST
from io import (
_OpenBinaryMode, _OpenTextMode, _OpenBinaryModeUpdating, _OpenBinaryModeWriting, _OpenBinaryModeReading,
TextIOWrapper, FileIO, BufferedRandom, BufferedReader, BufferedWriter
)
from types import TracebackType, CodeType
import sys
@@ -344,6 +348,9 @@ class unicode(basestring, Sequence[unicode]):
_str_base = basestring
class _FormatMapMapping(Protocol):
def __getitem__(self, __key: str) -> Any: ...
class str(Sequence[str], _str_base):
def __init__(self, o: object = ...) -> None: ...
@@ -931,6 +938,12 @@ def next(__i: Iterator[_T]) -> _T: ...
def next(__i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...
def oct(__number: Union[int, _SupportsIndex]) -> str: ...
def open(name: Union[unicode, int], mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
def ord(__c: Union[Text, bytes]) -> int: ...
@@ -940,12 +953,22 @@ class _Writer(Protocol):
# This is only available after from __future__ import print_function.
def print(*values: object, sep: Optional[Text] = ..., end: Optional[Text] = ..., file: Optional[_Writer] = ...) -> None: ...
_E = TypeVar("_E", contravariant=True)
_M = TypeVar("_M", contravariant=True)
class _SupportsPow2(Protocol[_E, _T_co]):
def __pow__(self, __other: _E) -> _T_co: ...
class _SupportsPow3(Protocol[_E, _M, _T_co]):
def __pow__(self, __other: _E, __modulo: _M) -> _T_co: ...
@overload
def pow(__base: int, __exp: int, __mod: None = ...) -> Any: ... # returns int or float depending on whether exp is non-negative
@overload
def pow(__base: int, __exp: int, __mod: int) -> int: ...
@overload
def pow(__base: float, __exp: float, __mod: None = ...) -> float: ...
@overload
def pow(__base: _SupportsPow2[_E, _T_co], __exp: _E) -> _T_co: ...
@overload
def pow(__base: _SupportsPow3[_E, _M, _T_co], __exp: _E, __mod: _M) -> _T_co: ...
def quit(code: object = ...) -> NoReturn: ...
def range(__x: int, __y: int = ..., __step: int = ...) -> List[int]: ...
def raw_input(__prompt: Any = ...) -> str: ...
@@ -978,6 +1001,7 @@ def sum(__iterable: Iterable[_T]) -> Union[_T, int]: ...
def sum(__iterable: Iterable[_T], __start: _S) -> Union[_T, _S]: ...
def unichr(__i: int) -> unicode: ...
def vars(__object: Any = ...) -> Dict[str, Any]: ...
@overload
def zip(__iter1: Iterable[_T1]) -> List[Tuple[_T1]]: ...
@overload
@@ -1056,10 +1080,10 @@ class ReferenceError(_StandardError): ...
class RuntimeError(_StandardError): ...
class SyntaxError(_StandardError):
msg: str
lineno: int
lineno: Optional[int]
offset: Optional[int]
text: Optional[str]
filename: str
filename: Optional[str]
class SystemError(_StandardError): ...
class TypeError(_StandardError): ...
class ValueError(_StandardError): ...
+22
View File
@@ -5,6 +5,7 @@
# Only a subset of functionality is included.
from typing import List, BinaryIO, TextIO, IO, overload, Iterator, Iterable, Any, Union, Optional
from typing_extensions import Literal
import _io
from _io import BlockingIOError as BlockingIOError
@@ -21,6 +22,27 @@ from _io import TextIOWrapper as TextIOWrapper
from _io import UnsupportedOperation as UnsupportedOperation
from _io import open as open
_OpenTextMode = Literal[
'r', 'r+', '+r', 'rt', 'tr', 'rt+', 'r+t', '+rt', 'tr+', 't+r', '+tr',
'w', 'w+', '+w', 'wt', 'tw', 'wt+', 'w+t', '+wt', 'tw+', 't+w', '+tw',
'a', 'a+', '+a', 'at', 'ta', 'at+', 'a+t', '+at', 'ta+', 't+a', '+ta',
'U', 'rU', 'Ur', 'rtU', 'rUt', 'Urt', 'trU', 'tUr', 'Utr',
]
_OpenBinaryModeUpdating = Literal[
'rb+', 'r+b', '+rb', 'br+', 'b+r', '+br',
'wb+', 'w+b', '+wb', 'bw+', 'b+w', '+bw',
'ab+', 'a+b', '+ab', 'ba+', 'b+a', '+ba',
]
_OpenBinaryModeWriting = Literal[
'wb', 'bw',
'ab', 'ba',
]
_OpenBinaryModeReading = Literal[
'rb', 'br',
'rbU', 'rUb', 'Urb', 'brU', 'bUr', 'Ubr',
]
_OpenBinaryMode = Union[_OpenBinaryModeUpdating, _OpenBinaryModeReading, _OpenBinaryModeWriting]
def _OpenWrapper(file: Union[str, unicode, int],
mode: unicode = ..., buffering: int = ..., encoding: unicode = ...,
errors: unicode = ..., newline: unicode = ...,
@@ -1,7 +1,4 @@
from typing import (
Any, Callable, ContextManager, Iterable, Optional, Dict, List,
TypeVar, Iterator,
)
from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, TypeVar
_T = TypeVar('_T', bound=Pool)
@@ -17,7 +14,7 @@ class IMapIterator(Iterator[Any]):
class IMapUnorderedIterator(IMapIterator): ...
class Pool(ContextManager[Pool]):
class Pool(object):
def __init__(self, processes: Optional[int] = ...,
initializer: Optional[Callable[..., None]] = ...,
initargs: Iterable[Any] = ...,
@@ -50,10 +47,8 @@ class Pool(ContextManager[Pool]):
def close(self) -> None: ...
def terminate(self) -> None: ...
def join(self) -> None: ...
def __enter__(self: _T) -> _T: ...
class ThreadPool(Pool, ContextManager[ThreadPool]):
class ThreadPool(Pool):
def __init__(self, processes: Optional[int] = ...,
initializer: Optional[Callable[..., Any]] = ...,
initargs: Iterable[Any] = ...) -> None: ...
@@ -291,7 +291,7 @@ if sys.platform != 'win32':
# Unix only
def fork() -> int: ...
def forkpty() -> Tuple[int, int]: ... # some flavors of Unix
def killpg(pgid: int, sig: int) -> None: ...
def killpg(__pgid: int, __signal: int) -> None: ...
def nice(increment: int) -> int: ...
def plock(op: int) -> None: ... # ???op is int?
+3 -6
View File
@@ -5,6 +5,7 @@
import os
import sys
from typing import overload, List, Any, AnyStr, Sequence, Tuple, TypeVar, Union, Text, Callable, Optional
from genericpath import exists as exists
_T = TypeVar('_T')
@@ -100,10 +101,6 @@ elif sys.version_info >= (3, 5):
# So, fall back to Any
def commonprefix(m: Sequence[_PathType]) -> Any: ...
if sys.version_info >= (3, 3):
def exists(path: Union[_PathType, int]) -> bool: ...
else:
def exists(path: _PathType) -> bool: ...
def lexists(path: _PathType) -> bool: ...
# These return float if os.stat_float_times() == True,
@@ -170,8 +167,8 @@ else:
def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
if sys.platform == 'win32':
def splitunc(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated
if sys.version_info < (3, 7) and sys.platform == 'win32':
def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated
if sys.version_info < (3,):
def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ...
@@ -5,6 +5,7 @@
import os
import sys
from typing import overload, List, Any, AnyStr, Sequence, Tuple, TypeVar, Union, Text, Callable, Optional
from genericpath import exists as exists
_T = TypeVar('_T')
@@ -100,10 +101,6 @@ elif sys.version_info >= (3, 5):
# So, fall back to Any
def commonprefix(m: Sequence[_PathType]) -> Any: ...
if sys.version_info >= (3, 3):
def exists(path: Union[_PathType, int]) -> bool: ...
else:
def exists(path: _PathType) -> bool: ...
def lexists(path: _PathType) -> bool: ...
# These return float if os.stat_float_times() == True,
@@ -170,8 +167,8 @@ else:
def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
if sys.platform == 'win32':
def splitunc(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated
if sys.version_info < (3, 7) and sys.platform == 'win32':
def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated
if sys.version_info < (3,):
def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ...
@@ -98,7 +98,7 @@ class Popen(Generic[_T]):
startupinfo: Optional[Any] = ...,
creationflags: int = ...) -> Popen[bytes]: ...
def poll(self) -> int: ...
def poll(self) -> Optional[int]: ...
def wait(self) -> int: ...
# morally: -> Tuple[Optional[bytes], Optional[bytes]]
def communicate(self, input: Optional[_TXT] = ...) -> Tuple[bytes, bytes]: ...
+19 -12
View File
@@ -9,12 +9,22 @@ import collections # Needed by aliases like DefaultDict, see mypy issue 2986
overload = object()
Any = object()
TypeVar = object()
class TypeVar:
__name__: str
__bound__: Optional[Type[Any]]
__constraints__: Tuple[Type[Any], ...]
__covariant__: bool
__contravariant__: bool
def __init__(self, name: str, *constraints: Type[Any], bound: Optional[Type[Any]] = ..., covariant: bool = ..., contravariant: bool = ...) -> None: ...
_promote = object()
class _SpecialForm(object):
def __getitem__(self, typeargs: Any) -> object: ...
Union: _SpecialForm = ...
Optional: _SpecialForm = ...
Tuple: _SpecialForm = ...
Generic: _SpecialForm = ...
Protocol: _SpecialForm = ...
@@ -53,20 +63,17 @@ def no_type_check_decorator(decorator: _C) -> _C: ...
# Type aliases and type constructors
class TypeAlias:
class _Alias:
# Class for defining generic aliases for library types.
def __init__(self, target_type: type) -> None: ...
def __getitem__(self, typeargs: Any) -> Any: ...
Union = TypeAlias(object)
Optional = TypeAlias(object)
List = TypeAlias(object)
Dict = TypeAlias(object)
DefaultDict = TypeAlias(object)
Set = TypeAlias(object)
FrozenSet = TypeAlias(object)
Counter = TypeAlias(object)
Deque = TypeAlias(object)
List = _Alias()
Dict = _Alias()
DefaultDict = _Alias()
Set = _Alias()
FrozenSet = _Alias()
Counter = _Alias()
Deque = _Alias()
# Predefined type variables.
AnyStr = TypeVar('AnyStr', str, unicode)
@@ -68,9 +68,10 @@ def utf_8_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int
if sys.platform == 'win32':
def mbcs_decode(__data: _Decodable, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ...
def mbcs_encode(str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
def mbcs_encode(__str: _Encodable, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
if sys.version_info >= (3, 0):
def code_page_decode(__codepage: int, __data: bytes, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ...
def code_page_encode(__code_page: int, __str: Text, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
if sys.version_info >= (3, 6):
def oem_decode(__data: bytes, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ...
def code_page_decode(codepage: int, __data: bytes, __errors: _Errors = ..., __final: int = ...) -> Tuple[Text, int]: ...
def oem_encode(str: Text, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
def code_page_encode(code_page: int, str: Text, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
def oem_encode(__str: Text, __errors: _Errors = ...) -> Tuple[bytes, int]: ...
@@ -1,6 +1,6 @@
from typing import (
Any, Callable, Iterable, List, Mapping, Optional, Tuple, Type, Union,
Any, Callable, Iterable, List, Mapping, Optional, Text, Tuple, Type, Union,
TypeVar,
)
from types import FrameType, TracebackType
@@ -12,7 +12,6 @@ _TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]]
_PF = Callable[[FrameType, str, Any], None]
_T = TypeVar('_T')
__all__: List[str]
def active_count() -> int: ...
@@ -63,19 +62,20 @@ class Thread:
else:
def __init__(self, group: None = ...,
target: Optional[Callable[..., Any]] = ...,
name: Optional[str] = ...,
name: Optional[Text] = ...,
args: Iterable[Any] = ...,
kwargs: Mapping[str, Any] = ...) -> None: ...
kwargs: Mapping[Text, Any] = ...) -> None: ...
def start(self) -> None: ...
def run(self) -> None: ...
def join(self, timeout: Optional[float] = ...) -> None: ...
def getName(self) -> str: ...
def setName(self, name: str) -> None: ...
def setName(self, name: Text) -> None: ...
if sys.version_info >= (3, 8):
@property
def native_id(self) -> Optional[int]: ... # only available on some platforms
def is_alive(self) -> bool: ...
def isAlive(self) -> bool: ...
if sys.version_info < (3, 9):
def isAlive(self) -> bool: ...
def isDaemon(self) -> bool: ...
def setDaemon(self, daemonic: bool) -> None: ...
@@ -143,19 +143,12 @@ class Semaphore:
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
else:
def acquire(self, blocking: bool = ...) -> bool: ...
def release(self) -> None: ...
class BoundedSemaphore:
def __init__(self, value: int = ...) -> None: ...
def __enter__(self) -> bool: ...
def __exit__(self, exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType]) -> Optional[bool]: ...
if sys.version_info >= (3,):
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
if sys.version_info >= (3, 9):
def release(self, n: int = ...) -> None: ...
else:
def acquire(self, blocking: bool = ...) -> bool: ...
def release(self) -> None: ...
def release(self) -> None: ...
class BoundedSemaphore(Semaphore): ...
class Event:
@@ -96,7 +96,22 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
_optionals: _ArgumentGroup
_subparsers: Optional[_ArgumentGroup]
if sys.version_info >= (3, 5):
if sys.version_info >= (3, 9):
def __init__(self,
prog: Optional[str] = ...,
usage: Optional[str] = ...,
description: Optional[str] = ...,
epilog: Optional[str] = ...,
parents: Sequence[ArgumentParser] = ...,
formatter_class: _FormatterClass = ...,
prefix_chars: str = ...,
fromfile_prefix_chars: Optional[str] = ...,
argument_default: Optional[str] = ...,
conflict_handler: str = ...,
add_help: bool = ...,
allow_abbrev: bool = ...,
exit_on_error: bool = ...) -> None: ...
elif sys.version_info >= (3, 5):
def __init__(self,
prog: Optional[str] = ...,
usage: Optional[str] = ...,
@@ -265,6 +280,8 @@ class Action(_AttributeHolder):
def __call__(self, parser: ArgumentParser, namespace: Namespace,
values: Union[Text, Sequence[Any], None],
option_string: Optional[Text] = ...) -> None: ...
if sys.version_info >= (3, 9):
def format_usage(self) -> str: ...
class Namespace(_AttributeHolder):
def __init__(self, **kwargs: Any) -> None: ...
+17 -1
View File
@@ -5,6 +5,12 @@
import sys
from typing import (Any, BinaryIO, Generic, Iterable, Iterator, List, MutableSequence,
overload, Text, Tuple, TypeVar, Union)
from typing_extensions import Literal
_IntTypeCode = Literal['b', 'B', 'h', 'H', 'i', 'I', 'l', 'L', 'q', 'Q']
_FloatTypeCode = Literal['f', 'd']
_UnicodeTypeCode = Literal['u']
_TypeCode = Union[_IntTypeCode, _FloatTypeCode, _UnicodeTypeCode]
_T = TypeVar('_T', int, float, Text)
@@ -12,8 +18,18 @@ if sys.version_info >= (3,):
typecodes: str
class array(MutableSequence[_T], Generic[_T]):
typecode: str
typecode: _TypeCode
itemsize: int
@overload
def __init__(self: array[int], typecode: _IntTypeCode,
__initializer: Union[bytes, Iterable[_T]] = ...) -> None: ...
@overload
def __init__(self: array[float], typecode: _FloatTypeCode,
__initializer: Union[bytes, Iterable[_T]] = ...) -> None: ...
@overload
def __init__(self: array[Text], typecode: _UnicodeTypeCode,
__initializer: Union[bytes, Iterable[_T]] = ...) -> None: ...
@overload
def __init__(self, typecode: str,
__initializer: Union[bytes, Iterable[_T]] = ...) -> None: ...
def append(self, __v: _T) -> None: ...
@@ -1,18 +1,10 @@
from typing import Tuple, Union, Optional, Any, Dict, overload
from typing import Tuple, Union, Any, Dict, overload
import os
import select
import sys
import time
import warnings
from socket import SocketType
from typing import Optional
from _types import FileDescriptorLike
from errno import (EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, EINVAL,
ENOTCONN, ESHUTDOWN, EINTR, EISCONN, EBADF, ECONNABORTED,
EPIPE, EAGAIN, errorcode)
# cyclic dependence with asynchat
_maptype = Dict[int, Any]
@@ -121,26 +113,25 @@ class dispatcher_with_send(dispatcher):
def compact_traceback() -> Tuple[Tuple[str, str, str], type, type, str]: ...
def close_all(map: Optional[_maptype] = ..., ignore_all: bool = ...) -> None: ...
# if os.name == 'posix':
# import fcntl
class file_wrapper:
fd: int
if sys.platform != "win32":
class file_wrapper:
fd: int
def __init__(self, fd: int) -> None: ...
def recv(self, bufsize: int, flags: int = ...) -> bytes: ...
def send(self, data: bytes, flags: int = ...) -> int: ...
def __init__(self, fd: int) -> None: ...
def recv(self, bufsize: int, flags: int = ...) -> bytes: ...
def send(self, data: bytes, flags: int = ...) -> int: ...
@overload
def getsockopt(self, level: int, optname: int, buflen: None = ...) -> int: ...
@overload
def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ...
@overload
def getsockopt(self, level: int, optname: int, buflen: None = ...) -> int: ...
@overload
def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ...
def read(self, bufsize: int, flags: int = ...) -> bytes: ...
def write(self, data: bytes, flags: int = ...) -> int: ...
def read(self, bufsize: int, flags: int = ...) -> bytes: ...
def write(self, data: bytes, flags: int = ...) -> int: ...
def close(self) -> None: ...
def fileno(self) -> int: ...
def close(self) -> None: ...
def fileno(self) -> int: ...
class file_dispatcher(dispatcher):
def __init__(self, fd: FileDescriptorLike, map: Optional[_maptype] = ...) -> None: ...
def set_file(self, fd: int) -> None: ...
class file_dispatcher(dispatcher):
def __init__(self, fd: FileDescriptorLike, map: Optional[_maptype] = ...) -> None: ...
def set_file(self, fd: int) -> None: ...
+2 -2
View File
@@ -23,7 +23,7 @@ class Bdb:
returnframe: Optional[FrameType]
stoplineno: int
def __init__(self, skip: Iterable[str] = ...) -> None: ...
def __init__(self, skip: Optional[Iterable[str]] = ...) -> None: ...
def canonic(self, filename: str) -> str: ...
def reset(self) -> None: ...
def trace_dispatch(self, frame: FrameType, event: str, arg: Any) -> _TraceDispatch: ...
@@ -64,7 +64,7 @@ class Bdb:
) -> None: ...
def runeval(self, expr: str, globals: Optional[Dict[str, Any]] = ..., locals: Optional[Mapping[str, Any]] = ...) -> None: ...
def runctx(self, cmd: Union[str, CodeType], globals: Optional[Dict[str, Any]], locals: Optional[Mapping[str, Any]]) -> None: ...
def runcall(self, func: Callable[..., _T], *args: Any, **kwds: Any) -> Optional[_T]: ...
def runcall(self, __func: Callable[..., _T], *args: Any, **kwds: Any) -> Optional[_T]: ...
class Breakpoint:
@@ -26,7 +26,7 @@ class CDLL(object):
_FuncPtr: Type[_FuncPointer] = ...
def __init__(
self,
name: str,
name: Optional[str],
mode: int = ...,
handle: Optional[int] = ...,
use_errno: bool = ...,
@@ -183,7 +183,7 @@ def sizeof(obj_or_type: _UnionT[_CData, Type[_CData]]) -> int: ...
def string_at(address: _CVoidConstPLike, size: int = ...) -> bytes: ...
if sys.platform == 'win32':
def WinError(code: Optional[int] = ...,
desc: Optional[str] = ...) -> WindowsError: ...
descr: Optional[str] = ...) -> OSError: ...
def wstring_at(address: _CVoidConstPLike, size: int = ...) -> str: ...
class _SimpleCData(Generic[_T], _CData):
@@ -130,7 +130,7 @@ class time:
def __format__(self, fmt: AnyStr) -> AnyStr: ...
def utcoffset(self) -> Optional[timedelta]: ...
def tzname(self) -> Optional[str]: ...
def dst(self) -> Optional[int]: ...
def dst(self) -> Optional[timedelta]: ...
if sys.version_info >= (3, 6):
def replace(self, hour: int = ..., minute: int = ..., second: int = ...,
microsecond: int = ..., tzinfo: Optional[_tzinfo] = ...,
@@ -35,7 +35,8 @@ if sys.version_info >= (3,):
MIN_ETINY: int
class DecimalException(ArithmeticError):
def handle(self, context: Context, *args: Any) -> Optional[Decimal]: ...
if sys.version_info < (3,):
def handle(self, context: Context, *args: Any) -> Optional[Decimal]: ...
class Clamped(DecimalException): ...
@@ -64,14 +65,14 @@ class Underflow(Inexact, Rounded, Subnormal): ...
if sys.version_info >= (3,):
class FloatOperation(DecimalException, TypeError): ...
def setcontext(context: Context) -> None: ...
def setcontext(__context: Context) -> None: ...
def getcontext() -> Context: ...
def localcontext(ctx: Optional[Context] = ...) -> _ContextManager: ...
class Decimal(object):
def __new__(cls: Type[_DecimalT], value: _DecimalNew = ..., context: Optional[Context] = ...) -> _DecimalT: ...
@classmethod
def from_float(cls, f: float) -> Decimal: ...
def from_float(cls, __f: float) -> Decimal: ...
if sys.version_info >= (3,):
def __bool__(self) -> bool: ...
else:
@@ -83,7 +84,7 @@ class Decimal(object):
def compare(self, other: _Decimal, context: Optional[Context] = ...) -> Decimal: ...
def __hash__(self) -> int: ...
def as_tuple(self) -> DecimalTuple: ...
if sys.version_info >= (3,):
if sys.version_info >= (3, 6):
def as_integer_ratio(self) -> Tuple[int, int]: ...
def to_eng_string(self, context: Optional[Context] = ...) -> str: ...
@@ -3,7 +3,7 @@
import sys
from typing import (
Any, TypeVar, Callable, Iterable, Iterator, List, NamedTuple, Sequence, Tuple,
Generic, Optional, Text, Union, AnyStr
Generic, Optional, Text, Union, AnyStr, overload
)
_T = TypeVar('_T')
@@ -28,8 +28,10 @@ class SequenceMatcher(Generic[_T]):
def set_seqs(self, a: Sequence[_T], b: Sequence[_T]) -> None: ...
def set_seq1(self, a: Sequence[_T]) -> None: ...
def set_seq2(self, b: Sequence[_T]) -> None: ...
def find_longest_match(self, alo: int, ahi: int, blo: int,
bhi: int) -> Match: ...
if sys.version_info >= (3, 9):
def find_longest_match(self, alo: int = ..., ahi: Optional[int] = ..., blo: int = ..., bhi: Optional[int] = ...) -> Match: ...
else:
def find_longest_match(self, alo: int, ahi: int, blo: int, bhi: int) -> Match: ...
def get_matching_blocks(self) -> List[Match]: ...
def get_opcodes(self) -> List[Tuple[str, int, int, int, int]]: ...
def get_grouped_opcodes(self, n: int = ...
@@ -38,6 +40,11 @@ class SequenceMatcher(Generic[_T]):
def quick_ratio(self) -> float: ...
def real_quick_ratio(self) -> float: ...
# mypy thinks the signatures of the overloads overlap, but the types still work fine
@overload
def get_close_matches(word: AnyStr, possibilities: Iterable[AnyStr], # type: ignore
n: int = ..., cutoff: float = ...) -> List[AnyStr]: ...
@overload
def get_close_matches(word: Sequence[_T], possibilities: Iterable[Sequence[_T]],
n: int = ..., cutoff: float = ...) -> List[Sequence[_T]]: ...
@@ -0,0 +1,87 @@
from distutils import log as log
from distutils.ccompiler import CCompiler
from distutils.core import Command as Command
from distutils.errors import DistutilsExecError as DistutilsExecError
from distutils.sysconfig import customize_compiler as customize_compiler
from typing import Any, Dict, List, Match, Optional, Pattern, Sequence, Tuple, Union
LANG_EXT: Dict[str, str]
class config(Command):
description: str = ...
# Tuple is full name, short name, description
user_options: Sequence[Tuple[str, Optional[str], str]] = ...
compiler: Optional[Union[str, CCompiler]] = ...
cc: Optional[str] = ...
include_dirs: Optional[Sequence[str]] = ...
libraries: Optional[Sequence[str]] = ...
library_dirs: Optional[Sequence[str]] = ...
noisy: int = ...
dump_source: int = ...
temp_files: Sequence[str] = ...
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
def run(self) -> None: ...
def try_cpp(
self,
body: Optional[str] = ...,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
lang: str = ...,
) -> bool: ...
def search_cpp(
self,
pattern: Union[Pattern[str], str],
body: Optional[str] = ...,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
lang: str = ...,
) -> bool: ...
def try_compile(
self, body: str, headers: Optional[Sequence[str]] = ..., include_dirs: Optional[Sequence[str]] = ..., lang: str = ...
) -> bool: ...
def try_link(
self,
body: str,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
libraries: Optional[Sequence[str]] = ...,
library_dirs: Optional[Sequence[str]] = ...,
lang: str = ...,
) -> bool: ...
def try_run(
self,
body: str,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
libraries: Optional[Sequence[str]] = ...,
library_dirs: Optional[Sequence[str]] = ...,
lang: str = ...,
) -> bool: ...
def check_func(
self,
func: str,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
libraries: Optional[Sequence[str]] = ...,
library_dirs: Optional[Sequence[str]] = ...,
decl: int = ...,
call: int = ...,
) -> bool: ...
def check_lib(
self,
library: str,
library_dirs: Optional[Sequence[str]] = ...,
headers: Optional[Sequence[str]] = ...,
include_dirs: Optional[Sequence[str]] = ...,
other_libraries: List[str] = ...,
) -> bool: ...
def check_header(
self,
header: str,
include_dirs: Optional[Sequence[str]] = ...,
library_dirs: Optional[Sequence[str]] = ...,
lang: str = ...,
) -> bool: ...
def dump_file(filename: str, head: Optional[str] = ...) -> None: ...
@@ -1,12 +1,15 @@
from typing import Sequence, AnyStr, Text
from typing import Sequence, AnyStr, Text, Union
import sys
if sys.version_info >= (3, 0):
def commonprefix(m: Sequence[str]) -> str: ...
else:
def commonprefix(m: Sequence[AnyStr]) -> AnyStr: ...
def exists(path: Text) -> bool: ...
if sys.version_info >= (3, 6):
from builtins import _PathLike
def exists(path: Union[AnyStr, _PathLike[AnyStr]]) -> bool: ...
else:
def exists(path: Text) -> bool: ...
def isfile(path: Text) -> bool: ...
def isdir(s: Text) -> bool: ...
def getsize(filename: Text) -> int: ...
@@ -29,6 +29,7 @@ raiseExceptions: bool
logThreads: bool
logMultiprocessing: bool
logProcesses: bool
_srcfile: Optional[str]
def currentframe() -> FrameType: ...
@@ -5,6 +5,7 @@
import os
import sys
from typing import overload, List, Any, AnyStr, Sequence, Tuple, TypeVar, Union, Text, Callable, Optional
from genericpath import exists as exists
_T = TypeVar('_T')
@@ -100,10 +101,6 @@ elif sys.version_info >= (3, 5):
# So, fall back to Any
def commonprefix(m: Sequence[_PathType]) -> Any: ...
if sys.version_info >= (3, 3):
def exists(path: Union[_PathType, int]) -> bool: ...
else:
def exists(path: _PathType) -> bool: ...
def lexists(path: _PathType) -> bool: ...
# These return float if os.stat_float_times() == True,
@@ -170,8 +167,8 @@ else:
def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
if sys.platform == 'win32':
def splitunc(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated
if sys.version_info < (3, 7) and sys.platform == 'win32':
def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated
if sys.version_info < (3,):
def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ...
@@ -17,9 +17,9 @@ HAVE_ARGUMENT: int
EXTENDED_ARG: int
if sys.version_info >= (3, 8):
def stack_effect(opcode: int, oparg: Optional[int] = ..., *, jump: Optional[bool] = ...) -> int: ...
def stack_effect(__opcode: int, __oparg: Optional[int] = ..., *, jump: Optional[bool] = ...) -> int: ...
elif sys.version_info >= (3, 4):
def stack_effect(opcode: int, oparg: Optional[int] = ...) -> int: ...
def stack_effect(__opcode: int, __oparg: Optional[int] = ...) -> int: ...
if sys.version_info >= (3, 6):
hasnargs: List[int]
@@ -22,7 +22,7 @@ def issuite(st: STType) -> bool: ...
class ParserError(Exception): ...
class STType:
def compile(self, filename: _Path) -> CodeType: ...
def compile(self, filename: _Path = ...) -> CodeType: ...
def isexpr(self) -> bool: ...
def issuite(self) -> bool: ...
def tolist(self, line_info: bool = ..., col_info: bool = ...) -> List[Any]: ...
@@ -22,29 +22,41 @@ if sys.version_info >= (3,):
else:
_Path = Union[str, unicode]
if sys.version_info >= (3, 4):
if sys.version_info >= (3, 9):
@overload
def load(fp: IO[bytes], *, fmt: Optional[PlistFormat] = ...) -> DictT[str, Any]: ...
@overload
def load(fp: IO[bytes], *, fmt: Optional[PlistFormat] = ..., dict_type: Type[_D]) -> _D: ...
@overload
def loads(value: bytes, *, fmt: Optional[PlistFormat] = ...) -> DictT[str, Any]: ...
@overload
def loads(value: bytes, *, fmt: Optional[PlistFormat] = ..., dict_type: Type[_D]) -> _D: ...
elif sys.version_info >= (3, 4):
@overload
def load(fp: IO[bytes], *, fmt: Optional[PlistFormat] = ...,
use_builtin_types: bool = ...) -> DictT[str, Any]: ...
@overload
def load(fp: IO[bytes], *, fmt: Optional[PlistFormat] = ...,
use_builtin_types: bool = ..., dict_type: Type[_D] = ...) -> _D: ...
use_builtin_types: bool = ..., dict_type: Type[_D]) -> _D: ...
@overload
def loads(value: bytes, *, fmt: Optional[PlistFormat] = ...,
use_builtin_types: bool = ...) -> DictT[str, Any]: ...
@overload
def loads(value: bytes, *, fmt: Optional[PlistFormat] = ...,
use_builtin_types: bool = ..., dict_type: Type[_D] = ...) -> _D: ...
use_builtin_types: bool = ..., dict_type: Type[_D]) -> _D: ...
if sys.version_info >= (3, 4):
def dump(value: Mapping[str, Any], fp: IO[bytes], *,
fmt: PlistFormat = ..., sort_keys: bool = ...,
skipkeys: bool = ...) -> None: ...
def dumps(value: Mapping[str, Any], *, fmt: PlistFormat = ...,
skipkeys: bool = ..., sort_keys: bool = ...) -> bytes: ...
def readPlist(pathOrFile: Union[_Path, IO[bytes]]) -> DictT[str, Any]: ...
def writePlist(value: Mapping[str, Any], pathOrFile: Union[_Path, IO[bytes]]) -> None: ...
def readPlistFromBytes(data: bytes) -> DictT[str, Any]: ...
def writePlistToBytes(value: Mapping[str, Any]) -> bytes: ...
if sys.version_info < (3, 9):
def readPlist(pathOrFile: Union[_Path, IO[bytes]]) -> DictT[str, Any]: ...
def writePlist(value: Mapping[str, Any], pathOrFile: Union[_Path, IO[bytes]]) -> None: ...
def readPlistFromBytes(data: bytes) -> DictT[str, Any]: ...
def writePlistToBytes(value: Mapping[str, Any]) -> bytes: ...
if sys.version_info < (3,):
def readPlistFromResource(path: _Path, restype: str = ...,
resid: int = ...) -> DictT[str, Any]: ...
@@ -60,9 +72,10 @@ if sys.version_info < (3, 7):
def __setattr__(self, attr: str, value: Any) -> None: ...
def __delattr__(self, attr: str) -> None: ...
class Data:
data: bytes
def __init__(self, data: bytes) -> None: ...
if sys.version_info < (3, 9):
class Data:
data: bytes
def __init__(self, data: bytes) -> None: ...
if sys.version_info >= (3, 8):
class UID:
@@ -5,6 +5,7 @@
import os
import sys
from typing import overload, List, Any, AnyStr, Sequence, Tuple, TypeVar, Union, Text, Callable, Optional
from genericpath import exists as exists
_T = TypeVar('_T')
@@ -100,10 +101,6 @@ elif sys.version_info >= (3, 5):
# So, fall back to Any
def commonprefix(m: Sequence[_PathType]) -> Any: ...
if sys.version_info >= (3, 3):
def exists(path: Union[_PathType, int]) -> bool: ...
else:
def exists(path: _PathType) -> bool: ...
def lexists(path: _PathType) -> bool: ...
# These return float if os.stat_float_times() == True,
@@ -170,8 +167,8 @@ else:
def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
if sys.platform == 'win32':
def splitunc(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated
if sys.version_info < (3, 7) and sys.platform == 'win32':
def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated
if sys.version_info < (3,):
def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ...
+14 -13
View File
@@ -1,21 +1,22 @@
import sys
from typing import Any, Iterable, List, Optional, Protocol, Tuple, Type, Union
from typing import Any, Iterable, List, Optional, Tuple, Type
from types import TracebackType
from _types import FileDescriptorLike
PIPE_BUF: int
POLLERR: int
POLLHUP: int
POLLIN: int
POLLMSG: int
POLLNVAL: int
POLLOUT: int
POLLPRI: int
POLLRDBAND: int
POLLRDNORM: int
POLLWRBAND: int
POLLWRNORM: int
if sys.platform != "win32":
PIPE_BUF: int
POLLERR: int
POLLHUP: int
POLLIN: int
POLLMSG: int
POLLNVAL: int
POLLOUT: int
POLLPRI: int
POLLRDBAND: int
POLLRDNORM: int
POLLWRBAND: int
POLLWRNORM: int
class poll:
def __init__(self) -> None: ...
+62 -13
View File
@@ -322,9 +322,55 @@ if sys.platform == 'linux' and sys.version_info >= (3,):
CAN_RAW_FD_FRAMES: int
if sys.platform == 'linux' and sys.version_info >= (3, 8):
CAN_BCM_SETTIMER: int
CAN_BCM_STARTTIMER: int
CAN_BCM_TX_COUNTEVT: int
CAN_BCM_TX_ANNOUNCE: int
CAN_BCM_TX_CP_CAN_ID: int
CAN_BCM_RX_FILTER_ID: int
CAN_BCM_RX_CHECK_DLC: int
CAN_BCM_RX_NO_AUTOTIMER: int
CAN_BCM_RX_ANNOUNCE_RESUME: int
CAN_BCM_TX_RESET_MULTI_IDX: int
CAN_BCM_RX_RTR_FRAME: int
CAN_BCM_CAN_FD_FRAME: int
if sys.platform == 'linux' and sys.version_info >= (3, 7):
CAN_ISOTP: int
if sys.platform == 'linux' and sys.version_info >= (3, 9):
CAN_J1939: int
J1939_MAX_UNICAST_ADDR: int
J1939_IDLE_ADDR: int
J1939_NO_ADDR: int
J1939_NO_NAME: int
J1939_PGN_REQUEST: int
J1939_PGN_ADDRESS_CLAIMED: int
J1939_PGN_ADDRESS_COMMANDED: int
J1939_PGN_PDU1_MAX: int
J1939_PGN_MAX: int
J1939_NO_PGN: int
SO_J1939_FILTER: int
SO_J1939_PROMISC: int
SO_J1939_SEND_PRIO: int
SO_J1939_ERRQUEUE: int
SCM_J1939_DEST_ADDR: int
SCM_J1939_DEST_NAME: int
SCM_J1939_PRIO: int
SCM_J1939_ERRQUEUE: int
J1939_NLA_PAD: int
J1939_NLA_BYTES_ACKED: int
J1939_EE_INFO_NONE: int
J1939_EE_INFO_TX_ABORT: int
J1939_FILTER_MAX: int
if sys.platform == 'linux':
AF_PACKET: AddressFamily
PF_PACKET: int
@@ -638,13 +684,11 @@ class socket:
else:
def listen(self, __backlog: int) -> None: ...
# Note that the makefile's documented windows-specific behavior is not represented
if sys.version_info < (3,):
def makefile(self, mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
else:
if sys.version_info >= (3,):
# mode strings with duplicates are intentionally excluded
@overload
def makefile(self,
mode: Literal['r', 'w', 'rw', 'wr', ''],
mode: Literal['r', 'w', 'rw', 'wr', ''] = ...,
buffering: Optional[int] = ...,
*,
encoding: Optional[str] = ...,
@@ -652,16 +696,18 @@ class socket:
newline: Optional[str] = ...) -> TextIO: ...
@overload
def makefile(self,
mode: Literal['b', 'rb', 'br', 'wb', 'bw', 'rwb', 'rbw', 'wrb', 'wbr', 'brw', 'bwr'] = ...,
mode: Literal['b', 'rb', 'br', 'wb', 'bw', 'rwb', 'rbw', 'wrb', 'wbr', 'brw', 'bwr'],
buffering: Optional[int] = ...,
*,
encoding: Optional[str] = ...,
errors: Optional[str] = ...,
newline: Optional[str] = ...) -> BinaryIO: ...
else:
def makefile(self, mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
def recv(self, bufsize: int, flags: int = ...) -> bytes: ...
def recvfrom(self, bufsize: int, flags: int = ...) -> Tuple[bytes, _RetAddress]: ...
if sys.version_info >= (3, 3):
if sys.version_info >= (3, 3) and sys.platform != "win32":
def recvmsg(self, __bufsize: int, __ancbufsize: int = ..., __flags: int = ...) -> Tuple[bytes, List[_CMSG], int, Any]: ...
def recvmsg_into(self,
__buffers: Iterable[_WriteBuffer],
@@ -675,7 +721,7 @@ class socket:
def sendto(self, data: bytes, address: _Address) -> int: ...
@overload
def sendto(self, data: bytes, flags: int, address: _Address) -> int: ...
if sys.version_info >= (3, 3):
if sys.version_info >= (3, 3) and sys.platform != "win32":
def sendmsg(self,
__buffers: Iterable[bytes],
__ancdata: Iterable[_CMSG] = ...,
@@ -713,7 +759,7 @@ if sys.version_info >= (3, 7):
def create_connection(address: Tuple[Optional[str], int],
timeout: Optional[float] = ...,
source_address: Tuple[Union[bytearray, bytes, Text], int] = ...) -> socket: ...
source_address: Optional[Tuple[Union[bytearray, bytes, Text], int]] = ...) -> socket: ...
if sys.version_info >= (3, 8):
def create_server(address: _Address,
@@ -727,7 +773,7 @@ if sys.version_info >= (3, 8):
def fromfd(fd: int, family: int, type: int, proto: int = ...) -> socket: ...
if sys.platform == 'win32' and sys.version_info >= (3, 3):
def fromshare(data: bytes) -> socket: ...
def fromshare(info: bytes) -> socket: ...
# the 5th tuple item is an address
# TODO the "Tuple[Any, ...]" should be "Union[Tuple[str, int], Tuple[str, int, int, int]]" but that triggers
@@ -771,7 +817,10 @@ if sys.version_info >= (3, 3):
def getdefaulttimeout() -> Optional[float]: ...
def setdefaulttimeout(timeout: Optional[float]) -> None: ...
if sys.version_info >= (3, 3):
def sethostname(name: str) -> None: ...
def if_nameindex() -> List[Tuple[int, str]]: ...
def if_nametoindex(name: str) -> int: ...
def if_indextoname(index: int) -> str: ...
if sys.platform != "win32":
def sethostname(name: str) -> None: ...
# Windows added these in 3.8, but didn't have them before
if sys.platform != "win32" or sys.version_info >= (3, 8):
def if_nameindex() -> List[Tuple[int, str]]: ...
def if_nametoindex(name: str) -> int: ...
def if_indextoname(index: int) -> str: ...
+31 -14
View File
@@ -134,24 +134,38 @@ PROTOCOL_SSLv3: int
PROTOCOL_TLSv1: int
PROTOCOL_TLSv1_1: int
PROTOCOL_TLSv1_2: int
if sys.version_info >= (3, 5):
PROTOCOL_TLS: int
PROTOCOL_TLS: int
if sys.version_info >= (3, 6):
PROTOCOL_TLS_CLIENT: int
PROTOCOL_TLS_SERVER: int
OP_ALL: int
OP_NO_SSLv2: int
OP_NO_SSLv3: int
OP_NO_TLSv1: int
OP_NO_TLSv1_1: int
OP_NO_TLSv1_2: int
OP_CIPHER_SERVER_PREFERENCE: int
OP_SINGLE_DH_USE: int
OP_SINGLE_ECDH_USE: int
OP_NO_COMPRESSION: int
if sys.version_info >= (3, 6):
OP_NO_TICKET: int
class Options(enum.IntFlag):
OP_ALL: int
OP_NO_SSLv2: int
OP_NO_SSLv3: int
OP_NO_TLSv1: int
OP_NO_TLSv1_1: int
OP_NO_TLSv1_2: int
OP_CIPHER_SERVER_PREFERENCE: int
OP_SINGLE_DH_USE: int
OP_SINGLE_ECDH_USE: int
OP_NO_COMPRESSION: int
OP_NO_TICKET: int
OP_ENABLE_MIDDLEBOX_COMPAT: int
if sys.version_info >= (3, 7):
OP_NO_RENEGOTIATION: int
else:
OP_ALL: int
OP_NO_SSLv2: int
OP_NO_SSLv3: int
OP_NO_TLSv1: int
OP_NO_TLSv1_1: int
OP_NO_TLSv1_2: int
OP_CIPHER_SERVER_PREFERENCE: int
OP_SINGLE_DH_USE: int
OP_SINGLE_ECDH_USE: int
OP_NO_COMPRESSION: int
HAS_ALPN: int
HAS_ECDH: bool
@@ -249,7 +263,10 @@ if sys.version_info >= (3, 7):
class SSLContext:
check_hostname: bool
options: int
if sys.version_info >= (3, 6):
options: Options
else:
options: int
if sys.version_info >= (3, 8):
post_handshake_auth: bool
@property
@@ -2,7 +2,7 @@
from typing import (
Callable, IO, Iterable, Iterator, List, Mapping, Optional, Type,
Union,
Union, Tuple, Dict, Set
)
import os
import sys
@@ -15,23 +15,53 @@ elif sys.version_info >= (3,):
else:
_Path = Union[str, unicode]
ENCODING: str
# tar constants
NUL: bytes
BLOCKSIZE: int
RECORDSIZE: int
GNU_MAGIC: bytes
POSIX_MAGIC: bytes
LENGTH_NAME: int
LENGTH_LINK: int
LENGTH_PREFIX: int
REGTYPE: bytes
AREGTYPE: bytes
LNKTYPE: bytes
SYMTYPE: bytes
CONTTYPE: bytes
BLKTYPE: bytes
DIRTYPE: bytes
FIFOTYPE: bytes
CHRTYPE: bytes
GNUTYPE_LONGNAME: bytes
GNUTYPE_LONGLINK: bytes
GNUTYPE_SPARSE: bytes
XHDTYPE: bytes
XGLTYPE: bytes
SOLARIS_XHDTYPE: bytes
USTAR_FORMAT: int
GNU_FORMAT: int
PAX_FORMAT: int
DEFAULT_FORMAT: int
REGTYPE: bytes
AREGTYPE: bytes
LNKTYPE: bytes
SYMTYPE: bytes
DIRTYPE: bytes
FIFOTYPE: bytes
CONTTYPE: bytes
CHRTYPE: bytes
BLKTYPE: bytes
GNUTYPE_SPARSE: bytes
# tarfile constants
SUPPORTED_TYPES: Tuple[bytes, ...]
REGULAR_TYPES: Tuple[bytes, ...]
GNU_TYPES: Tuple[bytes, ...]
PAX_FIELDS: Tuple[str, ...]
PAX_NUMBER_FIELDS: Dict[str, type]
if sys.version_info >= (3,):
PAX_NAME_FIELDS: Set[str]
ENCODING: str
if sys.version_info < (3,):
TAR_PLAIN: int
@@ -114,6 +144,18 @@ class TarFile(Iterable[TarInfo]):
path: _Path = ...) -> None: ...
def extractfile(self,
member: Union[str, TarInfo]) -> Optional[IO[bytes]]: ...
def makedir(self, tarinfo: TarInfo, targetpath: _Path) -> None: ... # undocumented
def makefile(self, tarinfo: TarInfo, targetpath: _Path) -> None: ... # undocumented
def makeunknown(self, tarinfo: TarInfo, targetpath: _Path) -> None: ... # undocumented
def makefifo(self, tarinfo: TarInfo, targetpath: _Path) -> None: ... # undocumented
def makedev(self, tarinfo: TarInfo, targetpath: _Path) -> None: ... # undocumented
def makelink(self, tarinfo: TarInfo, targetpath: _Path) -> None: ... # undocumented
if sys.version_info >= (3, 5):
def chown(self, tarinfo: TarInfo, targetpath: _Path, numeric_owner: bool) -> None: ... # undocumented
else:
def chown(self, tarinfo: TarInfo, targetpath: _Path) -> None: ... # undocumented
def chmod(self, tarinfo: TarInfo, targetpath: _Path) -> None: ... # undocumented
def utime(self, tarinfo: TarInfo, targetpath: _Path) -> None: ... # undocumented
if sys.version_info >= (3, 7):
def add(self, name: str, arcname: Optional[str] = ...,
recursive: bool = ..., *,
@@ -135,7 +177,10 @@ class TarFile(Iterable[TarInfo]):
fileobj: Optional[IO[bytes]] = ...) -> TarInfo: ...
def close(self) -> None: ...
def is_tarfile(name: str) -> bool: ...
if sys.version_info >= (3, 9):
def is_tarfile(name: Union[_Path, IO[bytes]]) -> bool: ...
else:
def is_tarfile(name: _Path) -> bool: ...
if sys.version_info < (3, 8):
def filemode(mode: int) -> str: ... # undocumented
@@ -1,6 +1,6 @@
from typing import (
Any, Callable, Iterable, List, Mapping, Optional, Tuple, Type, Union,
Any, Callable, Iterable, List, Mapping, Optional, Text, Tuple, Type, Union,
TypeVar,
)
from types import FrameType, TracebackType
@@ -12,7 +12,6 @@ _TF = Callable[[FrameType, str, Any], Optional[Callable[..., Any]]]
_PF = Callable[[FrameType, str, Any], None]
_T = TypeVar('_T')
__all__: List[str]
def active_count() -> int: ...
@@ -63,19 +62,20 @@ class Thread:
else:
def __init__(self, group: None = ...,
target: Optional[Callable[..., Any]] = ...,
name: Optional[str] = ...,
name: Optional[Text] = ...,
args: Iterable[Any] = ...,
kwargs: Mapping[str, Any] = ...) -> None: ...
kwargs: Mapping[Text, Any] = ...) -> None: ...
def start(self) -> None: ...
def run(self) -> None: ...
def join(self, timeout: Optional[float] = ...) -> None: ...
def getName(self) -> str: ...
def setName(self, name: str) -> None: ...
def setName(self, name: Text) -> None: ...
if sys.version_info >= (3, 8):
@property
def native_id(self) -> Optional[int]: ... # only available on some platforms
def is_alive(self) -> bool: ...
def isAlive(self) -> bool: ...
if sys.version_info < (3, 9):
def isAlive(self) -> bool: ...
def isDaemon(self) -> bool: ...
def setDaemon(self, daemonic: bool) -> None: ...
@@ -143,19 +143,12 @@ class Semaphore:
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
else:
def acquire(self, blocking: bool = ...) -> bool: ...
def release(self) -> None: ...
class BoundedSemaphore:
def __init__(self, value: int = ...) -> None: ...
def __enter__(self) -> bool: ...
def __exit__(self, exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType]) -> Optional[bool]: ...
if sys.version_info >= (3,):
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
if sys.version_info >= (3, 9):
def release(self, n: int = ...) -> None: ...
else:
def acquire(self, blocking: bool = ...) -> bool: ...
def release(self) -> None: ...
def release(self) -> None: ...
class BoundedSemaphore(Semaphore): ...
class Event:
@@ -103,8 +103,9 @@ if sys.version_info >= (3, 3):
def clock_settime(clk_id: int, time: float) -> None: ... # Unix only
if sys.version_info >= (3, 7):
def clock_gettime_ns(clock_id: int) -> int: ...
def clock_settime_ns(clock_id: int, time: int) -> int: ...
if sys.platform != "win32":
def clock_gettime_ns(clock_id: int) -> int: ...
def clock_settime_ns(clock_id: int, time: int) -> int: ...
def monotonic_ns() -> int: ...
def perf_counter_ns() -> int: ...
def process_time_ns() -> int: ...
@@ -1,7 +1,6 @@
# Stubs for uuid
import sys
from enum import Enum
from typing import Tuple, Optional, Any, Text
# Because UUID has properties called int and bytes we need to rename these temporarily.
@@ -10,6 +9,7 @@ _Bytes = bytes
_FieldsType = Tuple[int, int, int, int, int, int]
if sys.version_info >= (3, 7):
from enum import Enum
class SafeUUID(Enum):
safe: int
unsafe: int
@@ -94,7 +94,7 @@ class UUID:
def get_version(self) -> Optional[_Int]: ...
def __cmp__(self, other: Any) -> _Int: ...
def getnode(*, getters: None = ...) -> int: ... # getters is undocumented (and unused)
def getnode() -> int: ...
def uuid1(node: Optional[_Int] = ..., clock_seq: Optional[_Int] = ...) -> UUID: ...
def uuid3(namespace: UUID, name: str) -> UUID: ...
def uuid4() -> UUID: ...
@@ -0,0 +1,20 @@
class NodeFilter:
FILTER_ACCEPT: int
FILTER_REJECT: int
FILTER_SKIP: int
SHOW_ALL: int
SHOW_ELEMENT: int
SHOW_ATTRIBUTE: int
SHOW_TEXT: int
SHOW_CDATA_SECTION: int
SHOW_ENTITY_REFERENCE: int
SHOW_ENTITY: int
SHOW_PROCESSING_INSTRUCTION: int
SHOW_COMMENT: int
SHOW_DOCUMENT: int
SHOW_DOCUMENT_TYPE: int
SHOW_DOCUMENT_FRAGMENT: int
SHOW_NOTATION: int
def acceptNode(self, node) -> int: ...
@@ -0,0 +1,67 @@
class Node:
ELEMENT_NODE: int
ATTRIBUTE_NODE: int
TEXT_NODE: int
CDATA_SECTION_NODE: int
ENTITY_REFERENCE_NODE: int
ENTITY_NODE: int
PROCESSING_INSTRUCTION_NODE: int
COMMENT_NODE: int
DOCUMENT_NODE: int
DOCUMENT_TYPE_NODE: int
DOCUMENT_FRAGMENT_NODE: int
NOTATION_NODE: int
# ExceptionCode
INDEX_SIZE_ERR: int
DOMSTRING_SIZE_ERR: int
HIERARCHY_REQUEST_ERR: int
WRONG_DOCUMENT_ERR: int
INVALID_CHARACTER_ERR: int
NO_DATA_ALLOWED_ERR: int
NO_MODIFICATION_ALLOWED_ERR: int
NOT_FOUND_ERR: int
NOT_SUPPORTED_ERR: int
INUSE_ATTRIBUTE_ERR: int
INVALID_STATE_ERR: int
SYNTAX_ERR: int
INVALID_MODIFICATION_ERR: int
NAMESPACE_ERR: int
INVALID_ACCESS_ERR: int
VALIDATION_ERR: int
class DOMException(Exception):
code: int
def __init__(self, *args, **kw) -> None: ...
def _get_code(self) -> int: ...
class IndexSizeErr(DOMException): ...
class DomstringSizeErr(DOMException): ...
class HierarchyRequestErr(DOMException): ...
class WrongDocumentErr(DOMException): ...
class NoDataAllowedErr(DOMException): ...
class NoModificationAllowedErr(DOMException): ...
class NotFoundErr(DOMException): ...
class NotSupportedErr(DOMException): ...
class InuseAttributeErr(DOMException): ...
class InvalidStateErr(DOMException): ...
class SyntaxErr(DOMException): ...
class InvalidModificationErr(DOMException): ...
class NamespaceErr(DOMException): ...
class InvalidAccessErr(DOMException): ...
class ValidationErr(DOMException): ...
class UserDataHandler:
NODE_CLONED: int
NODE_IMPORTED: int
NODE_DELETED: int
NODE_RENAMED: int
XML_NAMESPACE: str
XMLNS_NAMESPACE: str
XHTML_NAMESPACE: str
EMPTY_NAMESPACE: None
EMPTY_PREFIX: None
@@ -0,0 +1,3 @@
from typing import Any
def __getattr__(name: str) -> Any: ... # incomplete
@@ -0,0 +1,3 @@
from typing import Any
def __getattr__(name: str) -> Any: ... # incomplete
@@ -1,5 +1,4 @@
# Stubs for xml.etree.ElementInclude (Python 3.4)
import sys
from typing import Union, Optional, Callable
from xml.etree.ElementTree import Element
@@ -14,4 +13,7 @@ def default_loader(href: Union[str, bytes, int], parse: str, encoding: Optional[
# TODO: loader is of type default_loader ie it takes a callable that has the
# same signature as default_loader. But default_loader has a keyword argument
# Which can't be represented using Callable...
def include(elem: Element, loader: Optional[Callable[..., Union[str, Element]]] = ...) -> None: ...
if sys.version_info >= (3, 9):
def include(elem: Element, loader: Optional[Callable[..., Union[str, Element]]] = ..., base_url: Optional[str] = ..., max_depth: Optional[int] = ...) -> None: ...
else:
def include(elem: Element, loader: Optional[Callable[..., Union[str, Element]]] = ...) -> None: ...
@@ -63,7 +63,11 @@ else:
# _fixtext function in the source). Client code knows best:
_str_result_type = Any
_file_or_filename = Union[str, bytes, int, IO[Any]]
if sys.version_info >= (3, 6):
from os import PathLike
_file_or_filename = Union[str, bytes, PathLike[str], int, IO[Any]]
else:
_file_or_filename = Union[str, bytes, int, IO[Any]]
if sys.version_info >= (3, 8):
class _Writeable(Protocol):
@@ -17,7 +17,7 @@ class XMLGenerator(handler.ContentHandler):
if sys.version_info >= (3, 0):
def __init__(self, out: Optional[Union[TextIOBase, RawIOBase, StreamWriter, StreamReaderWriter, _Writable]] = ..., encoding: str = ..., short_empty_elements: bool = ...) -> None: ...
else:
def __init__(self, out: Optional[Union[TextIOBase, RawIOBase, StreamWriter, StreamReaderWriter, _Writable]] = ..., encoding: str = ...) -> None: ...
def __init__(self, out: Optional[Union[TextIOBase, RawIOBase, StreamWriter, StreamReaderWriter, _Writable]] = ..., encoding: Text = ...) -> None: ...
def startDocument(self): ...
def endDocument(self): ...
def startPrefixMapping(self, prefix, uri): ...
@@ -1,5 +1,7 @@
# Stubs for zlib
import sys
from array import array
from typing import Union, Any
DEFLATED: int
DEF_MEM_LEVEL: int
@@ -47,7 +49,7 @@ if sys.version_info >= (3,):
else:
def compressobj(level: int = ..., method: int = ..., wbits: int = ...,
memlevel: int = ..., strategy: int = ...) -> _Compress: ...
def crc32(__data: bytes, __value: int = ...) -> int: ...
def crc32(__data: Union[array[Any], bytes], __value: int = ...) -> int: ...
def decompress(__data: bytes, wbits: int = ..., bufsize: int = ...) -> bytes: ...
if sys.version_info >= (3,):
def decompressobj(wbits: int = ..., zdict: bytes = ...) -> _Decompress: ...
+32 -26
View File
@@ -16,13 +16,28 @@ if sys.version_info >= (3, 8):
else:
from typing_extensions import Literal
if sys.version_info >= (3, 8):
class Num(Constant): ...
class Str(Constant): ...
class Bytes(Constant): ...
class NameConstant(Constant): ...
class Ellipsis(Constant): ...
if sys.version_info >= (3, 9):
class slice(AST): ...
class ExtSlice(slice): ...
class Index(slice): ...
class Suite(mod): ...
class AugLoad(expr_context): ...
class AugStore(expr_context): ...
class Param(expr_context): ...
class NodeVisitor:
def visit(self, node: AST) -> Any: ...
def generic_visit(self, node: AST) -> Any: ...
def visit_Module(self, node: Module) -> Any: ...
def visit_Interactive(self, node: Interactive) -> Any: ...
def visit_Expression(self, node: Expression) -> Any: ...
def visit_Suite(self, node: Suite) -> Any: ...
def visit_FunctionDef(self, node: FunctionDef) -> Any: ...
def visit_AsyncFunctionDef(self, node: AsyncFunctionDef) -> Any: ...
def visit_ClassDef(self, node: ClassDef) -> Any: ...
@@ -50,8 +65,6 @@ class NodeVisitor:
def visit_Break(self, node: Break) -> Any: ...
def visit_Continue(self, node: Continue) -> Any: ...
def visit_Slice(self, node: Slice) -> Any: ...
def visit_ExtSlice(self, node: ExtSlice) -> Any: ...
def visit_Index(self, node: Index) -> Any: ...
def visit_BoolOp(self, node: BoolOp) -> Any: ...
def visit_BinOp(self, node: BinOp) -> Any: ...
def visit_UnaryOp(self, node: UnaryOp) -> Any: ...
@@ -71,18 +84,6 @@ class NodeVisitor:
if sys.version_info >= (3, 6):
def visit_FormattedValue(self, node: FormattedValue) -> Any: ...
def visit_JoinedStr(self, node: JoinedStr) -> Any: ...
if sys.version_info < (3, 8):
def visit_Num(self, node: Num) -> Any: ...
def visit_Str(self, node: Str) -> Any: ...
def visit_Bytes(self, node: Bytes) -> Any: ...
def visit_NameConstant(self, node: NameConstant) -> Any: ...
def visit_Ellipsis(self, node: Ellipsis) -> Any: ...
else:
def visit_Num(self, node: Constant) -> Any: ...
def visit_Str(self, node: Constant) -> Any: ...
def visit_Bytes(self, node: Constant) -> Any: ...
def visit_NameConstant(self, node: Constant) -> Any: ...
def visit_Ellipsis(self, node: Constant) -> Any: ...
if sys.version_info >= (3, 6):
def visit_Constant(self, node: Constant) -> Any: ...
if sys.version_info >= (3, 8):
@@ -93,11 +94,8 @@ class NodeVisitor:
def visit_Name(self, node: Name) -> Any: ...
def visit_List(self, node: List) -> Any: ...
def visit_Tuple(self, node: Tuple) -> Any: ...
def visit_AugLoad(self, node: AugLoad) -> Any: ...
def visit_AugStore(self, node: AugStore) -> Any: ...
def visit_Del(self, node: Del) -> Any: ...
def visit_Load(self, node: Load) -> Any: ...
def visit_Param(self, node: Param) -> Any: ...
def visit_Store(self, node: Store) -> Any: ...
def visit_And(self, node: And) -> Any: ...
def visit_Or(self, node: Or) -> Any: ...
@@ -135,6 +133,18 @@ class NodeVisitor:
def visit_keyword(self, node: keyword) -> Any: ...
def visit_alias(self, node: alias) -> Any: ...
def visit_withitem(self, node: withitem) -> Any: ...
# visit methods for deprecated nodes
def visit_ExtSlice(self, node: ExtSlice) -> Any: ...
def visit_Index(self, node: Index) -> Any: ...
def visit_Suite(self, node: Suite) -> Any: ...
def visit_AugLoad(self, node: AugLoad) -> Any: ...
def visit_AugStore(self, node: AugStore) -> Any: ...
def visit_Param(self, node: Param) -> Any: ...
def visit_Num(self, node: Num) -> Any: ...
def visit_Str(self, node: Str) -> Any: ...
def visit_Bytes(self, node: Bytes) -> Any: ...
def visit_NameConstant(self, node: NameConstant) -> Any: ...
def visit_Ellipsis(self, node: Ellipsis) -> Any: ...
class NodeTransformer(NodeVisitor):
def generic_visit(self, node: AST) -> Optional[AST]: ...
@@ -174,7 +184,10 @@ if sys.version_info >= (3, 9):
def unparse(ast_obj: AST) -> str: ...
def copy_location(new_node: _T, old_node: AST) -> _T: ...
def dump(node: AST, annotate_fields: bool = ..., include_attributes: bool = ...) -> str: ...
if sys.version_info >= (3, 9):
def dump(node: AST, annotate_fields: bool = ..., include_attributes: bool = ..., *, indent: Union[int, str, None] = ...) -> str: ...
else:
def dump(node: AST, annotate_fields: bool = ..., include_attributes: bool = ...) -> str: ...
def fix_missing_locations(node: _T) -> _T: ...
def get_docstring(node: AST, clean: bool = ...) -> str: ...
def increment_lineno(node: _T, n: int = ...) -> _T: ...
@@ -184,10 +197,3 @@ def literal_eval(node_or_string: Union[str, AST]) -> Any: ...
if sys.version_info >= (3, 8):
def get_source_segment(source: str, node: AST, *, padded: bool = ...) -> Optional[str]: ...
def walk(node: AST) -> Iterator[AST]: ...
if sys.version_info >= (3, 8):
class Num(Constant): ...
class Str(Constant): ...
class Bytes(Constant): ...
class NameConstant(Constant): ...
class Ellipsis(Constant): ...
@@ -1,58 +1,12 @@
import sys
from typing import Type
from asyncio.base_events import BaseEventLoop as BaseEventLoop
from asyncio.coroutines import (
coroutine as coroutine,
iscoroutinefunction as iscoroutinefunction,
iscoroutine as iscoroutine,
)
from asyncio.protocols import (
BaseProtocol as BaseProtocol,
Protocol as Protocol,
DatagramProtocol as DatagramProtocol,
SubprocessProtocol as SubprocessProtocol,
)
from asyncio.streams import (
StreamReader as StreamReader,
StreamWriter as StreamWriter,
StreamReaderProtocol as StreamReaderProtocol,
open_connection as open_connection,
start_server as start_server,
)
from asyncio.subprocess import (
create_subprocess_exec as create_subprocess_exec,
create_subprocess_shell as create_subprocess_shell,
)
from asyncio.transports import (
BaseTransport as BaseTransport,
ReadTransport as ReadTransport,
WriteTransport as WriteTransport,
Transport as Transport,
DatagramTransport as DatagramTransport,
SubprocessTransport as SubprocessTransport,
)
from asyncio.futures import (
Future as Future,
wrap_future as wrap_future,
)
from asyncio.tasks import (
FIRST_COMPLETED as FIRST_COMPLETED,
FIRST_EXCEPTION as FIRST_EXCEPTION,
ALL_COMPLETED as ALL_COMPLETED,
as_completed as as_completed,
ensure_future as ensure_future,
gather as gather,
run_coroutine_threadsafe as run_coroutine_threadsafe,
shield as shield,
sleep as sleep,
wait as wait,
wait_for as wait_for,
Task as Task,
)
from asyncio.base_events import (
BaseEventLoop as BaseEventLoop,
Server as Server
)
from asyncio.events import (
AbstractEventLoopPolicy as AbstractEventLoopPolicy,
AbstractEventLoop as AbstractEventLoop,
@@ -66,59 +20,11 @@ from asyncio.events import (
new_event_loop as new_event_loop,
get_child_watcher as get_child_watcher,
set_child_watcher as set_child_watcher,
)
from asyncio.queues import (
Queue as Queue,
PriorityQueue as PriorityQueue,
LifoQueue as LifoQueue,
QueueFull as QueueFull,
QueueEmpty as QueueEmpty,
)
from asyncio.locks import (
Lock as Lock,
Event as Event,
Condition as Condition,
Semaphore as Semaphore,
BoundedSemaphore as BoundedSemaphore,
)
from asyncio.futures import isfuture as isfuture
from asyncio.events import (
_set_running_loop as _set_running_loop,
_get_running_loop as _get_running_loop,
)
if sys.platform == 'win32':
from asyncio.windows_events import *
else:
from asyncio.streams import (
open_unix_connection as open_unix_connection,
start_unix_server as start_unix_server,
)
DefaultEventLoopPolicy: Type[AbstractEventLoopPolicy]
if sys.version_info >= (3, 7):
from asyncio.events import (
get_running_loop as get_running_loop,
)
from asyncio.tasks import (
all_tasks as all_tasks,
create_task as create_task,
current_task as current_task,
)
from asyncio.runners import (
run as run,
)
if sys.platform != 'win32':
from .unix_events import (
AbstractChildWatcher as AbstractChildWatcher,
BaseChildWatcher as BaseChildWatcher,
SafeChildWatcher as SafeChildWatcher,
SelectorEventLoop as SelectorEventLoop,
)
if sys.version_info >= (3, 8):
from .unix_events import MultiLoopChildWatcher as MultiLoopChildWatcher, ThreadedChildWatcher as ThreadedChildWatcher
from asyncio.events import get_running_loop as get_running_loop
if sys.version_info >= (3, 8):
from asyncio.exceptions import (
CancelledError as CancelledError,
@@ -142,3 +48,91 @@ else:
IncompleteReadError as IncompleteReadError,
LimitOverrunError as LimitOverrunError,
)
from asyncio.futures import (
Future as Future,
isfuture as isfuture,
wrap_future as wrap_future,
)
from asyncio.locks import (
Lock as Lock,
Event as Event,
Condition as Condition,
Semaphore as Semaphore,
BoundedSemaphore as BoundedSemaphore,
)
from asyncio.protocols import (
BaseProtocol as BaseProtocol,
Protocol as Protocol,
DatagramProtocol as DatagramProtocol,
SubprocessProtocol as SubprocessProtocol,
)
if sys.version_info >= (3, 7):
from asyncio.protocols import BufferedProtocol as BufferedProtocol
from asyncio.queues import (
Queue as Queue,
PriorityQueue as PriorityQueue,
LifoQueue as LifoQueue,
QueueFull as QueueFull,
QueueEmpty as QueueEmpty,
)
if sys.version_info >= (3, 7):
from asyncio.runners import run as run
from asyncio.streams import (
StreamReader as StreamReader,
StreamWriter as StreamWriter,
StreamReaderProtocol as StreamReaderProtocol,
open_connection as open_connection,
start_server as start_server,
)
from asyncio.subprocess import (
create_subprocess_exec as create_subprocess_exec,
create_subprocess_shell as create_subprocess_shell,
)
from asyncio.tasks import (
FIRST_COMPLETED as FIRST_COMPLETED,
FIRST_EXCEPTION as FIRST_EXCEPTION,
ALL_COMPLETED as ALL_COMPLETED,
as_completed as as_completed,
ensure_future as ensure_future,
gather as gather,
run_coroutine_threadsafe as run_coroutine_threadsafe,
shield as shield,
sleep as sleep,
wait as wait,
wait_for as wait_for,
Task as Task,
)
if sys.version_info >= (3, 7):
from asyncio.tasks import (
all_tasks as all_tasks,
create_task as create_task,
current_task as current_task,
)
if sys.version_info >= (3, 9):
from asyncio.threads import to_thread as to_thread
from asyncio.transports import (
BaseTransport as BaseTransport,
ReadTransport as ReadTransport,
WriteTransport as WriteTransport,
Transport as Transport,
DatagramTransport as DatagramTransport,
SubprocessTransport as SubprocessTransport,
)
DefaultEventLoopPolicy: Type[AbstractEventLoopPolicy]
if sys.platform == 'win32':
from asyncio.windows_events import *
if sys.platform != 'win32':
from asyncio.streams import (
open_unix_connection as open_unix_connection,
start_unix_server as start_unix_server,
)
from .unix_events import (
AbstractChildWatcher as AbstractChildWatcher,
FastChildWatcher as FastChildWatcher,
SafeChildWatcher as SafeChildWatcher,
SelectorEventLoop as SelectorEventLoop,
)
if sys.version_info >= (3, 8):
from .unix_events import MultiLoopChildWatcher as MultiLoopChildWatcher, ThreadedChildWatcher as ThreadedChildWatcher
@@ -72,8 +72,10 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any, context: Optional[Context] = ...) -> Handle: ...
else:
def call_soon_threadsafe(self, callback: Callable[..., Any], *args: Any) -> Handle: ...
async def run_in_executor(self, executor: Any,
func: Callable[..., _T], *args: Any) -> _T: ...
# run_in_executor is defined as a coroutine in AbstractEventLoop but returns a Future in concrete implementation.
# Need to ignore mypy Return type error as a result.
def run_in_executor(self, executor: Any, # type: ignore
func: Callable[..., _T], *args: Any) -> Future[_T]: ...
def set_default_executor(self, executor: Any) -> None: ...
# Network I/O methods returning Futures.
# TODO the "Tuple[Any, ...]" should be "Union[Tuple[str, int], Tuple[str, int, int, int]]" but that triggers
@@ -216,3 +218,5 @@ class BaseEventLoop(AbstractEventLoop, metaclass=ABCMeta):
# Debug flag management.
def get_debug(self) -> bool: ...
def set_debug(self, enabled: bool) -> None: ...
if sys.version_info >= (3, 9):
async def shutdown_default_executor(self) -> None: ...
@@ -0,0 +1,18 @@
import sys
import contextvars
from typing import List, Tuple, Callable, Sequence
from . import futures
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
_PENDING: Literal["PENDING"] # undocumented
_CANCELLED: Literal["CANCELLED"] # undocumented
_FINISHED: Literal["FINISHED"] # undocumented
def isfuture(obj: object) -> bool: ...
def _format_callbacks(cb: Sequence[Tuple[Callable[[futures.Future], None], contextvars.Context]]) -> str: ... # undocumented
def _future_repr_info(future: futures.Future) -> List[str]: ... # undocumented
@@ -0,0 +1,59 @@
from typing import Optional, Union, Sequence, IO, Any, List, Deque, Dict, Tuple, Callable
import subprocess
from . import events
from . import protocols
from . import futures
from . import transports
_File = Optional[Union[int, IO[Any]]]
class BaseSubprocessTransport(transports.SubprocessTransport):
_closed: bool # undocumented
_protocol: protocols.SubprocessProtocol # undocumented
_loop: events.AbstractEventLoop # undocumented
_proc: Optional[subprocess.Popen] # undocumented
_pid: Optional[int] # undocumented
_returncode: Optional[int] # undocumented
_exit_waiters: List[futures.Future] # undocumented
_pending_calls: Deque[Tuple[Callable[..., Any], Tuple[Any, ...]]] # undocumented
_pipes: Dict[int, _File] # undocumented
_finished: bool # undocumented
def __init__(self, loop: events.AbstractEventLoop, protocol: protocols.SubprocessProtocol, args: Union[str, bytes, Sequence[Union[str, bytes]]],
shell: bool, stdin: _File, stdout: _File, stderr: _File, bufsize: int, waiter: Optional[futures.Future] = ..., extra: Optional[Any] = ..., **kwargs: Any) -> None: ...
def _start(self, args: Union[str, bytes, Sequence[Union[str, bytes]]], shell: bool, stdin: _File, stdout: _File, stderr: _File, bufsize: int, **kwargs: Any): ... # undocumented
def set_protocol(self, protocol: protocols.BaseProtocol) -> None: ...
def get_protocol(self) -> protocols.BaseProtocol: ...
def is_closing(self) -> bool: ...
def close(self) -> None: ...
def get_pid(self) -> Optional[int]: ... # type: ignore
def get_returncode(self) -> Optional[int]: ...
def get_pipe_transport(self, fd: int) -> _File: ... # type: ignore
def _check_proc(self) -> None: ... # undocumented
def send_signal(self, signal: int) -> None: ... # type: ignore
def terminate(self) -> None: ...
def kill(self) -> None: ...
async def _connect_pipes(self, waiter: Optional[futures.Future]) -> None: ... # undocumented
def _call(self, cb: Callable[..., Any], *data: Any) -> None: ... # undocumented
def _pipe_connection_lost(self, fd: int, exc: Optional[BaseException]) -> None: ... # undocumented
def _pipe_data_received(self, fd: int, data: bytes) -> None: ... # undocumented
def _process_exited(self, returncode: int) -> None: ... # undocumented
async def _wait(self) -> int: ... # undocumented
def _try_finish(self) -> None: ... # undocumented
def _call_connection_lost(self, exc: Optional[BaseException]) -> None: ... # undocumented
class WriteSubprocessPipeProto(protocols.BaseProtocol): # undocumented
def __init__(self, proc: BaseSubprocessTransport, fd: int) -> None: ...
def connection_made(self, transport: transports.BaseTransport) -> None: ...
def connection_lost(self, exc: Optional[BaseException]) -> None: ...
def pause_writing(self) -> None: ...
def resume_writing(self) -> None: ...
class ReadSubprocessPipeProto(WriteSubprocessPipeProto, protocols.Protocol): # undocumented
def data_received(self, data: bytes) -> None: ...
@@ -0,0 +1,16 @@
import sys
from typing import List, Optional, Union
from types import FrameType
from . import tasks
if sys.version_info >= (3, 6):
from builtins import _PathLike
_PathType = Union[bytes, str, _PathLike]
else:
_PathType = Union[bytes, str]
def _task_repr_info(task: tasks.Task) -> List[str]: ... # undocumented
def _task_get_stack(task: tasks.Task, limit: Optional[int]) -> List[FrameType]: ... # undocumented
def _task_print_stack(task: tasks.Task, limit: Optional[int], file: _PathType): ... # undocumented
@@ -0,0 +1,10 @@
import sys
from typing import List
if sys.version_info < (3, 7):
PY34: bool
PY35: bool
PY352: bool
def flatten_list_bytes(list_of_data: List[bytes]) -> bytes: ...
@@ -1,11 +1,14 @@
import enum
import sys
LOG_THRESHOLD_FOR_CONNLOST_WRITES: int
ACCEPT_RETRY_DELAY: int
DEBUG_STACK_DEPTH: int
SSL_HANDSHAKE_TIMEOUT: float
SENDFILE_FALLBACK_READBUFFER_SIZE: int
if sys.version_info >= (3, 6):
DEBUG_STACK_DEPTH: int
if sys.version_info >= (3, 7):
SSL_HANDSHAKE_TIMEOUT: float
SENDFILE_FALLBACK_READBUFFER_SIZE: int
class _SendfileMode(enum.Enum):
UNSUPPORTED: int = ...
@@ -192,18 +192,13 @@ class AbstractEventLoop(metaclass=ABCMeta):
family: int = ..., flags: int = ..., sock: socket = ..., backlog: int = ...,
ssl: _SSLContext = ..., reuse_address: Optional[bool] = ..., reuse_port: Optional[bool] = ...,
ssl_handshake_timeout: Optional[float] = ..., start_serving: bool = ...) -> AbstractServer: ...
@abstractmethod
async def create_unix_connection(self, protocol_factory: _ProtocolFactory, path: str, *, ssl: _SSLContext = ...,
sock: Optional[socket] = ..., server_hostname: str = ...,
async def create_unix_connection(self, protocol_factory: _ProtocolFactory, path: Optional[str] = ..., *, ssl: _SSLContext = ...,
sock: Optional[socket] = ..., server_hostname: Optional[str] = ...,
ssl_handshake_timeout: Optional[float] = ...) -> _TransProtPair: ...
@abstractmethod
async def create_unix_server(self, protocol_factory: _ProtocolFactory, path: str, *, sock: Optional[socket] = ...,
async def create_unix_server(self, protocol_factory: _ProtocolFactory, path: Optional[str] = ..., *, sock: Optional[socket] = ...,
backlog: int = ..., ssl: _SSLContext = ..., ssl_handshake_timeout: Optional[float] = ...,
start_serving: bool = ...) -> AbstractServer: ...
@abstractmethod
async def connect_accepted_socket(self, protocol_factory: _ProtocolFactory, sock: socket, *, ssl: _SSLContext = ...,
ssl_handshake_timeout: Optional[float] = ...) -> _TransProtPair: ...
@abstractmethod
async def sendfile(self, transport: BaseTransport, file: IO[bytes], offset: int = ..., count: Optional[int] = ..., *,
fallback: bool = ...) -> int: ...
@abstractmethod
@@ -225,15 +220,11 @@ class AbstractEventLoop(metaclass=ABCMeta):
sock: socket, backlog: int = ..., ssl: _SSLContext = ...,
reuse_address: Optional[bool] = ...,
reuse_port: Optional[bool] = ...) -> AbstractServer: ...
@abstractmethod
async def create_unix_connection(self, protocol_factory: _ProtocolFactory, path: str, *,
ssl: _SSLContext = ..., sock: Optional[socket] = ...,
server_hostname: str = ...) -> _TransProtPair: ...
@abstractmethod
server_hostname: Optional[str] = ...) -> _TransProtPair: ...
async def create_unix_server(self, protocol_factory: _ProtocolFactory, path: str, *,
sock: Optional[socket] = ..., backlog: int = ..., ssl: _SSLContext = ...) -> AbstractServer: ...
@abstractmethod
async def connect_accepted_socket(self, protocol_factory: _ProtocolFactory, sock: socket, *, ssl: _SSLContext = ...) -> _TransProtPair: ...
@abstractmethod
async def create_datagram_endpoint(self, protocol_factory: _ProtocolFactory,
local_addr: Optional[Tuple[str, int]] = ..., remote_addr: Optional[Tuple[str, int]] = ..., *,
@@ -302,6 +293,9 @@ class AbstractEventLoop(metaclass=ABCMeta):
def get_debug(self) -> bool: ...
@abstractmethod
def set_debug(self, enabled: bool) -> None: ...
if sys.version_info >= (3, 9):
@abstractmethod
async def shutdown_default_executor(self) -> None: ...
class AbstractEventLoopPolicy(metaclass=ABCMeta):
@abstractmethod
@@ -332,7 +326,7 @@ def new_event_loop() -> AbstractEventLoop: ...
def get_child_watcher() -> AbstractChildWatcher: ...
def set_child_watcher(watcher: AbstractChildWatcher) -> None: ...
def _set_running_loop(loop: Optional[AbstractEventLoop]) -> None: ...
def _set_running_loop(__loop: Optional[AbstractEventLoop]) -> None: ...
def _get_running_loop() -> AbstractEventLoop: ...
if sys.version_info >= (3, 7):
@@ -0,0 +1,25 @@
import sys
import functools
import traceback
from typing import Optional, Tuple, Union, Iterable, Dict, Any, overload
from types import FunctionType, FrameType
class _HasWrapper:
__wrapper__: Union[_HasWrapper, FunctionType]
_FuncType = Union[FunctionType, _HasWrapper, functools.partial, functools.partialmethod]
if sys.version_info >= (3, 7):
@overload
def _get_function_source(func: _FuncType) -> Tuple[str, int]: ...
@overload
def _get_function_source(func: object) -> Optional[Tuple[str, int]]: ...
def _format_callback_source(func: object, args: Iterable[Any]) -> str: ...
def _format_args_and_kwargs(args: Iterable[Any], kwargs: Dict[str, Any]) -> str: ...
def _format_callback(func: object, args: Iterable[Any], kwargs: Dict[str, Any], suffix: str = ...) -> str: ...
def extract_stack(f: Optional[FrameType] = ..., limit: Optional[int] = ...) -> traceback.StackSummary: ...
@@ -1,7 +1,7 @@
import sys
from typing import Any, Union, Callable, TypeVar, Type, List, Iterable, Generator, Awaitable, Optional, Tuple
from .events import AbstractEventLoop
from concurrent.futures import (
from concurrent.futures._base import (
Future as _ConcurrentFuture,
Error,
)
@@ -46,19 +46,20 @@ class Future(Awaitable[_T], Iterable[_T]):
@property
def _callbacks(self: _S) -> List[Callable[[_S], Any]]: ...
def add_done_callback(self: _S, __fn: Callable[[_S], Any]) -> None: ...
def cancel(self) -> bool: ...
def _schedule_callbacks(self) -> None: ...
if sys.version_info >= (3, 9):
def cancel(self, msg: Optional[str] = ...) -> bool: ...
else:
def cancel(self) -> bool: ...
def cancelled(self) -> bool: ...
def done(self) -> bool: ...
def result(self) -> _T: ...
def exception(self) -> Optional[BaseException]: ...
def remove_done_callback(self: _S, fn: Callable[[_S], Any]) -> int: ...
def set_result(self, result: _T) -> None: ...
def set_exception(self, exception: Union[type, BaseException]) -> None: ...
def _copy_state(self, other: Any) -> None: ...
def remove_done_callback(self: _S, __fn: Callable[[_S], Any]) -> int: ...
def set_result(self, __result: _T) -> None: ...
def set_exception(self, __exception: Union[type, BaseException]) -> None: ...
def __iter__(self) -> Generator[Any, None, _T]: ...
def __await__(self) -> Generator[Any, None, _T]: ...
@property
def _loop(self) -> AbstractEventLoop: ...
def wrap_future(f: Union[_ConcurrentFuture[_T], Future[_T]], *, loop: Optional[AbstractEventLoop] = ...) -> Future[_T]: ...
def wrap_future(future: Union[_ConcurrentFuture[_T], Future[_T]], *, loop: Optional[AbstractEventLoop] = ...) -> Future[_T]: ...
@@ -1,4 +1,5 @@
from typing import Any, Callable, Type, TypeVar, Union, Optional, Awaitable
import sys
from typing import Any, Callable, Iterable, Generator, Type, TypeVar, Union, Optional, Awaitable
from .events import AbstractEventLoop
from .futures import Future
@@ -6,17 +7,28 @@ from types import TracebackType
_T = TypeVar('_T')
class _ContextManager:
def __init__(self, lock: Union[Lock, Semaphore]) -> None: ...
def __enter__(self) -> object: ...
def __exit__(self, *args: Any) -> None: ...
class _ContextManagerMixin(Future[_ContextManager]):
# Apparently this exists to *prohibit* use as a context manager.
def __enter__(self) -> object: ...
def __exit__(self, *args: Any) -> None: ...
def __aenter__(self) -> Awaitable[None]: ...
def __aexit__(self, exc_type: Optional[Type[BaseException]], exc: Optional[BaseException], tb: Optional[TracebackType]) -> Awaitable[None]: ...
if sys.version_info >= (3, 9):
class _ContextManagerMixin:
def __init__(self, lock: Union[Lock, Semaphore]) -> None: ...
def __aenter__(self) -> Awaitable[None]: ...
def __aexit__(self, exc_type: Optional[Type[BaseException]], exc: Optional[BaseException], tb: Optional[TracebackType]) -> Awaitable[None]: ...
else:
class _ContextManager:
def __init__(self, lock: Union[Lock, Semaphore]) -> None: ...
def __enter__(self) -> object: ...
def __exit__(self, *args: Any) -> None: ...
class _ContextManagerMixin:
def __init__(self, lock: Union[Lock, Semaphore]) -> None: ...
# Apparently this exists to *prohibit* use as a context manager.
def __enter__(self) -> object: ...
def __exit__(self, *args: Any) -> None: ...
def __iter__(self) -> Generator[Any, None, _ContextManager]: ...
def __await__(self) -> Generator[Any, None, _ContextManager]: ...
def __aenter__(self) -> Awaitable[None]: ...
def __aexit__(self, exc_type: Optional[Type[BaseException]], exc: Optional[BaseException], tb: Optional[TracebackType]) -> Awaitable[None]: ...
class Lock(_ContextManagerMixin):
def __init__(self, *, loop: Optional[AbstractEventLoop] = ...) -> None: ...
@@ -0,0 +1,4 @@
import logging
logger: logging.Logger
@@ -46,35 +46,4 @@ class _ProactorSocketTransport(_ProactorReadPipeTransport, _ProactorBaseWritePip
def write_eof(self) -> None: ...
class BaseProactorEventLoop(base_events.BaseEventLoop):
def __init__(self, proactor: Any) -> None: ...
# The methods below don't actually exist directly, ProactorEventLoops do not implement them. However, they are
# needed to satisfy mypy
if sys.version_info >= (3, 7):
async def create_unix_connection(
self,
protocol_factory: events._ProtocolFactory,
path: _Path,
*,
ssl: events._SSLContext = ...,
sock: Optional[socket] = ...,
server_hostname: str = ...,
ssl_handshake_timeout: Optional[float] = ...,
) -> events._TransProtPair: ...
async def create_unix_server(
self,
protocol_factory: events._ProtocolFactory,
path: _Path,
*,
sock: Optional[socket] = ...,
backlog: int = ...,
ssl: events._SSLContext = ...,
ssl_handshake_timeout: Optional[float] = ...,
start_serving: bool = ...,
) -> events.AbstractServer: ...
else:
async def create_unix_connection(self, protocol_factory: events._ProtocolFactory, path: str, *,
ssl: events._SSLContext = ..., sock: Optional[socket] = ...,
server_hostname: str = ...) -> events._TransProtPair: ...
async def create_unix_server(self, protocol_factory: events._ProtocolFactory, path: str, *,
sock: Optional[socket] = ..., backlog: int = ..., ssl: events._SSLContext = ...) -> events.AbstractServer: ...
@@ -1,3 +1,4 @@
import sys
from asyncio import transports
from typing import Optional, Tuple, Union
@@ -11,9 +12,10 @@ class Protocol(BaseProtocol):
def data_received(self, data: bytes) -> None: ...
def eof_received(self) -> Optional[bool]: ...
class BufferedProtocol(Protocol):
def get_buffer(self, sizehint: int) -> bytearray: ...
def buffer_updated(self, nbytes: int) -> None: ...
if sys.version_info >= (3, 7):
class BufferedProtocol(BaseProtocol):
def get_buffer(self, sizehint: int) -> bytearray: ...
def buffer_updated(self, nbytes: int) -> None: ...
class DatagramProtocol(BaseProtocol):
def datagram_received(self, data: bytes, addr: Tuple[str, int]) -> None: ...
@@ -14,8 +14,6 @@ class Queue(Generic[_T]):
def __repr__(self) -> str: ...
def __str__(self) -> str: ...
def _format(self) -> str: ...
def _consume_done_getters(self) -> None: ...
def _consume_done_putters(self) -> None: ...
def qsize(self) -> int: ...
@property
def maxsize(self) -> int: ...
@@ -1,7 +1,7 @@
import selectors
import sys
from socket import socket
from typing import Optional, Union
from typing import Any, Optional, Union
from . import base_events, events
@@ -12,33 +12,4 @@ else:
_Path = str
class BaseSelectorEventLoop(base_events.BaseEventLoop):
def __init__(self, selector: Optional[selectors.BaseSelector] = ...) -> None: ...
if sys.version_info >= (3, 7):
async def create_unix_connection(
self,
protocol_factory: events._ProtocolFactory,
path: _Path,
*,
ssl: events._SSLContext = ...,
sock: Optional[socket] = ...,
server_hostname: str = ...,
ssl_handshake_timeout: Optional[float] = ...,
) -> events._TransProtPair: ...
async def create_unix_server(
self,
protocol_factory: events._ProtocolFactory,
path: _Path,
*,
sock: Optional[socket] = ...,
backlog: int = ...,
ssl: events._SSLContext = ...,
ssl_handshake_timeout: Optional[float] = ...,
start_serving: bool = ...,
) -> events.AbstractServer: ...
else:
async def create_unix_connection(self, protocol_factory: events._ProtocolFactory, path: str, *,
ssl: events._SSLContext = ..., sock: Optional[socket] = ...,
server_hostname: str = ...) -> events._TransProtPair: ...
async def create_unix_server(self, protocol_factory: events._ProtocolFactory, path: str, *,
sock: Optional[socket] = ..., backlog: int = ..., ssl: events._SSLContext = ...) -> events.AbstractServer: ...
@@ -0,0 +1,135 @@
import sys
import ssl
from typing import ClassVar, Optional, List, Tuple, Callable, Dict, Any, Deque
from . import transports
from . import constants
from . import events
from . import protocols
from . import futures
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
def _create_transport_context(server_side: bool, server_hostname: Optional[str]) -> ssl.SSLContext: ...
_UNWRAPPED: Literal["UNWRAPPED"]
_DO_HANDSHAKE: Literal["DO_HANDSHAKE"]
_WRAPPED: Literal["WRAPPED"]
_SHUTDOWN: Literal["SHUTDOWN"]
class _SSLPipe:
max_size: ClassVar[int]
_context: ssl.SSLContext
_server_side: bool
_server_hostname: Optional[str]
_state: str
_incoming: ssl.MemoryBIO
_outgoing: ssl.MemoryBIO
_sslobj: Optional[ssl.SSLObject]
_need_ssldata: bool
_handshake_cb: Optional[Callable[[Optional[BaseException]], None]]
_shutdown_cb: Optional[Callable[[], None]]
def __init__(self, context: ssl.SSLContext, server_side: bool, server_hostname: Optional[str] = ...) -> None: ...
@property
def context(self) -> ssl.SSLContext: ...
@property
def ssl_object(self) -> Optional[ssl.SSLObject]: ...
@property
def need_ssldata(self) -> bool: ...
@property
def wrapped(self) -> bool: ...
def do_handshake(self, callback: Optional[Callable[[Optional[BaseException]], None]] = ...) -> List[bytes]: ...
def shutdown(self, callback: Optional[Callable[[], None]] = ...) -> List[bytes]: ...
def feed_eof(self) -> None: ...
def feed_ssldata(self, data: bytes, only_handshake: bool = ...) -> Tuple[List[bytes], List[bytes]]: ...
def feed_appdata(self, data: bytes, offset: int = ...) -> Tuple[List[bytes], int]: ...
class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport):
_sendfile_compatible: ClassVar[constants._SendfileMode]
_loop: events.AbstractEventLoop
_ssl_protocol: SSLProtocol
_closed: bool
if sys.version_info >= (3, 6):
def __init__(self, loop: events.AbstractEventLoop, ssl_protocol: SSLProtocol) -> None: ...
else:
def __init__(self, loop: events.AbstractEventLoop, ssl_protocol: SSLProtocol, app_protocol: protocols.BaseProtocol) -> None: ...
def get_extra_info(self, name: str, default: Optional[Any] = ...) -> Dict[str, Any]: ...
def set_protocol(self, protocol: protocols.BaseProtocol) -> None: ...
def get_protocol(self) -> protocols.BaseProtocol: ...
def is_closing(self) -> bool: ...
def close(self) -> None: ...
if sys.version_info >= (3, 7):
def is_reading(self) -> bool: ...
def pause_reading(self) -> None: ...
def resume_reading(self) -> None: ...
def set_write_buffer_limits(self, high: Optional[int] = ..., low: Optional[int] = ...) -> None: ...
def get_write_buffer_size(self) -> int: ...
if sys.version_info >= (3, 7):
@property
def _protocol_paused(self) -> bool: ...
def write(self, data: bytes) -> None: ...
def can_write_eof(self) -> Literal[False]: ...
def abort(self) -> None: ...
class SSLProtocol(protocols.Protocol):
_server_side: bool
_server_hostname: Optional[str]
_sslcontext: ssl.SSLContext
_extra: Dict[str, Any]
_write_backlog: Deque[Tuple[bytes, int]]
_write_buffer_size: int
_waiter: futures.Future
_loop: events.AbstractEventLoop
_app_transport: _SSLProtocolTransport
_sslpipe: Optional[_SSLPipe]
_session_established: bool
_in_handshake: bool
_in_shutdown: bool
_transport: Optional[transports.BaseTransport]
_call_connection_made: bool
_ssl_handshake_timeout: Optional[int]
_app_protocol: protocols.BaseProtocol
_app_protocol_is_buffer: bool
if sys.version_info >= (3, 7):
def __init__(self, loop: events.AbstractEventLoop, app_protocol: protocols.BaseProtocol, sslcontext: ssl.SSLContext, waiter: futures.Future,
server_side: bool = ..., server_hostname: Optional[str] = ..., call_connection_made: bool = ..., ssl_handshake_timeout: Optional[int] = ...) -> None: ...
else:
def __init__(self, loop: events.AbstractEventLoop, app_protocol: protocols.BaseProtocol, sslcontext: ssl.SSLContext, waiter: futures.Future,
server_side: bool = ..., server_hostname: Optional[str] = ..., call_connection_made: bool = ...) -> None: ...
if sys.version_info >= (3, 7):
def _set_app_protocol(self, app_protocol: protocols.BaseProtocol) -> None: ...
def _wakeup_waiter(self, exc: Optional[BaseException] = ...) -> None: ...
def connection_made(self, transport: transports.BaseTransport) -> None: ...
def connection_lost(self, exc: Optional[BaseException]) -> None: ...
def pause_writing(self) -> None: ...
def resume_writing(self) -> None: ...
def data_received(self, data: bytes) -> None: ...
def eof_received(self) -> None: ...
def _get_extra_info(self, name: str, default: Optional[Any] = ...) -> Any: ...
def _start_shutdown(self) -> None: ...
def _write_appdata(self, data: bytes) -> None: ...
def _start_handshake(self) -> None: ...
if sys.version_info >= (3, 7):
def _check_handshake_timeout(self) -> None: ...
def _on_handshake_complete(self, handshake_exc: Optional[BaseException]) -> None: ...
def _process_write_backlog(self) -> None: ...
def _fatal_error(self, exc: BaseException, message: str = ...) -> None: ...
def _finalize(self) -> None: ...
def _abort(self) -> None: ...
@@ -0,0 +1,7 @@
import sys
from typing import Iterable, Callable, Awaitable, Optional, Tuple, Any, List
from . import events
if sys.version_info >= (3, 8):
async def staggered_race(coro_fns: Iterable[Callable[[], Awaitable]], delay: Optional[float], *, loop: Optional[events.AbstractEventLoop] = ...) -> Tuple[Any, Optional[int], List[Optional[Exception]]]: ...
@@ -18,8 +18,8 @@ if sys.version_info < (3, 8):
def __init__(self, message: str, consumed: int) -> None: ...
async def open_connection(
host: str = ...,
port: Union[int, str] = ...,
host: Optional[str] = ...,
port: Optional[Union[int, str]] = ...,
*,
loop: Optional[events.AbstractEventLoop] = ...,
limit: int = ...,
@@ -46,7 +46,7 @@ if sys.platform != 'win32':
_PathType = str
async def open_unix_connection(
path: _PathType = ...,
path: Optional[_PathType] = ...,
*,
loop: Optional[events.AbstractEventLoop] = ...,
limit: int = ...,
@@ -55,7 +55,7 @@ if sys.platform != 'win32':
async def start_unix_server(
client_connected_cb: _ClientConnectedCallback,
path: _PathType = ...,
path: Optional[_PathType] = ...,
*,
loop: Optional[events.AbstractEventLoop] = ...,
limit: int = ...,
@@ -66,7 +66,7 @@ class FlowControlMixin(protocols.Protocol): ...
class StreamReaderProtocol(FlowControlMixin, protocols.Protocol):
def __init__(self,
stream_reader: StreamReader,
client_connected_cb: _ClientConnectedCallback = ...,
client_connected_cb: Optional[_ClientConnectedCallback] = ...,
loop: Optional[events.AbstractEventLoop] = ...) -> None: ...
def connection_made(self, transport: transports.BaseTransport) -> None: ...
def connection_lost(self, exc: Optional[Exception]) -> None: ...
@@ -30,7 +30,7 @@ class Process:
protocol: protocols.BaseProtocol,
loop: events.AbstractEventLoop) -> None: ...
@property
def returncode(self) -> int: ...
def returncode(self) -> Optional[int]: ...
async def wait(self) -> int: ...
def send_signal(self, signal: int) -> None: ...
def terminate(self) -> None: ...
@@ -39,11 +39,11 @@ class Process:
async def create_subprocess_shell(
*Args: Union[str, bytes], # Union used instead of AnyStr due to mypy issue #1236
cmd: Union[str, bytes], # Union used instead of AnyStr due to mypy issue #1236
stdin: Union[int, IO[Any], None] = ...,
stdout: Union[int, IO[Any], None] = ...,
stderr: Union[int, IO[Any], None] = ...,
loop: events.AbstractEventLoop = ...,
loop: Optional[events.AbstractEventLoop] = ...,
limit: int = ...,
**kwds: Any
) -> Process: ...
@@ -54,7 +54,7 @@ async def create_subprocess_exec(
stdin: Union[int, IO[Any], None] = ...,
stdout: Union[int, IO[Any], None] = ...,
stderr: Union[int, IO[Any], None] = ...,
loop: events.AbstractEventLoop = ...,
loop: Optional[events.AbstractEventLoop] = ...,
limit: int = ...,
**kwds: Any
) -> Process: ...
@@ -85,7 +85,7 @@ def gather(coro_or_future1: _FutureT[_T1], coro_or_future2: _FutureT[_T2], coro_
def run_coroutine_threadsafe(coro: _FutureT[_T],
loop: AbstractEventLoop) -> concurrent.futures.Future[_T]: ...
def shield(arg: _FutureT[_T], *, loop: Optional[AbstractEventLoop] = ...) -> Future[_T]: ...
def sleep(delay: float, result: _T = ..., loop: Optional[AbstractEventLoop] = ...) -> Future[_T]: ...
def sleep(delay: float, result: _T = ..., *, loop: Optional[AbstractEventLoop] = ...) -> Future[_T]: ...
def wait(fs: Iterable[_FutureT[_T]], *, loop: Optional[AbstractEventLoop] = ..., timeout: Optional[float] = ...,
return_when: str = ...) -> Future[Tuple[Set[Future[_T]], Set[Future[_T]]]]: ...
def wait_for(fut: _FutureT[_T], timeout: Optional[float],
@@ -93,7 +93,7 @@ def wait_for(fut: _FutureT[_T], timeout: Optional[float],
class Task(Future[_T], Generic[_T]):
@classmethod
def current_task(cls, loop: Optional[AbstractEventLoop] = ...) -> Task[Any]: ...
def current_task(cls, loop: Optional[AbstractEventLoop] = ...) -> Optional[Task[Any]]: ...
@classmethod
def all_tasks(cls, loop: Optional[AbstractEventLoop] = ...) -> Set[Task[Any]]: ...
if sys.version_info >= (3, 8):
@@ -110,20 +110,22 @@ class Task(Future[_T], Generic[_T]):
if sys.version_info >= (3, 8):
def get_coro(self) -> Any: ...
def get_name(self) -> str: ...
def set_name(self, value: object) -> None: ...
def set_name(self, __value: object) -> None: ...
def get_stack(self, *, limit: int = ...) -> List[FrameType]: ...
def print_stack(self, *, limit: int = ..., file: TextIO = ...) -> None: ...
def cancel(self) -> bool: ...
def _step(self, value: Any = ..., exc: Exception = ...) -> None: ...
if sys.version_info >= (3, 9):
def cancel(self, msg: Optional[str] = ...) -> bool: ...
else:
def cancel(self) -> bool: ...
if sys.version_info < (3, 7):
def _wakeup(self, future: Future[Any]) -> None: ...
def _wakeup(self, fut: Future[Any]) -> None: ...
if sys.version_info >= (3, 7):
def all_tasks(loop: Optional[AbstractEventLoop] = ...) -> Set[Task[Any]]: ...
if sys.version_info >= (3, 8):
def create_task(
coro: Union[Generator[Any, None, _T], Awaitable[_T]], *, name: Optional[str] = ...,
) -> Task[Any]: ...
) -> Task[_T]: ...
else:
def create_task(coro: Union[Generator[Any, None, _T], Awaitable[_T]]) -> Task[Any]: ...
def create_task(coro: Union[Generator[Any, None, _T], Awaitable[_T]]) -> Task[_T]: ...
def current_task(loop: Optional[AbstractEventLoop] = ...) -> Optional[Task[Any]]: ...
@@ -0,0 +1,7 @@
import sys
from typing import Any, Callable, TypeVar
_T = TypeVar('_T')
if sys.version_info >= (3, 9):
async def to_thread(__func: Callable[..., _T], *args: Any, **kwargs: Any) -> _T: ...
@@ -1,4 +1,5 @@
import sys
from socket import _Address
from typing import Any, Mapping, List, Optional, Tuple
from asyncio.protocols import BaseProtocol
from asyncio.events import AbstractEventLoop
@@ -20,7 +21,7 @@ class ReadTransport(BaseTransport):
class WriteTransport(BaseTransport):
def set_write_buffer_limits(
self, high: int = ..., low: int = ...
self, high: Optional[int] = ..., low: Optional[int] = ...
) -> None: ...
def get_write_buffer_size(self) -> int: ...
def write(self, data: Any) -> None: ...
@@ -32,7 +33,7 @@ class WriteTransport(BaseTransport):
class Transport(ReadTransport, WriteTransport): ...
class DatagramTransport(BaseTransport):
def sendto(self, data: Any, addr: Optional[Tuple[str, int]] = ...) -> None: ...
def sendto(self, data: Any, addr: Optional[_Address] = ...) -> None: ...
def abort(self) -> None: ...
class SubprocessTransport(BaseTransport):
@@ -0,0 +1,78 @@
import sys
import socket
from typing import Union, NoReturn, Tuple, Optional, Iterable, List, Any, BinaryIO, Type, overload
from types import TracebackType
if sys.version_info >= (3, 8):
# These are based in socket, maybe move them out into _typeshed.pyi or such
_Address = Union[tuple, str]
_RetAddress = Any
_WriteBuffer = Union[bytearray, memoryview]
_CMSG = Tuple[int, int, bytes]
class TransportSocket:
def __init__(self, sock: socket.socket) -> None: ...
def _na(self, what: str) -> None: ...
@property
def family(self) -> int: ...
@property
def type(self) -> int: ...
@property
def proto(self) -> int: ...
def __getstate__(self) -> NoReturn: ...
def fileno(self) -> int: ...
def dup(self) -> socket.socket: ...
def get_inheritable(self) -> bool: ...
def shutdown(self, how: int) -> None: ...
@overload
def getsockopt(self, level: int, optname: int) -> int: ...
@overload
def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ...
@overload
def setsockopt(self, level: int, optname: int, value: Union[int, bytes]) -> None: ...
@overload
def setsockopt(self, level: int, optname: int, value: None, optlen: int) -> None: ...
def getpeername(self) -> _RetAddress: ...
def getsockname(self) -> _RetAddress: ...
def getsockbyname(self) -> NoReturn: ... # This method doesn't exist on socket, yet is passed through?
def accept(self) -> Tuple[socket.socket, _RetAddress]: ...
def connect(self, address: Union[_Address, bytes]) -> None: ...
def connect_ex(self, address: Union[_Address, bytes]) -> int: ...
def bind(self, address: Union[_Address, bytes]) -> None: ...
if sys.platform == 'win32':
def ioctl(self, control: int, option: Union[int, Tuple[int, int, int], bool]) -> None: ...
else:
def ioctl(self, control: int, option: Union[int, Tuple[int, int, int], bool]) -> NoReturn: ...
def listen(self, __backlog: int = ...) -> None: ...
def makefile(self) -> BinaryIO: ...
def sendfile(self, file, offset: int = ..., count: Optional[int] = ...) -> int: ...
def close(self) -> None: ...
def detach(self) -> int: ...
if sys.platform == "linux":
def sendmsg_afalg(self, msg=..., *, op, iv=..., assoclen=..., flags=...) -> int: ...
else:
def sendmsg_afalg(self, msg=..., *, op, iv=..., assoclen=..., flags=...) -> NoReturn: ...
def sendmsg(self, __buffers: Iterable[bytes], __ancdata: Iterable[_CMSG] = ..., __flags: int = ..., __address: _Address = ...) -> int: ...
@overload
def sendto(self, data: bytes, address: _Address) -> int: ...
@overload
def sendto(self, data: bytes, flags: int, address: _Address) -> int: ...
def send(self, data: bytes, flags: int = ...) -> int: ...
def sendall(self, data: bytes, flags: int = ...) -> None: ...
def set_inheritable(self, inheritable: bool) -> None: ...
if sys.platform == 'win32':
def share(self, process_id: int) -> bytes: ...
else:
def share(self, process_id: int) -> NoReturn: ...
def recv_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> int: ...
def recvfrom_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> Tuple[int, _RetAddress]: ...
def recvmsg_into(self, __buffers: Iterable[_WriteBuffer], __ancbufsize: int = ..., __flags: int = ...) -> Tuple[int, List[_CMSG], int, Any]: ...
def recvmsg(self, __bufsize: int, __ancbufsize: int = ..., __flags: int = ...) -> Tuple[bytes, List[_CMSG], int, Any]: ...
def recvfrom(self, bufsize: int, flags: int = ...) -> Tuple[bytes, _RetAddress]: ...
def recv(self, bufsize: int, flags: int = ...) -> bytes: ...
def settimeout(self, value: Optional[float]) -> None: ...
def gettimeout(self) -> Optional[float]: ...
def setblocking(self, flag: bool) -> None: ...
def __enter__(self) -> socket.socket: ...
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> None: ...
@@ -1,9 +1,18 @@
import socket
import sys
from typing import IO, Any, Callable, ClassVar, List, NoReturn, Optional, Tuple
from typing import IO, Any, Callable, ClassVar, List, NoReturn, Optional, Tuple, Type
from . import events, futures, proactor_events, selector_events, streams, windows_utils
__all__ = [
"SelectorEventLoop",
"ProactorEventLoop",
"IocpProactor",
"DefaultEventLoopPolicy",
"WindowsSelectorEventLoopPolicy",
"WindowsProactorEventLoopPolicy",
]
NULL: int
INFINITE: int
ERROR_CONNECTION_REFUSED: int
@@ -35,31 +44,33 @@ class IocpProactor:
def set_loop(self, loop: events.AbstractEventLoop) -> None: ...
def select(self, timeout: Optional[int] = ...) -> List[futures.Future[Any]]: ...
def recv(self, conn: socket.socket, nbytes: int, flags: int = ...) -> futures.Future[bytes]: ...
def recv_into(self, conn: socket.socket, buf: socket._WriteBuffer, flags: int = ...) -> futures.Future[Any]: ...
if sys.version_info >= (3, 7):
def recv_into(self, conn: socket.socket, buf: socket._WriteBuffer, flags: int = ...) -> futures.Future[Any]: ...
def send(self, conn: socket.socket, buf: socket._WriteBuffer, flags: int = ...) -> futures.Future[Any]: ...
def accept(self, listener: socket.socket) -> futures.Future[Any]: ...
def connect(self, conn: socket.socket, address: bytes) -> futures.Future[Any]: ...
def sendfile(self, sock: socket.socket, file: IO[bytes], offset: int, count: int) -> futures.Future[Any]: ...
if sys.version_info >= (3, 7):
def sendfile(self, sock: socket.socket, file: IO[bytes], offset: int, count: int) -> futures.Future[Any]: ...
def accept_pipe(self, pipe: socket.socket) -> futures.Future[Any]: ...
async def connect_pipe(self, address: bytes) -> windows_utils.PipeHandle: ...
def wait_for_handle(self, handle: windows_utils.PipeHandle, timeout: int = ...) -> bool: ...
def wait_for_handle(self, handle: windows_utils.PipeHandle, timeout: Optional[int] = ...) -> bool: ...
def close(self) -> None: ...
SelectorEventLoop = _WindowsSelectorEventLoop
if sys.version_info >= (3, 7):
class WindowsSelectorEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
_loop_factory: ClassVar[events.AbstractEventLoop]
_loop_factory: ClassVar[Type[SelectorEventLoop]]
def get_child_watcher(self) -> NoReturn: ...
def set_child_watcher(self, watcher: Any) -> NoReturn: ...
class WindowsProactorEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
_loop_factory: ClassVar[events.AbstractEventLoop]
_loop_factory: ClassVar[Type[ProactorEventLoop]]
def get_child_watcher(self) -> NoReturn: ...
def set_child_watcher(self, watcher: Any) -> NoReturn: ...
DefaultEventLoopPolicy = WindowsSelectorEventLoopPolicy
else:
class _WindowsDefaultEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
_loop_factory: ClassVar[events.AbstractEventLoop]
_loop_factory: ClassVar[Type[SelectorEventLoop]]
def get_child_watcher(self) -> NoReturn: ...
def set_child_watcher(self, watcher: Any) -> NoReturn: ...
DefaultEventLoopPolicy = _WindowsDefaultEventLoopPolicy
@@ -1,7 +1,13 @@
from typing import Tuple, Callable, Optional
import sys
from typing import Tuple, Callable, Optional, Type, Protocol
from types import TracebackType
class _WarnFunction(Protocol):
def __call__(self, message: str, category: Type[Warning], source: PipeHandle): ...
BUFSIZE: int
PIPE: int
STDOUT: int
@@ -12,7 +18,10 @@ class PipeHandle:
def __init__(self, handle: int) -> None: ...
def __repr__(self) -> str: ...
def __del__(self) -> None: ...
if sys.version_info >= (3, 8):
def __del__(self, _warn: _WarnFunction = ...) -> None: ...
else:
def __del__(self) -> None: ...
def __enter__(self) -> PipeHandle: ...
def __exit__(self, t: Optional[type], v: Optional[BaseException], tb: Optional[TracebackType]) -> None: ...
@property
+137 -10
View File
@@ -9,8 +9,12 @@ from typing import (
ItemsView, KeysView, ValuesView, ByteString, Optional, AnyStr, Type, Text,
Protocol,
)
from abc import abstractmethod, ABCMeta
from abc import ABCMeta
from ast import mod, AST
from io import (
_OpenBinaryMode, _OpenTextMode, _OpenBinaryModeUpdating, _OpenBinaryModeWriting, _OpenBinaryModeReading,
TextIOWrapper, FileIO, BufferedRandom, BufferedReader, BufferedWriter
)
from types import TracebackType, CodeType
import sys
@@ -291,6 +295,9 @@ _str_base = object
class _FormatMapMapping(Protocol):
def __getitem__(self, __key: str) -> Any: ...
class str(Sequence[str], _str_base):
@overload
def __init__(self, o: object = ...) -> None: ...
@@ -308,7 +315,7 @@ class str(Sequence[str], _str_base):
def expandtabs(self, tabsize: int = ...) -> str: ...
def find(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
def format(self, *args: object, **kwargs: object) -> str: ...
def format_map(self, map: Mapping[str, Any]) -> str: ...
def format_map(self, map: _FormatMapMapping) -> str: ...
def index(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
def isalnum(self) -> bool: ...
def isalpha(self) -> bool: ...
@@ -329,6 +336,9 @@ class str(Sequence[str], _str_base):
def lstrip(self, __chars: Optional[str] = ...) -> str: ...
def partition(self, __sep: str) -> Tuple[str, str, str]: ...
def replace(self, __old: str, __new: str, __count: int = ...) -> str: ...
if sys.version_info >= (3, 9):
def removeprefix(self, __prefix: str) -> str: ...
def removesuffix(self, __suffix: str) -> str: ...
def rfind(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
def rindex(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
def rjust(self, __width: int, __fillchar: str = ...) -> str: ...
@@ -412,6 +422,9 @@ class bytes(ByteString):
def lstrip(self, __bytes: Optional[bytes] = ...) -> bytes: ...
def partition(self, __sep: bytes) -> Tuple[bytes, bytes, bytes]: ...
def replace(self, __old: bytes, __new: bytes, __count: int = ...) -> bytes: ...
if sys.version_info >= (3, 9):
def removeprefix(self, __prefix: bytes) -> bytes: ...
def removesuffix(self, __suffix: bytes) -> bytes: ...
def rfind(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ...
def rindex(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ...
def rjust(self, __width: int, __fillchar: bytes = ...) -> bytes: ...
@@ -498,6 +511,9 @@ class bytearray(MutableSequence[int], ByteString):
def lower(self) -> bytearray: ...
def lstrip(self, __bytes: Optional[bytes] = ...) -> bytearray: ...
def partition(self, __sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...
if sys.version_info >= (3, 9):
def removeprefix(self, __prefix: bytes) -> bytearray: ...
def removesuffix(self, __suffix: bytes) -> bytearray: ...
def replace(self, __old: bytes, __new: bytes, __count: int = ...) -> bytearray: ...
def rfind(self, __sub: Union[bytes, int], __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
def rindex(self, __sub: Union[bytes, int], __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
@@ -965,12 +981,99 @@ def next(__i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...
def oct(__number: Union[int, _SupportsIndex]) -> str: ...
if sys.version_info >= (3, 6):
def open(file: Union[str, bytes, int, _PathLike[Any]], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ...,
errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ...,
opener: Optional[Callable[[str, int], int]] = ...) -> IO[Any]: ...
def open(file: Union[str, bytes, int], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ...,
errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ...,
opener: Optional[Callable[[str, int], int]] = ...) -> IO[Any]: ...
# Changed in version 3.6: Support added to accept objects implementing os.PathLike.
_OpenFile = Union[str, bytes, int, _PathLike[Any]]
else:
_OpenFile = Union[str, bytes, int]
_Opener = Callable[[str, int], int]
# Text mode: always returns a TextIOWrapper
@overload
def open(
file: _OpenFile,
mode: _OpenTextMode = ...,
buffering: int = ...,
encoding: Optional[str] = ...,
errors: Optional[str] = ...,
newline: Optional[str] = ...,
closefd: bool = ...,
opener: Optional[_Opener] = ...,
) -> TextIOWrapper: ...
# Unbuffered binary mode: returns a FileIO
@overload
def open(
file: _OpenFile,
mode: _OpenBinaryMode,
buffering: Literal[0],
encoding: None = ...,
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
opener: Optional[_Opener] = ...,
) -> FileIO: ...
# Buffering is on: return BufferedRandom, BufferedReader, or BufferedWriter
@overload
def open(
file: _OpenFile,
mode: _OpenBinaryModeUpdating,
buffering: Literal[-1, 1] = ...,
encoding: None = ...,
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
opener: Optional[_Opener] = ...,
) -> BufferedRandom: ...
@overload
def open(
file: _OpenFile,
mode: _OpenBinaryModeWriting,
buffering: Literal[-1, 1] = ...,
encoding: None = ...,
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
opener: Optional[_Opener] = ...,
) -> BufferedWriter: ...
@overload
def open(
file: _OpenFile,
mode: _OpenBinaryModeReading,
buffering: Literal[-1, 1] = ...,
encoding: None = ...,
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
opener: Optional[_Opener] = ...,
) -> BufferedReader: ...
# Buffering cannot be determined: fall back to BinaryIO
@overload
def open(
file: _OpenFile,
mode: _OpenBinaryMode,
buffering: int,
encoding: None = ...,
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
opener: Optional[_Opener] = ...,
) -> BinaryIO: ...
# Fallback if mode is not specified
@overload
def open(
file: _OpenFile,
mode: str,
buffering: int = ...,
encoding: Optional[str] = ...,
errors: Optional[str] = ...,
newline: Optional[str] = ...,
closefd: bool = ...,
opener: Optional[_Opener] = ...,
) -> IO[Any]: ...
def ord(__c: Union[Text, bytes]) -> int: ...
class _Writer(Protocol):
@@ -980,6 +1083,12 @@ def print(
) -> None: ...
_E = TypeVar("_E", contravariant=True)
_M = TypeVar("_M", contravariant=True)
class _SupportsPow2(Protocol[_E, _T_co]):
def __pow__(self, __other: _E) -> _T_co: ...
class _SupportsPow3(Protocol[_E, _M, _T_co]):
def __pow__(self, __other: _E, __modulo: _M) -> _T_co: ...
if sys.version_info >= (3, 8):
@overload
def pow(base: int, exp: int, mod: None = ...) -> Any: ... # returns int or float depending on whether exp is non-negative
@@ -987,6 +1096,10 @@ if sys.version_info >= (3, 8):
def pow(base: int, exp: int, mod: int) -> int: ...
@overload
def pow(base: float, exp: float, mod: None = ...) -> float: ...
@overload
def pow(base: _SupportsPow2[_E, _T_co], exp: _E) -> _T_co: ...
@overload
def pow(base: _SupportsPow3[_E, _M, _T_co], exp: _E, mod: _M) -> _T_co: ...
else:
@overload
def pow(__base: int, __exp: int, __mod: None = ...) -> Any: ... # returns int or float depending on whether exp is non-negative
@@ -994,6 +1107,10 @@ else:
def pow(__base: int, __exp: int, __mod: int) -> int: ...
@overload
def pow(__base: float, __exp: float, __mod: None = ...) -> float: ...
@overload
def pow(__base: _SupportsPow2[_E, _T_co], __exp: _E) -> _T_co: ...
@overload
def pow(__base: _SupportsPow3[_E, _M, _T_co], __exp: _E, __mod: _M) -> _T_co: ...
def quit(code: object = ...) -> NoReturn: ...
@overload
def reversed(__object: Sequence[_T]) -> Iterator[_T]: ...
@@ -1027,6 +1144,16 @@ else:
@overload
def sum(__iterable: Iterable[_T], __start: _S) -> Union[_T, _S]: ...
def vars(__object: Any = ...) -> Dict[str, Any]: ...
# Some overloads to better support zipping heterogeneous tuples
@overload
def zip(*iterables: Tuple[_T1, _T2]) -> Tuple[Tuple[_T1, ...], Tuple[_T2, ...]]: ... # type: ignore
@overload
def zip(*iterables: Tuple[_T1, _T2, _T3]) -> Tuple[Tuple[_T1, ...], Tuple[_T2, ...], Tuple[_T3, ...]]: ... # type: ignore
@overload
def zip(*iterables: Tuple[_T1, _T2, _T3, _T4]) -> Tuple[Tuple[_T1, ...], Tuple[_T2, ...], Tuple[_T3, ...], Tuple[_T4, ...]]: ... # type: ignore
@overload
def zip(*iterables: Tuple[_T1, _T2, _T3, _T4, _T5]) -> Tuple[Tuple[_T1, ...], Tuple[_T2, ...], Tuple[_T3, ...], Tuple[_T4, ...], Tuple[_T5, ...]]: ... # type: ignore
@overload
def zip(__iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]: ...
@overload
@@ -1104,10 +1231,10 @@ if sys.version_info >= (3, 5):
value: Any
class SyntaxError(_StandardError):
msg: str
lineno: int
lineno: Optional[int]
offset: Optional[int]
text: Optional[str]
filename: str
filename: Optional[str]
class SystemError(_StandardError): ...
class TypeError(_StandardError): ...
class ValueError(_StandardError): ...
@@ -169,6 +169,9 @@ class UserString(Sequence[str]):
@overload
def maketrans(x: str, y: str, z: str = ...) -> Dict[int, Union[int, None]]: ...
def partition(self, sep: str) -> Tuple[str, str, str]: ...
if sys.version_info >= (3, 9):
def removeprefix(self: _UserStringT, __prefix: Union[str, UserString]) -> _UserStringT: ...
def removesuffix(self: _UserStringT, __suffix: Union[str, UserString]) -> _UserStringT: ...
def replace(self: _UserStringT, old: Union[str, UserString], new: Union[str, UserString], maxsplit: int = ...) -> _UserStringT: ...
def rfind(self, sub: Union[str, UserString], start: int = ..., end: int = ...) -> int: ...
def rindex(self, sub: Union[str, UserString], start: int = ..., end: int = ...) -> int: ...
@@ -1,3 +1,18 @@
from ._base import * # noqa: F403
from .thread import * # noqa: F403
from .process import * # noqa: F403
import sys
from ._base import (
FIRST_COMPLETED as FIRST_COMPLETED,
FIRST_EXCEPTION as FIRST_EXCEPTION,
ALL_COMPLETED as ALL_COMPLETED,
CancelledError as CancelledError,
TimeoutError as TimeoutError,
Future as Future,
Executor as Executor,
wait as wait,
as_completed as as_completed,
)
if sys.version_info >= (3, 8):
from ._base import InvalidStateError as InvalidStateError
if sys.version_info >= (3, 7):
from ._base import BrokenExecutor as BrokenExecutor
from .thread import ThreadPoolExecutor as ThreadPoolExecutor
from .process import ProcessPoolExecutor as ProcessPoolExecutor
@@ -17,6 +17,8 @@ LOGGER: Logger
class Error(Exception): ...
class CancelledError(Error): ...
class TimeoutError(Error): ...
if sys.version_info >= (3, 8):
class InvalidStateError(Error): ...
if sys.version_info >= (3, 7):
class BrokenExecutor(RuntimeError): ...
@@ -4,7 +4,10 @@ import sys
EXTRA_QUEUED_CALLS: Any
if sys.version_info >= (3,):
if sys.version_info >= (3, 7):
from ._base import BrokenExecutor
class BrokenProcessPool(BrokenExecutor): ...
elif sys.version_info >= (3,):
class BrokenProcessPool(RuntimeError): ...
if sys.version_info >= (3, 7):
@@ -11,9 +11,10 @@ class NoBoundaryInMultipartDefect(MessageDefect): ...
class StartBoundaryNotFoundDefect(MessageDefect): ...
class FirstHeaderLineIsContinuationDefect(MessageDefect): ...
class MisplacedEnvelopeHeaderDefect(MessageDefect): ...
class MalformedHeaderDefect(MessageDefect): ...
class MultipartInvariantViolationDefect(MessageDefect): ...
class InvalidBase64PaddingDefect(MessageDefect): ...
class InvalidBase64CharactersDefect(MessageDefect): ...
class CloseBoundaryNotFoundDefect(MessageDefect): ...
class MissingHeaderBodySeparatorDefect(MessageDefect): ...
MalformedHeaderDefect = MissingHeaderBodySeparatorDefect
@@ -13,5 +13,5 @@ class FeedParser:
class BytesFeedParser:
def __init__(self, _factory: Callable[[], Message] = ..., *,
policy: Policy = ...) -> None: ...
def feed(self, data: str) -> None: ...
def feed(self, data: bytes) -> None: ...
def close(self) -> Message: ...
+1 -1
View File
@@ -111,7 +111,7 @@ def ioctl(__fd: FileDescriptorLike,
def ioctl(__fd: FileDescriptorLike,
__request: int,
__arg: _ReadOnlyBuffer,
__mutate_flag: bool) -> bytes: ...
__mutate_flag: bool = ...) -> bytes: ...
def flock(__fd: FileDescriptorLike, __operation: int) -> None: ...
def lockf(__fd: FileDescriptorLike,
__cmd: int,
+17 -2
View File
@@ -1,5 +1,5 @@
import sys
from typing import Any, Callable, Generic, Dict, Iterable, Mapping, Optional, Sequence, Tuple, Type, TypeVar, NamedTuple, Union, overload
from typing import Any, Callable, Generic, Dict, Hashable, Iterable, Mapping, Optional, Sequence, Tuple, Type, TypeVar, NamedTuple, Union, overload
_AnyCallable = Callable[..., Any]
@@ -21,7 +21,7 @@ class _CacheInfo(NamedTuple):
class _lru_cache_wrapper(Generic[_T]):
__wrapped__: Callable[..., _T]
def __call__(self, *args: Any, **kwargs: Any) -> _T: ...
def __call__(self, *args: Hashable, **kwargs: Hashable) -> _T: ...
def cache_info(self) -> _CacheInfo: ...
def cache_clear(self) -> None: ...
@@ -86,6 +86,7 @@ if sys.version_info >= (3, 8):
def register(self, cls: Any, method: None = ...) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ...
@overload
def register(self, cls: Any, method: Callable[..., _T]) -> Callable[..., _T]: ...
def __call__(self, *args: Any, **kwargs: Any) -> _T: ...
class cached_property(Generic[_T]):
func: Callable[[Any], _T]
@@ -96,3 +97,17 @@ if sys.version_info >= (3, 8):
@overload
def __get__(self, instance: _S, owner: Optional[Type[Any]] = ...) -> _T: ...
def __set_name__(self, owner: Type[Any], name: str) -> None: ...
if sys.version_info >= (3, 9):
class TopologicalSorter(Generic[_T]):
def __init__(self, graph: Optional[Dict[_T, Iterable[_T]]] = ...) -> None: ...
def add(self, node: _T, *predecessors: _T) -> None: ...
def prepare(self) -> None: ...
def is_active(self) -> bool: ...
def done(self, *nodes: _T) -> None: ...
def get_ready(self) -> Tuple[_T, ...]: ...
def static_order(self) -> Iterable[_T]: ...
class CycleError(ValueError): ...
def cache(__user_function: Callable[..., _T]) -> _lru_cache_wrapper[_T]: ...
+30 -20
View File
@@ -1,21 +1,28 @@
import sys
from typing import overload, Any, Container, IO, Iterable, Optional, Type, TypeVar
from typing import overload, Any, Container, IO, Iterable, Optional, Sequence, Type, TypeVar, Union
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
if sys.version_info >= (3, 6):
from os import PathLike
_Path = Union[str, PathLike[str]]
else:
_Path = str
class NullTranslations:
def __init__(self, fp: IO[str] = ...) -> None: ...
def __init__(self, fp: Optional[IO[str]] = ...) -> None: ...
def _parse(self, fp: IO[str]) -> None: ...
def add_fallback(self, fallback: NullTranslations) -> None: ...
def gettext(self, message: str) -> str: ...
def lgettext(self, message: str) -> str: ...
def ngettext(self, singular: str, plural: str, n: int) -> str: ...
def lngettext(self, singular: str, plural: str, n: int) -> str: ...
def pgettext(self, context: str, message: str) -> str: ...
def npgettext(self, context: str, msgid1: str, msgid2: str, n: int) -> str: ...
def ngettext(self, msgid1: str, msgid2: str, n: int) -> str: ...
def lngettext(self, msgid1: str, msgid2: str, n: int) -> str: ...
if sys.version_info >= (3, 8):
def pgettext(self, context: str, message: str) -> str: ...
def npgettext(self, context: str, msgid1: str, msgid2: str, n: int) -> str: ...
def info(self) -> Any: ...
def charset(self) -> Any: ...
def output_charset(self) -> Any: ...
@@ -25,38 +32,41 @@ class NullTranslations:
class GNUTranslations(NullTranslations):
LE_MAGIC: int
BE_MAGIC: int
CONTEXT: str
VERSIONS: Sequence[int]
def find(domain: str, localedir: Optional[str] = ..., languages: Optional[Iterable[str]] = ...,
def find(domain: str, localedir: Optional[_Path] = ..., languages: Optional[Iterable[str]] = ...,
all: bool = ...) -> Any: ...
_T = TypeVar('_T')
@overload
def translation(domain: str, localedir: Optional[str] = ..., languages: Optional[Iterable[str]] = ...,
def translation(domain: str, localedir: Optional[_Path] = ..., languages: Optional[Iterable[str]] = ...,
class_: None = ..., fallback: bool = ..., codeset: Optional[str] = ...) -> NullTranslations: ...
@overload
def translation(domain: str, localedir: Optional[str] = ..., languages: Optional[Iterable[str]] = ...,
def translation(domain: str, localedir: Optional[_Path] = ..., languages: Optional[Iterable[str]] = ...,
class_: Type[_T] = ..., fallback: Literal[False] = ..., codeset: Optional[str] = ...) -> _T: ...
@overload
def translation(domain: str, localedir: Optional[str] = ..., languages: Optional[Iterable[str]] = ...,
def translation(domain: str, localedir: Optional[_Path] = ..., languages: Optional[Iterable[str]] = ...,
class_: Type[_T] = ..., fallback: Literal[True] = ..., codeset: Optional[str] = ...) -> Any: ...
def install(domain: str, localedir: Optional[str] = ..., codeset: Optional[str] = ...,
def install(domain: str, localedir: Optional[_Path] = ..., codeset: Optional[str] = ...,
names: Optional[Container[str]] = ...) -> None: ...
def textdomain(domain: Optional[str] = ...) -> str: ...
def bindtextdomain(domain: str, localedir: Optional[str] = ...) -> str: ...
def bindtextdomain(domain: str, localedir: Optional[_Path] = ...) -> str: ...
def bind_textdomain_codeset(domain: str, codeset: Optional[str] = ...) -> str: ...
def dgettext(domain: str, message: str) -> str: ...
def ldgettext(domain: str, message: str) -> str: ...
def dngettext(domain: str, singular: str, plural: str, n: int) -> str: ...
def ldngettext(domain: str, singular: str, plural: str, n: int) -> str: ...
def dngettext(domain: str, msgid1: str, msgid2: str, n: int) -> str: ...
def ldngettext(domain: str, msgid1: str, msgid2: str, n: int) -> str: ...
def gettext(message: str) -> str: ...
def lgettext(message: str) -> str: ...
def ngettext(singular: str, plural: str, n: int) -> str: ...
def lngettext(singular: str, plural: str, n: int) -> str: ...
def pgettext(context: str, message: str) -> str: ...
def dpgettext(domain: str, context: str, message: str) -> str: ...
def npgettext(context: str, msgid1: str, msgid2: str, n: int) -> str: ...
def dnpgettext(domain: str, context: str, msgid1: str, msgid2: str, n: int) -> str: ...
def ngettext(msgid1: str, msgid2: str, n: int) -> str: ...
def lngettext(msgid1: str, msgid2: str, n: int) -> str: ...
if sys.version_info >= (3, 8):
def pgettext(context: str, message: str) -> str: ...
def dpgettext(domain: str, context: str, message: str) -> str: ...
def npgettext(context: str, msgid1: str, msgid2: str, n: int) -> str: ...
def dnpgettext(domain: str, context: str, msgid1: str, msgid2: str, n: int) -> str: ...
Catalog = translation
+16 -6
View File
@@ -19,9 +19,16 @@ class _Hash(object):
def copy(self) -> _Hash: ...
def digest(self) -> bytes: ...
def hexdigest(self) -> str: ...
def update(self, arg: _DataType) -> None: ...
def update(self, __data: _DataType) -> None: ...
if sys.version_info >= (3, 8):
if sys.version_info >= (3, 9):
def md5(string: _DataType = ..., *, usedforsecurity: bool = ...) -> _Hash: ...
def sha1(string: _DataType = ..., *, usedforsecurity: bool = ...) -> _Hash: ...
def sha224(string: _DataType = ..., *, usedforsecurity: bool = ...) -> _Hash: ...
def sha256(string: _DataType = ..., *, usedforsecurity: bool = ...) -> _Hash: ...
def sha384(string: _DataType = ..., *, usedforsecurity: bool = ...) -> _Hash: ...
def sha512(string: _DataType = ..., *, usedforsecurity: bool = ...) -> _Hash: ...
elif sys.version_info >= (3, 8):
def md5(string: _DataType = ...) -> _Hash: ...
def sha1(string: _DataType = ...) -> _Hash: ...
def sha224(string: _DataType = ...) -> _Hash: ...
@@ -52,9 +59,9 @@ if sys.version_info >= (3, 6):
def __init__(self, data: _DataType = ...) -> None: ...
def copy(self) -> _VarLenHash: ...
def digest(self, length: int) -> bytes: ...
def hexdigest(self, length: int) -> str: ...
def update(self, arg: _DataType) -> None: ...
def digest(self, __length: int) -> bytes: ...
def hexdigest(self, __length: int) -> str: ...
def update(self, __data: _DataType) -> None: ...
sha3_224 = _Hash
sha3_256 = _Hash
@@ -71,7 +78,10 @@ if sys.version_info >= (3, 6):
PERSON_SIZE: int
SALT_SIZE: int
def __init__(self, data: _DataType = ..., digest_size: int = ..., key: _DataType = ..., salt: _DataType = ..., person: _DataType = ..., fanout: int = ..., depth: int = ..., leaf_size: int = ..., node_offset: int = ..., node_depth: int = ..., inner_size: int = ..., last_node: bool = ...) -> None: ...
if sys.version_info >= (3, 9):
def __init__(self, __data: _DataType = ..., *, digest_size: int = ..., key: _DataType = ..., salt: _DataType = ..., person: _DataType = ..., fanout: int = ..., depth: int = ..., leaf_size: int = ..., node_offset: int = ..., node_depth: int = ..., inner_size: int = ..., last_node: bool = ..., usedforsecurity: bool = ...) -> None: ...
else:
def __init__(self, __data: _DataType = ..., *, digest_size: int = ..., key: _DataType = ..., salt: _DataType = ..., person: _DataType = ..., fanout: int = ..., depth: int = ..., leaf_size: int = ..., node_offset: int = ..., node_depth: int = ..., inner_size: int = ..., last_node: bool = ...) -> None: ...
blake2b = _BlakeHash
blake2s = _BlakeHash
@@ -1,5 +1,9 @@
import sys
from enum import IntEnum
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
class HTTPStatus(IntEnum):
@property
@@ -67,3 +71,7 @@ class HTTPStatus(IntEnum):
MISDIRECTED_REQUEST: int
if sys.version_info >= (3, 8):
UNAVAILABLE_FOR_LEGAL_REASONS: int
if sys.version_info >= (3, 9):
EARLY_HINTS: Literal[103]
IM_A_TEAPOT: Literal[418]
TOO_EARLY: Literal[425]
@@ -27,8 +27,6 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
path: str
request_version: str
headers: email.message.Message
rfile: BinaryIO
wfile: BinaryIO
server_version: str
sys_version: str
error_message_format: str
@@ -1,10 +1,10 @@
import importlib.abc
import types
from typing import Any, Callable, List, Optional, Sequence, Tuple
from typing import Any, Callable, List, Optional, Sequence, Tuple, Union
# ModuleSpec is exported from this module, but for circular import
# reasons exists in its own stub file (with Loader and ModuleType).
from _importlib_modulespec import ModuleSpec as ModuleSpec # Exported
from _importlib_modulespec import ModuleSpec as ModuleSpec, Loader # Exported
class BuiltinImporter(importlib.abc.MetaPathFinder,
importlib.abc.InspectLoader):
@@ -81,7 +81,17 @@ class WindowsRegistryFinder(importlib.abc.MetaPathFinder):
target: Optional[types.ModuleType] = ...) -> Optional[ModuleSpec]:
...
class PathFinder(importlib.abc.MetaPathFinder): ...
class PathFinder:
@classmethod
def invalidate_caches(cls) -> None: ...
@classmethod
def find_spec(cls, fullname: str,
path: Optional[Sequence[Union[bytes, str]]] = ...,
target: Optional[types.ModuleType] = ...) -> Optional[ModuleSpec]: ...
@classmethod
def find_module(cls, fullname: str,
path: Optional[Sequence[Union[bytes, str]]] = ...) -> Optional[Loader]: ...
SOURCE_SUFFIXES: List[str]
DEBUG_BYTECODE_SUFFIXES: List[str]
+78 -84
View File
@@ -1,12 +1,16 @@
from typing import (
List, BinaryIO, TextIO, Iterator, Union, Optional, Callable, Tuple, Type, Any, IO, Iterable
List, BinaryIO, TextIO, Iterator, Union, Optional, Callable, Tuple, Type, Any, IO, Iterable, TypeVar
)
import builtins
import codecs
import sys
from mmap import mmap
from types import TracebackType
from typing import TypeVar
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
_bytearray_like = Union[bytearray, mmap]
@@ -18,6 +22,30 @@ SEEK_END: int
_T = TypeVar('_T', bound=IOBase)
_OpenTextMode = Literal[
'r', 'r+', '+r', 'rt', 'tr', 'rt+', 'r+t', '+rt', 'tr+', 't+r', '+tr',
'w', 'w+', '+w', 'wt', 'tw', 'wt+', 'w+t', '+wt', 'tw+', 't+w', '+tw',
'a', 'a+', '+a', 'at', 'ta', 'at+', 'a+t', '+at', 'ta+', 't+a', '+ta',
'x', 'x+', '+x', 'xt', 'tx', 'xt+', 'x+t', '+xt', 'tx+', 't+x', '+tx',
'U', 'rU', 'Ur', 'rtU', 'rUt', 'Urt', 'trU', 'tUr', 'Utr',
]
_OpenBinaryModeUpdating = Literal[
'rb+', 'r+b', '+rb', 'br+', 'b+r', '+br',
'wb+', 'w+b', '+wb', 'bw+', 'b+w', '+bw',
'ab+', 'a+b', '+ab', 'ba+', 'b+a', '+ba',
'xb+', 'x+b', '+xb', 'bx+', 'b+x', '+bx',
]
_OpenBinaryModeWriting = Literal[
'wb', 'bw',
'ab', 'ba',
'xb', 'bx',
]
_OpenBinaryModeReading = Literal[
'rb', 'br',
'rbU', 'rUb', 'Urb', 'brU', 'bUr', 'Ubr',
]
_OpenBinaryMode = Union[_OpenBinaryModeUpdating, _OpenBinaryModeReading, _OpenBinaryModeWriting]
open = builtins.open
if sys.version_info >= (3, 8):
@@ -44,7 +72,7 @@ class IOBase:
def truncate(self, __size: Optional[int] = ...) -> int: ...
def writable(self) -> bool: ...
def writelines(self, __lines: Iterable[Union[bytes, bytearray]]) -> None: ...
def readline(self, __size: int = ...) -> bytes: ...
def readline(self, __size: Optional[int] = ...) -> bytes: ...
def __del__(self) -> None: ...
@property
def closed(self) -> bool: ...
@@ -65,10 +93,10 @@ class BufferedIOBase(IOBase):
def read(self, __size: Optional[int] = ...) -> bytes: ...
def read1(self, __size: int = ...) -> bytes: ...
class FileIO(RawIOBase):
class FileIO(RawIOBase, BinaryIO):
mode: str
name: Union[int, str]
# Technically this is whatever is passed in as file, either a str, a bytes, or an int.
name: Union[int, str] # type: ignore
def __init__(
self,
file: Union[str, bytes, int],
@@ -76,63 +104,46 @@ class FileIO(RawIOBase):
closefd: bool = ...,
opener: Optional[Callable[[Union[int, str], str], int]] = ...
) -> None: ...
def write(self, __b: bytes) -> int: ...
def read(self, __size: int = ...) -> bytes: ...
def __enter__(self: _T) -> _T: ...
# TODO should extend from BufferedIOBase
class BytesIO(BinaryIO):
class BytesIO(BufferedIOBase, BinaryIO):
def __init__(self, initial_bytes: bytes = ...) -> None: ...
# BytesIO does not contain a "name" field. This workaround is necessary
# to allow BytesIO sub-classes to add this field, as it is defined
# as a read-only property on IO[].
name: Any
def __enter__(self: _T) -> _T: ...
def getvalue(self) -> bytes: ...
def getbuffer(self) -> memoryview: ...
# copied from IOBase
def __iter__(self) -> Iterator[bytes]: ...
def __next__(self) -> bytes: ...
def __enter__(self) -> BytesIO: ...
def __exit__(self, t: Optional[Type[BaseException]] = ..., value: Optional[BaseException] = ...,
traceback: Optional[TracebackType] = ...) -> Optional[bool]: ...
def close(self) -> None: ...
def fileno(self) -> int: ...
def flush(self) -> None: ...
def isatty(self) -> bool: ...
def readable(self) -> bool: ...
def readlines(self, __size: int = ...) -> List[bytes]: ...
def seek(self, __pos: int, __whence: int = ...) -> int: ...
def seekable(self) -> bool: ...
def tell(self) -> int: ...
def truncate(self, __size: Optional[int] = ...) -> int: ...
def writable(self) -> bool: ...
# TODO should be the next line instead
# def writelines(self, lines: List[Union[bytes, bytearray]]) -> None: ...
def writelines(self, __lines: Any) -> None: ...
def readline(self, __size: Optional[int] = ...) -> bytes: ...
def __del__(self) -> None: ...
closed: bool
# copied from BufferedIOBase
def detach(self) -> RawIOBase: ...
def readinto(self, __buffer: _bytearray_like) -> int: ...
def write(self, __b: Union[bytes, bytearray]) -> int: ...
def readinto1(self, __buffer: _bytearray_like) -> int: ...
def read(self, __size: Optional[int] = ...) -> bytes: ...
if sys.version_info >= (3, 7):
def read1(self, __size: Optional[int] = ...) -> bytes: ...
else:
def read1(self, __size: Optional[int]) -> bytes: ...
def read1(self, __size: Optional[int]) -> bytes: ... # type: ignore
class BufferedReader(BufferedIOBase):
class BufferedReader(BufferedIOBase, BinaryIO):
def __enter__(self: _T) -> _T: ...
def __init__(self, raw: RawIOBase, buffer_size: int = ...) -> None: ...
def peek(self, __size: int = ...) -> bytes: ...
if sys.version_info >= (3, 7):
def read1(self, __size: int = ...) -> bytes: ...
else:
def read1(self, __size: int) -> bytes: ... # type: ignore
class BufferedWriter(BufferedIOBase):
class BufferedWriter(BufferedIOBase, BinaryIO):
def __enter__(self: _T) -> _T: ...
def __init__(self, raw: RawIOBase, buffer_size: int = ...) -> None: ...
def flush(self) -> None: ...
def write(self, __buffer: Union[bytes, bytearray]) -> int: ...
class BufferedRandom(BufferedReader, BufferedWriter):
def __enter__(self: _T) -> _T: ...
def __init__(self, raw: RawIOBase, buffer_size: int = ...) -> None: ...
def seek(self, __target: int, __whence: int = ...) -> int: ...
def tell(self) -> int: ...
if sys.version_info >= (3, 7):
def read1(self, __size: int = ...) -> bytes: ...
else:
def read1(self, __size: int) -> bytes: ... # type: ignore
class BufferedRWPair(BufferedIOBase):
def __init__(self, reader: RawIOBase, writer: RawIOBase,
@@ -145,23 +156,16 @@ class TextIOBase(IOBase):
newlines: Union[str, Tuple[str, ...], None]
def __iter__(self) -> Iterator[str]: ... # type: ignore
def __next__(self) -> str: ... # type: ignore
def detach(self) -> IOBase: ...
def write(self, s: str) -> int: ...
def detach(self) -> BinaryIO: ...
def write(self, __s: str) -> int: ...
def writelines(self, __lines: List[str]) -> None: ... # type: ignore
def readline(self, size: int = ...) -> str: ... # type: ignore
def readline(self, __size: int = ...) -> str: ... # type: ignore
def readlines(self, __hint: int = ...) -> List[str]: ... # type: ignore
def read(self, size: Optional[int] = ...) -> str: ...
def seek(self, offset: int, whence: int = ...) -> int: ...
def read(self, __size: Optional[int] = ...) -> str: ...
def tell(self) -> int: ...
# TODO should extend from TextIOBase
class TextIOWrapper(TextIO):
class TextIOWrapper(TextIOBase, TextIO):
line_buffering: bool
# TODO uncomment after fixing mypy about using write_through
# def __init__(self, buffer: IO[bytes], encoding: str = ...,
# errors: Optional[str] = ..., newline: Optional[str] = ...,
# line_buffering: bool = ..., write_through: bool = ...) \
# -> None: ...
def __init__(
self,
buffer: IO[bytes],
@@ -171,46 +175,36 @@ class TextIOWrapper(TextIO):
line_buffering: bool = ...,
write_through: bool = ...
) -> None: ...
# copied from IOBase
def __exit__(self, t: Optional[Type[BaseException]] = ..., value: Optional[BaseException] = ...,
traceback: Optional[TracebackType] = ...) -> Optional[bool]: ...
def close(self) -> None: ...
def fileno(self) -> int: ...
def flush(self) -> None: ...
def isatty(self) -> bool: ...
def readable(self) -> bool: ...
def readlines(self, __hint: int = ...) -> List[str]: ...
def seekable(self) -> bool: ...
def truncate(self, __size: Optional[int] = ...) -> int: ...
def writable(self) -> bool: ...
# TODO should be the next line instead
# def writelines(self, lines: List[str]) -> None: ...
def writelines(self, __lines: Any) -> None: ...
def __del__(self) -> None: ...
@property
def buffer(self) -> BinaryIO: ...
if sys.version_info >= (3, 7):
def reconfigure(
self,
*,
encoding: Optional[str] = ...,
errors: Optional[str] = ...,
newline: Optional[str] = ...,
line_buffering: Optional[bool] = ...,
write_through: Optional[bool] = ...
) -> None: ...
closed: bool
# copied from TextIOBase
encoding: str
errors: Optional[str]
newlines: Union[str, Tuple[str, ...], None]
def __iter__(self) -> Iterator[str]: ...
def __next__(self) -> str: ...
def __enter__(self) -> TextIO: ...
def detach(self) -> IOBase: ...
def write(self, __text: str) -> int: ...
def readline(self, __size: int = ...) -> str: ...
def read(self, __size: Optional[int] = ...) -> str: ...
# These are inherited from TextIOBase, but must exist in the stub to satisfy mypy.
def __enter__(self: _T) -> _T: ...
def __iter__(self) -> Iterator[str]: ... # type: ignore
def __next__(self) -> str: ... # type: ignore
def writelines(self, __lines: List[str]) -> None: ... # type: ignore
def readline(self, __size: int = ...) -> str: ... # type: ignore
def readlines(self, __hint: int = ...) -> List[str]: ... # type: ignore
def seek(self, __cookie: int, __whence: int = ...) -> int: ...
def tell(self) -> int: ...
class StringIO(TextIOWrapper):
def __init__(self, initial_value: str = ...,
def __init__(self, initial_value: Optional[str] = ...,
newline: Optional[str] = ...) -> None: ...
# StringIO does not contain a "name" field. This workaround is necessary
# to allow StringIO sub-classes to add this field, as it is defined
# as a read-only property on IO[].
name: Any
def getvalue(self) -> str: ...
def __enter__(self) -> StringIO: ...
class IncrementalNewlineDecoder(codecs.IncrementalDecoder):
def __init__(self, decoder: Optional[codecs.IncrementalDecoder],
@@ -86,7 +86,7 @@ class _BaseNetwork(_IPAddressBase, Container[_A], Iterable[_A], Generic[_A]):
def max_prefixlen(self) -> int: ...
@property
def num_addresses(self) -> int: ...
def overlaps(self: _T, other: _T) -> bool: ...
def overlaps(self, other: _BaseNetwork) -> bool: ...
@property
def prefixlen(self) -> int: ...
if sys.version_info >= (3, 7):
@@ -3,10 +3,18 @@ import socket
import sys
import types
if sys.version_info >= (3, 8):
from typing import SupportsIndex
# https://docs.python.org/3/library/multiprocessing.html#address-formats
_Address = Union[str, Tuple[str, int]]
class _ConnectionBase:
if sys.version_info >= (3, 8):
def __init__(self, handle: SupportsIndex, readable: bool = ..., writable: bool = ...) -> None: ...
else:
def __init__(self, handle: int, readable: bool = ..., writable: bool = ...) -> None: ...
@property
def closed(self) -> bool: ... # undocumented
@property
@@ -73,13 +73,14 @@ if sys.platform != 'win32':
SCHED_RR: int # some flavors of Unix
SCHED_RESET_ON_FORK: int # some flavors of Unix
RTLD_LAZY: int
RTLD_NOW: int
RTLD_GLOBAL: int
RTLD_LOCAL: int
RTLD_NODELETE: int
RTLD_NOLOAD: int
RTLD_DEEPBIND: int
if sys.platform != "win32":
RTLD_LAZY: int
RTLD_NOW: int
RTLD_GLOBAL: int
RTLD_LOCAL: int
RTLD_NODELETE: int
RTLD_NOLOAD: int
RTLD_DEEPBIND: int
SEEK_SET: int
SEEK_CUR: int
@@ -151,7 +152,8 @@ class _Environ(MutableMapping[AnyStr, AnyStr], Generic[AnyStr]):
def __len__(self) -> int: ...
environ: _Environ[str]
environb: _Environ[bytes]
if sys.platform != "win32":
environb: _Environ[bytes]
if sys.platform != 'win32':
confstr_names: Dict[str, int]
@@ -214,6 +216,8 @@ class stat_result:
st_ctime_ns: int # platform dependent (time of most recent metadata change on Unix, or the time of creation on Windows) in nanoseconds
if sys.version_info >= (3, 8) and sys.platform == "win32":
st_reparse_tag: int
if sys.version_info >= (3, 5) and sys.platform == "win32":
st_file_attributes: int
def __getitem__(self, i: int) -> int: ...
@@ -365,12 +369,15 @@ if sys.platform != 'win32':
def getenv(key: Text) -> Optional[str]: ...
@overload
def getenv(key: Text, default: _T) -> Union[str, _T]: ...
@overload
def getenvb(key: bytes) -> Optional[bytes]: ...
@overload
def getenvb(key: bytes, default: _T = ...) -> Union[bytes, _T]: ...
if sys.platform != "win32":
@overload
def getenvb(key: bytes) -> Optional[bytes]: ...
@overload
def getenvb(key: bytes, default: _T = ...) -> Union[bytes, _T]: ...
def putenv(__name: Union[bytes, Text], __value: Union[bytes, Text]) -> None: ...
def unsetenv(__name: Union[bytes, Text]) -> None: ...
if sys.platform != "win32":
def unsetenv(__name: Union[bytes, Text]) -> None: ...
# Return IO or TextIO
def fdopen(fd: int, mode: str = ..., buffering: int = ..., encoding: Optional[str] = ...,
@@ -441,7 +448,9 @@ def access(
follow_symlinks: bool = ...,
) -> bool: ...
def chdir(path: _FdOrPathType) -> None: ...
def fchdir(fd: int) -> None: ...
if sys.platform != "win32":
def fchdir(fd: int) -> None: ...
def getcwd() -> str: ...
def getcwdb() -> bytes: ...
def chmod(path: _FdOrPathType, mode: int, *, dir_fd: Optional[int] = ..., follow_symlinks: bool = ...) -> None: ...
@@ -468,11 +477,11 @@ def mkdir(path: _PathType, mode: int = ..., *, dir_fd: Optional[int] = ...) -> N
if sys.platform != 'win32':
def mkfifo(path: _PathType, mode: int = ..., *, dir_fd: Optional[int] = ...) -> None: ... # Unix only
def makedirs(name: _PathType, mode: int = ..., exist_ok: bool = ...) -> None: ...
def mknod(path: _PathType, mode: int = ..., device: int = ..., *, dir_fd: Optional[int] = ...) -> None: ...
def major(__device: int) -> int: ...
def minor(__device: int) -> int: ...
def makedev(__major: int, __minor: int) -> int: ...
if sys.platform != 'win32':
if sys.platform != "win32":
def mknod(path: _PathType, mode: int = ..., device: int = ..., *, dir_fd: Optional[int] = ...) -> None: ...
def major(__device: int) -> int: ...
def minor(__device: int) -> int: ...
def makedev(__major: int, __minor: int) -> int: ...
def pathconf(path: _FdOrPathType, name: Union[str, int]) -> int: ... # Unix only
if sys.version_info >= (3, 6):
def readlink(path: Union[AnyStr, PathLike[AnyStr]], *, dir_fd: Optional[int] = ...) -> AnyStr: ...
@@ -607,9 +616,14 @@ def popen(cmd: str, mode: str = ..., buffering: int = ...) -> _wrap_close: ...
def spawnl(mode: int, file: _PathType, arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> int: ...
def spawnle(mode: int, file: _PathType, arg0: Union[bytes, Text],
*args: Any) -> int: ... # Imprecise sig
def spawnv(mode: int, file: _PathType, args: List[Union[bytes, Text]]) -> int: ...
def spawnve(mode: int, file: _PathType, args: List[Union[bytes, Text]],
env: _ExecEnv) -> int: ...
if sys.platform != "win32":
def spawnv(mode: int, file: _PathType, args: List[Union[bytes, Text]]) -> int: ...
def spawnve(mode: int, file: _PathType, args: List[Union[bytes, Text]],
env: _ExecEnv) -> int: ...
else:
def spawnv(__mode: int, __path: _PathType, __argv: List[Union[bytes, Text]]) -> int: ...
def spawnve(__mode: int, __path: _PathType, __argv: List[Union[bytes, Text]],
__env: _ExecEnv) -> int: ...
def system(command: _PathType) -> int: ...
def times() -> times_result: ...
def waitpid(__pid: int, __options: int) -> Tuple[int, int]: ...
@@ -660,7 +674,7 @@ if sys.version_info >= (3, 6):
def getrandom(size: int, flags: int = ...) -> bytes: ...
def urandom(__size: int) -> bytes: ...
if sys.version_info >= (3, 7):
if sys.version_info >= (3, 7) and sys.platform != "win32":
def register_at_fork(
*,
before: Optional[Callable[..., Any]] = ...,
+3 -6
View File
@@ -5,6 +5,7 @@
import os
import sys
from typing import overload, List, Any, AnyStr, Sequence, Tuple, TypeVar, Union, Text, Callable, Optional
from genericpath import exists as exists
_T = TypeVar('_T')
@@ -100,10 +101,6 @@ elif sys.version_info >= (3, 5):
# So, fall back to Any
def commonprefix(m: Sequence[_PathType]) -> Any: ...
if sys.version_info >= (3, 3):
def exists(path: Union[_PathType, int]) -> bool: ...
else:
def exists(path: _PathType) -> bool: ...
def lexists(path: _PathType) -> bool: ...
# These return float if os.stat_float_times() == True,
@@ -170,8 +167,8 @@ else:
def splitdrive(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
def splitext(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
if sys.platform == 'win32':
def splitunc(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated
if sys.version_info < (3, 7) and sys.platform == 'win32':
def splitunc(p: AnyStr) -> Tuple[AnyStr, AnyStr]: ... # deprecated
if sys.version_info < (3,):
def walk(path: AnyStr, visit: Callable[[_T, AnyStr, List[AnyStr]], Any], arg: _T) -> None: ...
+19 -4
View File
@@ -1,4 +1,6 @@
from typing import Any, Generator, IO, Optional, Sequence, Tuple, Type, TypeVar, Union, List
from io import _OpenBinaryMode, _OpenTextMode
from typing import (Any, BinaryIO, Generator, IO, List, Optional, Sequence,
TextIO, Tuple, Type, TypeVar, Union, overload)
from types import TracebackType
import os
import sys
@@ -43,12 +45,16 @@ class PurePath(_PurePathBase):
def as_uri(self) -> str: ...
def is_absolute(self) -> bool: ...
def is_reserved(self) -> bool: ...
if sys.version_info >= (3, 9):
def is_relative_to(self, *other: Union[str, os.PathLike[str]]) -> bool: ...
def match(self, path_pattern: str) -> bool: ...
if sys.version_info < (3, 6):
def relative_to(self: _P, *other: Union[str, PurePath]) -> _P: ...
else:
def relative_to(self: _P, *other: Union[str, os.PathLike[str]]) -> _P: ...
def with_name(self: _P, name: str) -> _P: ...
if sys.version_info >= (3, 9):
def with_stem(self: _P, stem: str) -> _P: ...
def with_suffix(self: _P, suffix: str) -> _P: ...
if sys.version_info < (3, 6):
def joinpath(self: _P, *other: Union[str, PurePath]) -> _P: ...
@@ -93,15 +99,24 @@ class Path(PurePath):
else:
def mkdir(self, mode: int = ..., parents: bool = ...,
exist_ok: bool = ...) -> None: ...
def open(self, mode: str = ..., buffering: int = ...,
encoding: Optional[str] = ..., errors: Optional[str] = ...,
@overload
def open(self, mode: _OpenTextMode = ..., buffering: int = ..., encoding: Optional[str] = ..., errors: Optional[str] = ...,
newline: Optional[str] = ...) -> TextIO: ...
@overload
def open(self, mode: _OpenBinaryMode, buffering: int = ..., encoding: None = ..., errors: None = ...,
newline: None = ...) -> BinaryIO: ...
@overload
def open(self, mode: str, buffering: int = ..., encoding: Optional[str] = ..., errors: Optional[str] = ...,
newline: Optional[str] = ...) -> IO[Any]: ...
def owner(self) -> str: ...
if sys.version_info >= (3, 9):
def readlink(self: _P) -> _P: ...
if sys.version_info >= (3, 8):
def rename(self: _P, target: Union[str, PurePath]) -> _P: ...
def replace(self: _P, target: Union[str, PurePath]) -> _P: ...
else:
def rename(self, target: Union[str, PurePath]) -> None: ...
def replace(self, target: Union[str, PurePath]) -> None: ...
def replace(self, target: Union[str, PurePath]) -> None: ...
if sys.version_info < (3, 6):
def resolve(self: _P) -> _P: ...
else:
+2 -2
View File
@@ -3,7 +3,7 @@
# NOTE: These are incomplete!
from threading import Condition, Lock
from typing import Any, Deque, TypeVar, Generic, Optional
from typing import Any, TypeVar, Generic, Optional
import sys
_T = TypeVar('_T')
@@ -19,8 +19,8 @@ class Queue(Generic[_T]):
not_full: Condition # undocumented
all_tasks_done: Condition # undocumented
unfinished_tasks: int # undocumented
queue: Any # undocumented
queue: Deque[Any] # undocumented
def __init__(self, maxsize: int = ...) -> None: ...
def _init(self, maxsize: int) -> None: ...
def empty(self) -> bool: ...
+15 -12
View File
@@ -1,8 +1,9 @@
# Stubs for selector
# See https://docs.python.org/3/library/selectors.html
import sys
from abc import ABCMeta, abstractmethod
from typing import Any, List, Mapping, NamedTuple, Optional, Protocol, Tuple, Union
from typing import Any, List, Mapping, NamedTuple, Optional, Tuple
from _types import FileDescriptor, FileDescriptorLike
_EventMask = int
@@ -45,18 +46,20 @@ class SelectSelector(BaseSelector):
def select(self, timeout: Optional[float] = ...) -> List[Tuple[SelectorKey, _EventMask]]: ...
def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ...
class PollSelector(BaseSelector):
def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ...
def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ...
def select(self, timeout: Optional[float] = ...) -> List[Tuple[SelectorKey, _EventMask]]: ...
def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ...
if sys.platform != "win32":
class EpollSelector(BaseSelector):
def fileno(self) -> int: ...
def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ...
def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ...
def select(self, timeout: Optional[float] = ...) -> List[Tuple[SelectorKey, _EventMask]]: ...
def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ...
class PollSelector(BaseSelector):
def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ...
def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ...
def select(self, timeout: Optional[float] = ...) -> List[Tuple[SelectorKey, _EventMask]]: ...
def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ...
class EpollSelector(BaseSelector):
def fileno(self) -> int: ...
def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ...
def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ...
def select(self, timeout: Optional[float] = ...) -> List[Tuple[SelectorKey, _EventMask]]: ...
def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ...
class DevpollSelector(BaseSelector):
def fileno(self) -> int: ...
+133 -101
View File
@@ -5,53 +5,66 @@ from enum import IntEnum
from typing import Any, Callable, Tuple, Union, Optional, Iterable, Set
from types import FrameType
class ItimerError(IOError): ...
if sys.platform != "win32":
class ItimerError(IOError): ...
ITIMER_PROF: int
ITIMER_REAL: int
ITIMER_VIRTUAL: int
ITIMER_PROF: int
ITIMER_REAL: int
ITIMER_VIRTUAL: int
NSIG: int
class Signals(IntEnum):
SIGABRT: int
SIGALRM: int
SIGBREAK: int # Windows
SIGBUS: int
SIGCHLD: int
SIGCLD: int
SIGCONT: int
if sys.platform != "win32":
SIGALRM: int
if sys.platform == "win32":
SIGBREAK: int
if sys.platform != "win32":
SIGBUS: int
SIGCHLD: int
if sys.platform != "darwin" and sys.platform != "win32":
SIGCLD: int
if sys.platform != "win32":
SIGCONT: int
SIGEMT: int
SIGFPE: int
SIGHUP: int
if sys.platform != "win32":
SIGHUP: int
SIGILL: int
SIGINFO: int
SIGINT: int
SIGIO: int
SIGIOT: int
SIGKILL: int
SIGPIPE: int
SIGPOLL: int
SIGPROF: int
SIGPWR: int
SIGQUIT: int
SIGRTMAX: int
SIGRTMIN: int
if sys.platform != "win32":
SIGIO: int
SIGIOT: int
SIGKILL: int
SIGPIPE: int
if sys.platform != "darwin" and sys.platform != "win32":
SIGPOLL: int
SIGPWR: int
if sys.platform != "win32":
SIGPROF: int
SIGQUIT: int
if sys.platform != "darwin" and sys.platform != "win32":
SIGRTMAX: int
SIGRTMIN: int
SIGSEGV: int
SIGSTOP: int
SIGSYS: int
if sys.platform != "win32":
SIGSTOP: int
SIGSYS: int
SIGTERM: int
SIGTRAP: int
SIGTSTP: int
SIGTTIN: int
SIGTTOU: int
SIGURG: int
SIGUSR1: int
SIGUSR2: int
SIGVTALRM: int
SIGWINCH: int
SIGXCPU: int
SIGXFSZ: int
if sys.platform != "win32":
SIGTRAP: int
SIGTSTP: int
SIGTTIN: int
SIGTTOU: int
SIGURG: int
SIGUSR1: int
SIGUSR2: int
SIGVTALRM: int
SIGWINCH: int
SIGXCPU: int
SIGXFSZ: int
class Handlers(IntEnum):
SIG_DFL: int
@@ -60,94 +73,113 @@ class Handlers(IntEnum):
SIG_DFL = Handlers.SIG_DFL
SIG_IGN = Handlers.SIG_IGN
class Sigmasks(IntEnum):
SIG_BLOCK: int
SIG_UNBLOCK: int
SIG_SETMASK: int
if sys.platform != "win32":
class Sigmasks(IntEnum):
SIG_BLOCK: int
SIG_UNBLOCK: int
SIG_SETMASK: int
SIG_BLOCK = Sigmasks.SIG_BLOCK
SIG_UNBLOCK = Sigmasks.SIG_UNBLOCK
SIG_SETMASK = Sigmasks.SIG_SETMASK
SIG_BLOCK = Sigmasks.SIG_BLOCK
SIG_UNBLOCK = Sigmasks.SIG_UNBLOCK
SIG_SETMASK = Sigmasks.SIG_SETMASK
_SIGNUM = Union[int, Signals]
_HANDLER = Union[Callable[[Signals, FrameType], None], int, Handlers, None]
SIGABRT: Signals
SIGALRM: Signals
SIGBREAK: Signals # Windows
SIGBUS: Signals
SIGCHLD: Signals
SIGCLD: Signals
SIGCONT: Signals
if sys.platform != "win32":
SIGALRM: Signals
if sys.platform == "win32":
SIGBREAK: Signals
if sys.platform != "win32":
SIGBUS: Signals
SIGCHLD: Signals
if sys.platform != "darwin" and sys.platform != "win32":
SIGCLD: Signals
if sys.platform != "win32":
SIGCONT: Signals
SIGEMT: Signals
SIGFPE: Signals
SIGHUP: Signals
if sys.platform != "win32":
SIGHUP: Signals
SIGILL: Signals
SIGINFO: Signals
SIGINT: Signals
SIGIO: Signals
SIGIOT: Signals
SIGKILL: Signals
SIGPIPE: Signals
SIGPOLL: Signals
SIGPROF: Signals
SIGPWR: Signals
SIGQUIT: Signals
SIGRTMAX: Signals
SIGRTMIN: Signals
if sys.platform != "win32":
SIGIO: Signals
SIGIOT: Signals
SIGKILL: Signals
SIGPIPE: Signals
if sys.platform != "darwin" and sys.platform != "win32":
SIGPOLL: Signals
SIGPWR: Signals
if sys.platform != "win32":
SIGPROF: Signals
SIGQUIT: Signals
if sys.platform != "darwin" and sys.platform != "win32":
SIGRTMAX: Signals
SIGRTMIN: Signals
SIGSEGV: Signals
SIGSTOP: Signals
SIGSYS: Signals
if sys.platform != "win32":
SIGSTOP: Signals
SIGSYS: Signals
SIGTERM: Signals
SIGTRAP: Signals
SIGTSTP: Signals
SIGTTIN: Signals
SIGTTOU: Signals
SIGURG: Signals
SIGUSR1: Signals
SIGUSR2: Signals
SIGVTALRM: Signals
SIGWINCH: Signals
SIGXCPU: Signals
SIGXFSZ: Signals
if sys.platform != "win32":
SIGTRAP: Signals
SIGTSTP: Signals
SIGTTIN: Signals
SIGTTOU: Signals
SIGURG: Signals
SIGUSR1: Signals
SIGUSR2: Signals
SIGVTALRM: Signals
SIGWINCH: Signals
SIGXCPU: Signals
SIGXFSZ: Signals
# Windows
CTRL_C_EVENT: int
CTRL_BREAK_EVENT: int
if sys.platform == "win32":
CTRL_C_EVENT: int
CTRL_BREAK_EVENT: int
class struct_siginfo(Tuple[int, int, int, int, int, int, int]):
def __init__(self, sequence: Iterable[int]) -> None: ...
@property
def si_signo(self) -> int: ...
@property
def si_code(self) -> int: ...
@property
def si_errno(self) -> int: ...
@property
def si_pid(self) -> int: ...
@property
def si_uid(self) -> int: ...
@property
def si_status(self) -> int: ...
@property
def si_band(self) -> int: ...
if sys.platform != "win32":
class struct_siginfo(Tuple[int, int, int, int, int, int, int]):
def __init__(self, sequence: Iterable[int]) -> None: ...
@property
def si_signo(self) -> int: ...
@property
def si_code(self) -> int: ...
@property
def si_errno(self) -> int: ...
@property
def si_pid(self) -> int: ...
@property
def si_uid(self) -> int: ...
@property
def si_status(self) -> int: ...
@property
def si_band(self) -> int: ...
def alarm(__seconds: int) -> int: ...
if sys.platform != "win32":
def alarm(__seconds: int) -> int: ...
def default_int_handler(signum: int, frame: FrameType) -> None: ...
def getitimer(__which: int) -> Tuple[float, float]: ...
if sys.platform != "win32":
def getitimer(__which: int) -> Tuple[float, float]: ...
def getsignal(__signalnum: _SIGNUM) -> _HANDLER: ...
if sys.version_info >= (3, 8):
def strsignal(__signalnum: _SIGNUM) -> Optional[str]: ...
def valid_signals() -> Set[Signals]: ...
def raise_signal(__signalnum: _SIGNUM) -> None: ...
def pause() -> None: ...
def pthread_kill(__thread_id: int, __signalnum: int) -> None: ...
def pthread_sigmask(__how: int, __mask: Iterable[int]) -> Set[_SIGNUM]: ...
if sys.platform != "win32":
def pause() -> None: ...
def pthread_kill(__thread_id: int, __signalnum: int) -> None: ...
def pthread_sigmask(__how: int, __mask: Iterable[int]) -> Set[_SIGNUM]: ...
def set_wakeup_fd(fd: int) -> int: ...
def setitimer(__which: int, __seconds: float, __interval: float = ...) -> Tuple[float, float]: ...
def siginterrupt(__signalnum: int, __flag: bool) -> None: ...
if sys.platform != "win32":
def setitimer(__which: int, __seconds: float, __interval: float = ...) -> Tuple[float, float]: ...
def siginterrupt(__signalnum: int, __flag: bool) -> None: ...
def signal(__signalnum: _SIGNUM, __handler: _HANDLER) -> _HANDLER: ...
def sigpending() -> Any: ...
def sigtimedwait(sigset: Iterable[int], timeout: float) -> Optional[struct_siginfo]: ...
def sigwait(__sigset: Iterable[int]) -> _SIGNUM: ...
def sigwaitinfo(sigset: Iterable[int]) -> struct_siginfo: ...
if sys.platform != "win32":
def sigpending() -> Any: ...
def sigtimedwait(sigset: Iterable[int], timeout: float) -> Optional[struct_siginfo]: ...
def sigwait(__sigset: Iterable[int]) -> _SIGNUM: ...
def sigwaitinfo(sigset: Iterable[int]) -> struct_siginfo: ...
@@ -1,7 +1,7 @@
# NB: SocketServer.pyi and socketserver.pyi must remain consistent!
# Stubs for socketserver
from typing import Any, BinaryIO, Callable, List, Optional, Tuple, Type, Text, Union
from typing import Any, BinaryIO, Callable, ClassVar, List, Optional, Tuple, Type, Text, Union
from socket import SocketType
import sys
import types
@@ -63,23 +63,24 @@ if sys.platform != 'win32':
RequestHandlerClass: Callable[..., BaseRequestHandler],
bind_and_activate: bool = ...) -> None: ...
class ForkingMixIn:
timeout: Optional[float] # undocumented
active_children: Optional[List[int]] # undocumented
max_children: int # undocumented
if sys.version_info >= (3, 7):
block_on_close: bool
if sys.version_info >= (3, 6):
def collect_children(self, *, blocking: bool = ...) -> None: ... # undocumented
else:
def collect_children(self) -> None: ... # undocumented
def handle_timeout(self) -> None: ... # undocumented
if sys.version_info >= (3, 3):
def service_actions(self) -> None: ... # undocumented
def process_request(self, request: bytes,
client_address: Tuple[str, int]) -> None: ...
if sys.version_info >= (3, 6):
def server_close(self) -> None: ...
if sys.platform != "win32":
class ForkingMixIn:
timeout: Optional[float] # undocumented
active_children: Optional[List[int]] # undocumented
max_children: int # undocumented
if sys.version_info >= (3, 7):
block_on_close: bool
if sys.version_info >= (3, 6):
def collect_children(self, *, blocking: bool = ...) -> None: ... # undocumented
else:
def collect_children(self) -> None: ... # undocumented
def handle_timeout(self) -> None: ... # undocumented
if sys.version_info >= (3, 3):
def service_actions(self) -> None: ... # undocumented
def process_request(self, request: bytes,
client_address: Tuple[str, int]) -> None: ...
if sys.version_info >= (3, 6):
def server_close(self) -> None: ...
class ThreadingMixIn:
daemon_threads: bool
@@ -92,8 +93,9 @@ class ThreadingMixIn:
if sys.version_info >= (3, 6):
def server_close(self) -> None: ...
class ForkingTCPServer(ForkingMixIn, TCPServer): ...
class ForkingUDPServer(ForkingMixIn, UDPServer): ...
if sys.platform != "win32":
class ForkingTCPServer(ForkingMixIn, TCPServer): ...
class ForkingUDPServer(ForkingMixIn, UDPServer): ...
class ThreadingTCPServer(ThreadingMixIn, TCPServer): ...
class ThreadingUDPServer(ThreadingMixIn, UDPServer): ...
if sys.platform != 'win32':
@@ -118,9 +120,16 @@ class BaseRequestHandler:
def finish(self) -> None: ...
class StreamRequestHandler(BaseRequestHandler):
rbufsize: ClassVar[int] # Undocumented
wbufsize: ClassVar[int] # Undocumented
timeout: ClassVar[Optional[float]] # Undocumented
disable_nagle_algorithm: ClassVar[bool] # Undocumented
connection: SocketType # Undocumented
rfile: BinaryIO
wfile: BinaryIO
class DatagramRequestHandler(BaseRequestHandler):
packet: SocketType # Undocumented
socket: SocketType # Undocumented
rfile: BinaryIO
wfile: BinaryIO
@@ -3,12 +3,20 @@
from decimal import Decimal
from fractions import Fraction
import sys
from typing import Any, Iterable, List, Optional, SupportsFloat, Type, TypeVar, Union
from typing import Any, Iterable, List, Optional, SupportsFloat, Type, TypeVar, Union, Protocol, Hashable
_T = TypeVar("_T")
# Most functions in this module accept homogeneous collections of one of these types
_Number = TypeVar('_Number', float, Decimal, Fraction)
# Used in median_high, median_low
class _Sortable(Protocol):
def __lt__(self, other) -> bool: ...
_SortableT = TypeVar("_SortableT", bound=_Sortable)
# Used in mode, multimode
_HashableT = TypeVar("_HashableT", bound=Hashable)
class StatisticsError(ValueError): ...
if sys.version_info >= (3, 8):
@@ -18,12 +26,12 @@ def mean(data: Iterable[_Number]) -> _Number: ...
if sys.version_info >= (3, 6):
def harmonic_mean(data: Iterable[_Number]) -> _Number: ...
def median(data: Iterable[_Number]) -> _Number: ...
def median_low(data: Iterable[_Number]) -> _Number: ...
def median_high(data: Iterable[_Number]) -> _Number: ...
def median_low(data: Iterable[_SortableT]) -> _SortableT: ...
def median_high(data: Iterable[_SortableT]) -> _SortableT: ...
def median_grouped(data: Iterable[_Number], interval: _Number = ...) -> _Number: ...
def mode(data: Iterable[_Number]) -> _Number: ...
def mode(data: Iterable[_HashableT]) -> _HashableT: ...
if sys.version_info >= (3, 8):
def multimode(data: Iterable[_T]) -> List[_T]: ...
def multimode(data: Iterable[_HashableT]) -> List[_HashableT]: ...
def pstdev(data: Iterable[_Number], mu: Optional[_Number] = ...) -> _Number: ...
def pvariance(data: Iterable[_Number], mu: Optional[_Number] = ...) -> _Number: ...
if sys.version_info >= (3, 8):
@@ -52,6 +60,8 @@ if sys.version_info >= (3, 8):
def inv_cdf(self, p: float) -> float: ...
def overlap(self, other: NormalDist) -> float: ...
def quantiles(self, n: int = ...) -> List[float]: ...
if sys.version_info >= (3, 9):
def zscore(self, x: float) -> float: ...
def __add__(self, x2: Union[float, NormalDist]) -> NormalDist: ...
def __sub__(self, x2: Union[float, NormalDist]) -> NormalDist: ...
def __mul__(self, x2: float) -> NormalDist: ...
@@ -448,6 +448,7 @@ def call(args: _CMD,
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Any = ...,
*,
timeout: Optional[float] = ...) -> int: ...
# Same args as Popen.__init__
@@ -751,9 +752,9 @@ else:
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Any = ...,
timeout: Optional[float] = ...,
input: _TXT = ...,
*,
timeout: Optional[float] = ...,
universal_newlines: Literal[True],
) -> str: ...
@overload
@@ -773,8 +774,9 @@ else:
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Any = ...,
timeout: Optional[float] = ...,
input: _TXT = ...,
*,
timeout: Optional[float] = ...,
) -> bytes: ...
@overload
def check_output(args: _CMD,
@@ -793,8 +795,9 @@ else:
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Any = ...,
timeout: Optional[float] = ...,
input: _TXT = ...,
*,
timeout: Optional[float] = ...,
) -> Any: ... # morally: -> _TXT
@@ -837,6 +840,7 @@ class Popen(Generic[AnyStr]):
stderr: Optional[IO[AnyStr]]
pid: int
returncode: int
universal_newlines: bool
# Technically it is wrong that Popen provides __new__ instead of __init__
# but this shouldn't come up hopefully?
@@ -1155,7 +1159,7 @@ class Popen(Generic[AnyStr]):
start_new_session: bool = ...,
pass_fds: Any = ...) -> Popen[Any]: ...
def poll(self) -> int: ...
def poll(self) -> Optional[int]: ...
if sys.version_info >= (3, 7):
def wait(self, timeout: Optional[float] = ...) -> int: ...
else:
@@ -1166,7 +1170,7 @@ class Popen(Generic[AnyStr]):
timeout: Optional[float] = ...,
# morally this should be optional
) -> Tuple[AnyStr, AnyStr]: ...
def send_signal(self, signal: int) -> None: ...
def send_signal(self, sig: int) -> None: ...
def terminate(self) -> None: ...
def kill(self) -> None: ...
def __enter__(self: _S) -> _S: ...

Some files were not shown because too many files have changed in this diff Show More