1 Commits

Author SHA1 Message Date
Dave Halter 3319cadf85 Make builtins work
One change is a Jedi issue, Jedi cannot really deal with __new__.
The other is a typeshed issue. "function" should not be defined in the stubs.
2019-05-19 13:12:18 +02:00
501 changed files with 10400 additions and 12468 deletions
+3 -1
View File
@@ -5,7 +5,7 @@
# 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)
# 457 F811 redefinition
# 390 E305 expected 2 blank lines
# 4 E741 ambiguous variable name
@@ -18,6 +18,8 @@
[flake8]
ignore = F401, F403, F405, F811, E301, E302, E305, E501, E701, E704, E741, B303, W504
# We are checking with Python 3 but many of the stubs are Python 2 stubs.
# A nice future improvement would be to provide separate .flake8
# configurations for Python 2 and Python 3 files.
builtins = StandardError,apply,basestring,buffer,cmp,coerce,execfile,file,intern,long,raw_input,reduce,reload,unichr,unicode,xrange
exclude = .venv*,@*,.git
max-line-length = 130
+22 -23
View File
@@ -1,31 +1,30 @@
dist: bionic
dist: xenial
language: python
python: 3.8
python: 3.7
jobs:
matrix:
include:
- name: "pytype"
python: 3.6
install: pip install -r requirements-tests-py3.txt
script: ./tests/pytype_test.py
- name: "mypy (typed-ast)"
python: 3.7
install: pip install -U git+git://github.com/python/mypy git+git://github.com/python/typed_ast
script: ./tests/mypy_test.py --platform=linux
- name: "mypy (ast)"
python: 3.8
install: pip install -U git+git://github.com/python/mypy
script: ./tests/mypy_test.py --platform=linux
- name: "mypy (Windows)"
install: pip install -U git+git://github.com/python/mypy
script: ./tests/mypy_test.py --platform=win32
- name: "mypy (Darwin)"
install: pip install -U git+git://github.com/python/mypy
script: ./tests/mypy_test.py --platform=darwin
env:
- TEST_CMD="./tests/pytype_test.py"
- INSTALL="test"
- name: "mypy"
env:
- TEST_CMD="./tests/mypy_test.py"
- INSTALL="mypy"
- name: "mypy self test"
script: ./tests/mypy_selftest.py
env: TEST_CMD="./tests/mypy_selftest.py"
- name: "check file consistency"
script: ./tests/check_consistent.py
env: TEST_CMD="./tests/check_consistent.py"
- name: "flake8"
install: pip install -r requirements-tests-py3.txt
script: flake8
env:
- TEST_CMD="flake8"
- INSTALL="test"
install:
- if [[ $INSTALL == 'test' ]]; then pip install -r requirements-tests-py3.txt; fi
- if [[ $INSTALL == 'mypy' ]]; then pip install -U git+git://github.com/python/mypy git+git://github.com/python/typed_ast; fi
script:
- $TEST_CMD
+30 -23
View File
@@ -11,11 +11,13 @@ are important to the project's success.
1. Read the [README.md file](README.md).
2. Set up your environment to be able to [run all tests](README.md#running-the-tests). They should pass.
3. [Prepare your changes](#preparing-changes):
* Small fixes and additions can be submitted directly as pull requests,
but [contact us](#discussion) before starting significant work.
* [Contact us](#discussion) before starting significant work.
* IMPORTANT: For new libraries, [get permission from the library owner first](#adding-a-new-library).
* Create your stubs [conforming to the coding style](#stub-file-coding-style).
* Make sure your tests pass cleanly on `mypy`, `pytype`, and `flake8`.
4. [Submit your changes](#submitting-changes) by opening a pull request.
4. [Submit your changes](#submitting-changes):
* Open a pull request
* For new libraries, [include a reference to where you got permission](#adding-a-new-library)
5. You can expect a reply within a few days:
* Diffs are merged when considered ready by the core team.
* Feel free to ping the core team if your pull request goes without
@@ -101,6 +103,21 @@ recommend starting by opening an issue laying out what you want to do.
That lets a conversation happen early in case other contributors disagree
with what you'd like to do or have ideas that will help you do it.
### Adding a new library
If you want to submit type stubs for a new library, you need to
**contact the maintainers of the original library** first to let them
know and **get their permission**. Do it by opening an issue on their
project's bug tracker. This gives them the opportunity to
consider adopting type hints directly in their codebase (which you
should prefer to external type stubs). When the project owners agree
for you to submit stubs here or you do not receive a reply within
one month, open a pull request **referencing the
issue where you asked for permission**.
Make sure your changes pass the tests (the [README](README.md#running-the-tests)
has more information).
### What to include
Stubs should include the complete interface (classes, functions,
@@ -220,7 +237,7 @@ rule is that they should be as concise as possible. Specifically:
* use variable annotations instead of type comments, even for stubs
that target older versions of Python;
* for arguments with a type and a default, use spaces around the `=`.
The code formatter [black](https://github.com/psf/black) will format
The code formatter [black](https://github.com/python/black) will format
stubs according to this standard.
Stub files should only contain information necessary for the type
@@ -274,15 +291,6 @@ Type variables and aliases you introduce purely for legibility reasons
should be prefixed with an underscore to make it obvious to the reader
they are not part of the stubbed API.
When adding type annotations for context manager classes, annotate
the return type of `__exit__` as bool only if the context manager
sometimes suppresses annotations -- if it sometimes returns `True`
at runtime. If the context manager never suppresses exceptions,
have the return type be either `None` or `Optional[bool]`. If you
are not sure whether exceptions are suppressed or not or if the
context manager is meant to be subclassed, pick `Optional[bool]`.
See https://github.com/python/mypy/issues/7214 for more details.
NOTE: there are stubs in this repository that don't conform to the
style described above. Fixing them is a great starting point for new
contributors.
@@ -298,8 +306,8 @@ and optionally the lowest minor version, with the exception of the `2and3`
directory which applies to both Python 2 and 3.
For example, stubs in the `3` directory will be applied to all versions of
Python 3, though stubs in the `3.7` directory will only be applied to versions
3.7 and above. However, stubs in the `2` directory will not be applied to
Python 3, though stubs in the `3.6` directory will only be applied to versions
3.6 and above. However, stubs in the `2` directory will not be applied to
Python 3.
It is preferred to use a single stub in the more generic directory that
@@ -309,7 +317,7 @@ if the given library works on both Python 2 and Python 3, prefer to put your
stubs in the `2and3` directory, unless the types are so different that the stubs
become unreadable that way.
You can use checks like `if sys.version_info >= (3, 8):` to denote new
You can use checks like `if sys.version_info >= (3, 4):` to denote new
functionality introduced in a given Python version or solve type
differences. When doing so, only use one-tuples or two-tuples. This is
because:
@@ -322,17 +330,17 @@ because:
regardless of the micro version used.
Because of this, if a given functionality was introduced in, say, Python
3.7.4, your check:
3.4.4, your check:
* should be expressed as `if sys.version_info >= (3, 7):`
* should NOT be expressed as `if sys.version_info >= (3, 7, 4):`
* should NOT be expressed as `if sys.version_info >= (3, 8):`
* should be expressed as `if sys.version_info >= (3, 4):`
* should NOT be expressed as `if sys.version_info >= (3, 4, 4):`
* should NOT be expressed as `if sys.version_info >= (3, 5):`
This makes the type checker assume the functionality was also available
in 3.7.0 - 3.7.3, which while *technically* incorrect is relatively
in 3.4.0 - 3.4.3, which while *technically* incorrect is relatively
harmless. This is a strictly better compromise than using the latter
two forms, which would generate false positive errors for correct use
under Python 3.7.4.
under Python 3.4.4.
Note: in its current implementation, typeshed cannot contain stubs for
multiple versions of the same third-party library. Prefer to generate
@@ -372,4 +380,3 @@ Core developers should follow these rules when processing pull requests:
* Delete branches for merged PRs (by core devs pushing to the main repo).
* 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.
+6 -12
View File
@@ -2,22 +2,19 @@
[![Build Status](https://travis-ci.org/python/typeshed.svg?branch=master)](https://travis-ci.org/python/typeshed)
[![Chat at https://gitter.im/python/typing](https://badges.gitter.im/python/typing.svg)](https://gitter.im/python/typing?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Pull Requests Welcome](https://img.shields.io/badge/pull%20requests-welcome-brightgreen.svg)](https://github.com/python/typeshed/blob/master/CONTRIBUTING.md)
## About
Typeshed contains external type annotations for the Python standard library
and Python builtins, as well as third party packages as contributed by
people external to those projects.
and Python builtins, as well as third party packages.
This data can e.g. be used for static analysis, type checking or type inference.
For information on how to use `typeshed`, read below. Information for
contributors can be found in [CONTRIBUTING.md](CONTRIBUTING.md). **Please read
it before submitting pull requests; do not report issues with annotations to
the project the stubs are for, but instead report them here to typeshed.**
it before submitting pull requests.**
Typeshed supports Python versions 2.7 and 3.5 and up.
Typeshed supports Python versions 2.7 and 3.4 and up.
## Using
@@ -47,13 +44,10 @@ pytype repo.
## Format
Each Python module is represented by a `.pyi` "stub file". This is a
syntactically valid Python file, although it usually cannot be run by
Python 3 (since forward references don't require string quotes). All
the methods are empty.
Each Python module is represented by a `.pyi` "stub". This is a normal Python
file (i.e., it can be interpreted by Python 3), except all the methods are empty.
Python function annotations ([PEP 3107](https://www.python.org/dev/peps/pep-3107/))
are used to describe the signature of each function or method.
are used to describe the types the function has.
See [PEP 484](http://www.python.org/dev/peps/pep-0484/) for the exact
syntax of the stub files and [CONTRIBUTING.md](CONTRIBUTING.md) for the
-11
View File
@@ -1,11 +0,0 @@
[tool.black]
line_length = 130
target_version = ["py37"]
[tool.isort]
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
combine_as_imports = true
line_length = 130
+4 -6
View File
@@ -1,8 +1,6 @@
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
isort==4.3.21
pytype>=2019.10.17
flake8==3.6.0
flake8-bugbear==18.8.0
flake8-pyi==18.3.1
pytype>=2019.5.15
+3 -3
View File
@@ -1,6 +1,6 @@
# Stubs for BaseHTTPServer (Python 2.7)
from typing import Any, BinaryIO, Callable, Mapping, Optional, Tuple, Union
from typing import Any, BinaryIO, Mapping, Optional, Tuple, Union
import SocketServer
import mimetools
@@ -8,9 +8,9 @@ class HTTPServer(SocketServer.TCPServer):
server_name: str
server_port: int
def __init__(self, server_address: Tuple[str, int],
RequestHandlerClass: Callable[..., BaseHTTPRequestHandler]) -> None: ...
RequestHandlerClass: type) -> None: ...
class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
class BaseHTTPRequestHandler:
client_address: Tuple[str, int]
server: SocketServer.BaseServer
close_connection: bool
-8
View File
@@ -1,8 +0,0 @@
# Stubs for CGIHTTPServer (Python 2.7)
from typing import List
import SimpleHTTPServer
class CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
cgi_directories: List[str]
def do_POST(self) -> None: ...
+5 -7
View File
@@ -55,8 +55,8 @@ class _Readable(Protocol):
class RawConfigParser:
_dict: Any
_sections: Dict[Any, Any]
_defaults: Dict[Any, Any]
_sections: dict
_defaults: dict
_optcre: Any
SECTCRE: Any
OPTCRE: Any
@@ -86,14 +86,12 @@ class RawConfigParser:
class ConfigParser(RawConfigParser):
_KEYCRE: Any
def get(self, section: str, option: str, raw: bool = ..., vars: Optional[Dict[Any, Any]] = ...) -> Any: ...
def items(self, section: str, raw: bool = ..., vars: Optional[Dict[Any, Any]] = ...) -> List[Tuple[str, Any]]: ...
def get(self, section: str, option: str, raw: bool = ..., vars: Optional[dict] = ...) -> Any: ...
def items(self, section: str, raw: bool = ..., vars: Optional[dict] = ...) -> List[Tuple[str, Any]]: ...
def _interpolate(self, section: str, option: str, rawval: Any, vars: Any) -> str: ...
def _interpolation_replace(self, match: Any) -> str: ...
class SafeConfigParser(ConfigParser):
_interpvar_re: Any
def _interpolate(self, section: str, option: str, rawval: Any, vars: Any) -> str: ...
def _interpolate_some(
self, option: str, accum: List[Any], rest: str, section: str, map: Dict[Any, Any], depth: int,
) -> None: ...
def _interpolate_some(self, option: str, accum: list, rest: str, section: str, map: dict, depth: int) -> None: ...
+3 -3
View File
@@ -1,8 +1,8 @@
from typing import Any, Dict, Optional
from typing import Any, Optional
class CookieError(Exception): ...
class Morsel(Dict[Any, Any]):
class Morsel(dict):
key: Any
def __init__(self): ...
def __setitem__(self, K, V): ...
@@ -14,7 +14,7 @@ class Morsel(Dict[Any, Any]):
def js_output(self, attrs: Optional[Any] = ...): ...
def OutputString(self, attrs: Optional[Any] = ...): ...
class BaseCookie(Dict[Any, Any]):
class BaseCookie(dict):
def value_decode(self, val): ...
def value_encode(self, val): ...
def __init__(self, input: Optional[Any] = ...): ...
+4 -4
View File
@@ -1,7 +1,7 @@
# Stubs for Queue (Python 2)
from collections import deque
from typing import Any, Deque, TypeVar, Generic, Optional
from typing import Any, TypeVar, Generic, Optional
_T = TypeVar('_T')
@@ -15,7 +15,7 @@ class Queue(Generic[_T]):
not_full: Any
all_tasks_done: Any
unfinished_tasks: Any
queue: Deque[Any] # undocumented
queue: deque # undocumented
def __init__(self, maxsize: int = ...) -> None: ...
def task_done(self) -> None: ...
def join(self) -> None: ...
@@ -27,5 +27,5 @@ class Queue(Generic[_T]):
def get(self, block: bool = ..., timeout: Optional[float] = ...) -> _T: ...
def get_nowait(self) -> _T: ...
class PriorityQueue(Queue[_T]): ...
class LifoQueue(Queue[_T]): ...
class PriorityQueue(Queue): ...
class LifoQueue(Queue): ...
+1 -1
View File
@@ -9,7 +9,7 @@ class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_GET(self) -> None: ...
def do_HEAD(self) -> None: ...
def send_head(self) -> Optional[IO[str]]: ...
def list_directory(self, path: Union[str, unicode]) -> Optional[StringIO[Any]]: ...
def list_directory(self, path: Union[str, unicode]) -> Optional[StringIO]: ...
def translate_path(self, path: AnyStr) -> AnyStr: ...
def copyfile(self, source: IO[AnyStr], outputfile: IO[AnyStr]): ...
def guess_type(self, path: Union[str, unicode]) -> str: ...
+11 -11
View File
@@ -1,22 +1,22 @@
# NB: SocketServer.pyi and socketserver.pyi must remain consistent!
# Stubs for socketserver
from typing import Any, BinaryIO, Callable, Optional, Tuple, Type, Text, Union
from typing import Any, BinaryIO, Optional, Tuple, Type
from socket import SocketType
import sys
import types
class BaseServer:
address_family: int
RequestHandlerClass: Callable[..., BaseRequestHandler]
RequestHandlerClass: type
server_address: Tuple[str, int]
socket: SocketType
allow_reuse_address: bool
request_queue_size: int
socket_type: int
timeout: Optional[float]
def __init__(self, server_address: Any,
RequestHandlerClass: Callable[..., BaseRequestHandler]) -> None: ...
def __init__(self, server_address: Tuple[str, int],
RequestHandlerClass: type) -> None: ...
def fileno(self) -> int: ...
def handle_request(self) -> None: ...
def serve_forever(self, poll_interval: float = ...) -> None: ...
@@ -38,29 +38,29 @@ class BaseServer:
def __enter__(self) -> BaseServer: ...
def __exit__(self, exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[types.TracebackType]) -> None: ...
exc_tb: Optional[types.TracebackType]) -> bool: ...
if sys.version_info >= (3, 3):
def service_actions(self) -> None: ...
class TCPServer(BaseServer):
def __init__(self, server_address: Tuple[str, int],
RequestHandlerClass: Callable[..., BaseRequestHandler],
RequestHandlerClass: type,
bind_and_activate: bool = ...) -> None: ...
class UDPServer(BaseServer):
def __init__(self, server_address: Tuple[str, int],
RequestHandlerClass: Callable[..., BaseRequestHandler],
RequestHandlerClass: type,
bind_and_activate: bool = ...) -> None: ...
if sys.platform != 'win32':
class UnixStreamServer(BaseServer):
def __init__(self, server_address: Union[Text, bytes],
RequestHandlerClass: Callable[..., BaseRequestHandler],
def __init__(self, server_address: Tuple[str, int],
RequestHandlerClass: type,
bind_and_activate: bool = ...) -> None: ...
class UnixDatagramServer(BaseServer):
def __init__(self, server_address: Union[Text, bytes],
RequestHandlerClass: Callable[..., BaseRequestHandler],
def __init__(self, server_address: Tuple[str, int],
RequestHandlerClass: type,
bind_and_activate: bool = ...) -> None: ...
class ForkingMixIn: ...
+1 -1
View File
@@ -6,7 +6,7 @@ _VT = TypeVar('_VT')
_T = TypeVar('_T')
class UserDict(Dict[_KT, _VT], Generic[_KT, _VT]):
data: Dict[_KT, _VT]
data: Mapping[_KT, _VT]
def __init__(self, initialdata: Mapping[_KT, _VT] = ...) -> None: ...
+3 -4
View File
@@ -1,10 +1,9 @@
from typing import Iterable, MutableSequence, TypeVar, Union, overload, List
from typing import Iterable, MutableSequence, TypeVar, Union, overload
_T = TypeVar("_T")
_S = TypeVar("_S")
_ULT = TypeVar("_ULT", bound=UserList)
class UserList(MutableSequence[_T]):
data: List[_T]
def insert(self, index: int, object: _T) -> None: ...
@overload
def __setitem__(self, i: int, o: _T) -> None: ...
@@ -15,5 +14,5 @@ class UserList(MutableSequence[_T]):
@overload
def __getitem__(self, i: int) -> _T: ...
@overload
def __getitem__(self: _S, s: slice) -> _S: ...
def __getitem__(self: _ULT, s: slice) -> _ULT: ...
def sort(self) -> None: ...
+1 -1
View File
@@ -62,7 +62,7 @@ class UserString(Sequence[UserString]):
def upper(self: _UST) -> _UST: ...
def zfill(self: _UST, width: int) -> _UST: ...
class MutableString(UserString, MutableSequence[MutableString]):
class MutableString(UserString, MutableSequence[MutableString]): # type: ignore
@overload
def __getitem__(self: _MST, i: int) -> _MST: ...
@overload
+58 -86
View File
@@ -17,11 +17,6 @@ import sys
if sys.version_info >= (3,):
from typing import SupportsBytes, SupportsRound
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
_T = TypeVar('_T')
_T_co = TypeVar('_T_co', covariant=True)
_KT = TypeVar('_KT')
@@ -34,9 +29,6 @@ _T4 = TypeVar('_T4')
_T5 = TypeVar('_T5')
_TT = TypeVar('_TT', bound='type')
class _SupportsIndex(Protocol):
def __index__(self) -> int: ...
class object:
__doc__: Optional[str]
__dict__: Dict[str, Any]
@@ -61,30 +53,30 @@ class object:
def __getattribute__(self, name: str) -> Any: ...
def __delattr__(self, name: str) -> None: ...
def __sizeof__(self) -> int: ...
def __reduce__(self) -> Union[str, Tuple[Any, ...]]: ...
def __reduce_ex__(self, protocol: int) -> Union[str, Tuple[Any, ...]]: ...
def __reduce__(self) -> tuple: ...
def __reduce_ex__(self, protocol: int) -> tuple: ...
if sys.version_info >= (3,):
def __dir__(self) -> Iterable[str]: ...
if sys.version_info >= (3, 6):
def __init_subclass__(cls) -> None: ...
class staticmethod(object): # Special, only valid as a decorator.
__func__: Callable[..., Any]
__func__: Callable
if sys.version_info >= (3,):
__isabstractmethod__: bool
def __init__(self, f: Callable[..., Any]) -> None: ...
def __init__(self, f: Callable) -> None: ...
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
class classmethod(object): # Special, only valid as a decorator.
__func__: Callable[..., Any]
__func__: Callable
if sys.version_info >= (3,):
__isabstractmethod__: bool
def __init__(self, f: Callable[..., Any]) -> None: ...
def __init__(self, f: Callable) -> None: ...
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
class type(object):
__base__: type
@@ -137,12 +129,10 @@ class super(object):
class int:
@overload
def __init__(self, x: Union[Text, bytes, SupportsInt, _SupportsIndex] = ...) -> None: ...
def __init__(self, x: Union[Text, bytes, SupportsInt] = ...) -> None: ...
@overload
def __init__(self, x: Union[Text, bytes, bytearray], base: int) -> None: ...
if sys.version_info >= (3, 8):
def as_integer_ratio(self) -> Tuple[int, Literal[1]]: ...
@property
def real(self) -> int: ...
@property
@@ -178,7 +168,7 @@ class int:
def __rtruediv__(self, x: int) -> float: ...
def __rmod__(self, x: int) -> int: ...
def __rdivmod__(self, x: int) -> Tuple[int, int]: ...
def __pow__(self, __x: int, __modulo: Optional[int] = ...) -> Any: ... # Return type can be int or float, depending on x.
def __pow__(self, x: int) -> Any: ... # Return type can be int or float, depending on x.
def __rpow__(self, x: int) -> Any: ...
def __and__(self, n: int) -> int: ...
def __or__(self, n: int) -> int: ...
@@ -193,10 +183,7 @@ class int:
def __neg__(self) -> int: ...
def __pos__(self) -> int: ...
def __invert__(self) -> int: ...
def __trunc__(self) -> int: ...
if sys.version_info >= (3,):
def __ceil__(self) -> int: ...
def __floor__(self) -> int: ...
def __round__(self, ndigits: Optional[int] = ...) -> int: ...
def __getnewargs__(self) -> Tuple[int]: ...
@@ -219,7 +206,7 @@ class int:
def __index__(self) -> int: ...
class float:
def __init__(self, x: Union[SupportsFloat, _SupportsIndex, Text, bytes, bytearray] = ...) -> None: ...
def __init__(self, x: Union[SupportsFloat, Text, bytes, bytearray] = ...) -> None: ...
def as_integer_ratio(self) -> Tuple[int, int]: ...
def hex(self) -> str: ...
def is_integer(self) -> bool: ...
@@ -253,10 +240,11 @@ class float:
def __rdivmod__(self, x: float) -> Tuple[float, float]: ...
def __rpow__(self, x: float) -> float: ...
def __getnewargs__(self) -> Tuple[float]: ...
def __trunc__(self) -> int: ...
if sys.version_info >= (3,):
@overload
def __round__(self, ndigits: None = ...) -> int: ...
def __round__(self) -> int: ...
@overload
def __round__(self, ndigits: None) -> int: ...
@overload
def __round__(self, ndigits: int) -> float: ...
@@ -281,9 +269,11 @@ class float:
class complex:
@overload
def __init__(self, real: float = ..., imag: float = ...) -> None: ...
def __init__(self, re: float = ..., im: float = ...) -> None: ...
@overload
def __init__(self, real: Union[str, SupportsComplex, _SupportsIndex]) -> None: ...
def __init__(self, s: str) -> None: ...
@overload
def __init__(self, s: SupportsComplex) -> None: ...
@property
def real(self) -> float: ...
@@ -342,7 +332,7 @@ else:
end: int = ...) -> bool: ...
def expandtabs(self, tabsize: int = ...) -> unicode: ...
def find(self, sub: unicode, start: int = ..., end: int = ...) -> int: ...
def format(self, *args: object, **kwargs: object) -> unicode: ...
def format(self, *args: Any, **kwargs: Any) -> unicode: ...
def index(self, sub: unicode, start: int = ..., end: int = ...) -> int: ...
def isalnum(self) -> bool: ...
def isalpha(self) -> bool: ...
@@ -431,7 +421,7 @@ class str(Sequence[str], _str_base):
def endswith(self, suffix: Union[Text, Tuple[Text, ...]]) -> bool: ...
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(self, *args: Any, **kwargs: Any) -> str: ...
if sys.version_info >= (3,):
def format_map(self, map: Mapping[str, Any]) -> str: ...
def index(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
@@ -677,8 +667,6 @@ class bytearray(MutableSequence[int], ByteString):
def decode(self, encoding: Text = ..., errors: Text = ...) -> str: ...
def endswith(self, suffix: Union[bytes, Tuple[bytes, ...]]) -> bool: ...
def expandtabs(self, tabsize: int = ...) -> bytearray: ...
if sys.version_info < (3,):
def extend(self, iterable: Union[str, Iterable[int]]) -> None: ...
if sys.version_info >= (3,):
def find(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ...
if sys.version_info >= (3, 5):
@@ -746,7 +734,7 @@ class bytearray(MutableSequence[int], ByteString):
def __repr__(self) -> str: ...
def __int__(self) -> int: ...
def __float__(self) -> float: ...
__hash__: None # type: ignore
def __hash__(self) -> int: ...
@overload
def __getitem__(self, i: int) -> int: ...
@overload
@@ -796,10 +784,9 @@ class memoryview(Sized, Container[_mv_container_type]):
c_contiguous: bool
f_contiguous: bool
contiguous: bool
nbytes: int
def __init__(self, obj: Union[bytes, bytearray, memoryview]) -> None: ...
def __enter__(self) -> memoryview: ...
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> None: ...
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> bool: ...
else:
def __init__(self, obj: Union[bytes, bytearray, buffer, memoryview]) -> None: ...
@@ -812,19 +799,16 @@ class memoryview(Sized, Container[_mv_container_type]):
def __iter__(self) -> Iterator[_mv_container_type]: ...
def __len__(self) -> int: ...
@overload
def __setitem__(self, s: slice, o: memoryview) -> None: ...
@overload
def __setitem__(self, i: int, o: bytes) -> None: ...
@overload
def __setitem__(self, s: slice, o: Sequence[bytes]) -> None: ...
@overload
def __setitem__(self, s: slice, o: memoryview) -> None: ...
def tobytes(self) -> bytes: ...
def tolist(self) -> List[int]: ...
if sys.version_info >= (3, 2):
def release(self) -> None: ...
if sys.version_info >= (3, 5):
def hex(self) -> str: ...
@@ -857,14 +841,13 @@ class bool(int):
def __getnewargs__(self) -> Tuple[int]: ...
class slice(object):
start: Any
step: Any
stop: Any
start: Optional[int]
step: Optional[int]
stop: Optional[int]
@overload
def __init__(self, stop: Any) -> None: ...
def __init__(self, stop: Optional[int]) -> None: ...
@overload
def __init__(self, start: Any, stop: Any, step: Any = ...) -> None: ...
__hash__: None # type: ignore
def __init__(self, start: Optional[int], stop: Optional[int], step: Optional[int] = ...) -> None: ...
def indices(self, len: int) -> Tuple[int, int, int]: ...
class tuple(Sequence[_T_co], Generic[_T_co]):
@@ -881,10 +864,7 @@ class tuple(Sequence[_T_co], Generic[_T_co]):
def __le__(self, x: Tuple[_T_co, ...]) -> bool: ...
def __gt__(self, x: Tuple[_T_co, ...]) -> bool: ...
def __ge__(self, x: Tuple[_T_co, ...]) -> bool: ...
@overload
def __add__(self, x: Tuple[_T_co, ...]) -> Tuple[_T_co, ...]: ...
@overload
def __add__(self, x: Tuple[Any, ...]) -> Tuple[Any, ...]: ...
def __mul__(self, n: int) -> Tuple[_T_co, ...]: ...
def __rmul__(self, n: int) -> Tuple[_T_co, ...]: ...
def count(self, x: Any) -> int: ...
@@ -917,7 +897,7 @@ class list(MutableSequence[_T], Generic[_T]):
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_T]: ...
def __str__(self) -> str: ...
__hash__: None # type: ignore
def __hash__(self) -> int: ...
@overload
def __getitem__(self, i: int) -> _T: ...
@overload
@@ -990,10 +970,7 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def __setitem__(self, k: _KT, v: _VT) -> None: ...
def __delitem__(self, v: _KT) -> None: ...
def __iter__(self) -> Iterator[_KT]: ...
if sys.version_info >= (3, 8):
def __reversed__(self) -> Iterator[_KT]: ...
def __str__(self) -> str: ...
__hash__: None # type: ignore
class set(MutableSet[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
@@ -1030,7 +1007,6 @@ class set(MutableSet[_T], Generic[_T]):
def __lt__(self, s: AbstractSet[object]) -> bool: ...
def __ge__(self, s: AbstractSet[object]) -> bool: ...
def __gt__(self, s: AbstractSet[object]) -> bool: ...
__hash__: None # type: ignore
class frozenset(AbstractSet[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
@@ -1122,6 +1098,8 @@ if sys.version_info < (3,):
if sys.version_info >= (3,):
def ascii(__o: object) -> str: ...
class _SupportsIndex(Protocol):
def __index__(self) -> int: ...
def bin(__number: Union[int, _SupportsIndex]) -> str: ...
if sys.version_info >= (3, 7):
@@ -1138,7 +1116,7 @@ if sys.version_info >= (3, 6):
# See https://github.com/python/typeshed/pull/991#issuecomment-288160993
class _PathLike(Generic[AnyStr]):
def __fspath__(self) -> AnyStr: ...
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes, _PathLike[Any]], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes, _PathLike], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
elif sys.version_info >= (3,):
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
else:
@@ -1163,15 +1141,20 @@ if sys.version_info >= (3,):
def filter(__function: Callable[[_T], Any], __iterable: Iterable[_T]) -> Iterator[_T]: ...
else:
@overload
def filter(__function: Callable[[AnyStr], Any], __iterable: AnyStr) -> AnyStr: ... # type: ignore
def filter(__function: Callable[[AnyStr], Any], # type: ignore
__iterable: AnyStr) -> AnyStr: ...
@overload
def filter(__function: None, __iterable: Tuple[Optional[_T], ...]) -> Tuple[_T, ...]: ... # type: ignore
def filter(__function: None, # type: ignore
__iterable: Tuple[Optional[_T], ...]) -> Tuple[_T, ...]: ...
@overload
def filter(__function: Callable[[_T], Any], __iterable: Tuple[_T, ...]) -> Tuple[_T, ...]: ... # type: ignore
def filter(__function: Callable[[_T], Any], # type: ignore
__iterable: Tuple[_T, ...]) -> Tuple[_T, ...]: ...
@overload
def filter(__function: None, __iterable: Iterable[Optional[_T]]) -> List[_T]: ...
def filter(__function: None,
__iterable: Iterable[Optional[_T]]) -> List[_T]: ...
@overload
def filter(__function: Callable[[_T], Any], __iterable: Iterable[_T]) -> List[_T]: ...
def filter(__function: Callable[[_T], Any],
__iterable: Iterable[_T]) -> List[_T]: ...
def format(__o: object, __format_spec: str = ...) -> str: ... # TODO unicode
def getattr(__o: Any, name: Text, __default: Any = ...) -> Any: ...
def globals() -> Dict[str, Any]: ...
@@ -1189,11 +1172,9 @@ else:
@overload
def iter(__iterable: Iterable[_T]) -> Iterator[_T]: ...
@overload
def iter(__function: Callable[[], Optional[_T]], __sentinel: None) -> Iterator[_T]: ...
@overload
def iter(__function: Callable[[], _T], __sentinel: Any) -> Iterator[_T]: ...
def isinstance(__o: object, __t: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
def issubclass(__cls: type, __classinfo: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
def iter(__function: Callable[[], _T], __sentinel: _T) -> Iterator[_T]: ...
def isinstance(__o: object, __t: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ...
def issubclass(__cls: type, __classinfo: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ...
def len(__o: Sized) -> int: ...
if sys.version_info >= (3,):
def license() -> None: ...
@@ -1329,7 +1310,7 @@ def next(__i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...
def oct(__i: 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] = ...,
def open(file: Union[str, bytes, int, _PathLike], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ...,
errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ...,
opener: Optional[Callable[[str, int], int]] = ...) -> IO[Any]: ...
elif sys.version_info >= (3,):
@@ -1343,16 +1324,12 @@ def ord(__c: Union[Text, bytes]) -> int: ...
if sys.version_info >= (3,):
class _Writer(Protocol):
def write(self, __s: str) -> Any: ...
def print(
*values: object, sep: Optional[Text] = ..., end: Optional[Text] = ..., file: Optional[_Writer] = ..., flush: bool = ...
) -> None: ...
def print(*values: object, sep: Text = ..., end: Text = ..., file: Optional[_Writer] = ..., flush: bool = ...) -> None: ...
else:
class _Writer(Protocol):
def write(self, __s: Any) -> Any: ...
# This is only available after from __future__ import print_function.
def print(*values: object, sep: Optional[Text] = ..., end: Optional[Text] = ..., file: Optional[_Writer] = ...) -> None: ...
def print(*values: object, sep: Text = ..., end: Text = ..., file: Optional[_Writer] = ...) -> None: ...
@overload
def pow(__x: int, __y: int) -> Any: ... # The return type can be int or float, depending on y
@overload
@@ -1385,7 +1362,7 @@ if sys.version_info >= (3,):
@overload
def round(number: SupportsRound[_T]) -> int: ...
@overload
def round(number: SupportsRound[_T], ndigits: None) -> int: ...
def round(number: SupportsRound[_T], ndigits: None) -> int: ... # type: ignore
@overload
def round(number: SupportsRound[_T], ndigits: int) -> _T: ...
else:
@@ -1405,7 +1382,7 @@ if sys.version_info >= (3,):
else:
def sorted(__iterable: Iterable[_T], *,
cmp: Callable[[_T, _T], int] = ...,
key: Optional[Callable[[_T], Any]] = ...,
key: Callable[[_T], Any] = ...,
reverse: bool = ...) -> List[_T]: ...
@overload
def sum(__iterable: Iterable[_T]) -> Union[_T, int]: ...
@@ -1451,10 +1428,8 @@ else:
def zip(__iter1: Iterable[Any], __iter2: Iterable[Any], __iter3: Iterable[Any],
__iter4: Iterable[Any], __iter5: Iterable[Any], __iter6: Iterable[Any],
*iterables: Iterable[Any]) -> List[Tuple[Any, ...]]: ...
def __import__(name: Text, globals: Optional[Mapping[str, Any]] = ...,
locals: Optional[Mapping[str, Any]] = ...,
fromlist: Sequence[str] = ...,
level: int = ...) -> Any: ...
def __import__(name: Text, globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ...,
fromlist: List[str] = ..., level: int = ...) -> Any: ...
# Actually the type of Ellipsis is <type 'ellipsis'>, but since it's
# not exposed anywhere under that name, we make it private here.
@@ -1484,8 +1459,6 @@ class BaseException(object):
__suppress_context__: bool
__traceback__: Optional[TracebackType]
def __init__(self, *args: object) -> None: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
if sys.version_info < (3,):
def __getitem__(self, i: int) -> Any: ...
def __getslice__(self, start: int, stop: int) -> Tuple[Any, ...]: ...
@@ -1527,10 +1500,9 @@ class AttributeError(_StandardError): ...
class BufferError(_StandardError): ...
class EOFError(_StandardError): ...
class ImportError(_StandardError):
if sys.version_info >= (3, 3):
def __init__(self, *args, name: Optional[str] = ..., path: Optional[str] = ...) -> None: ...
name: Optional[str]
path: Optional[str]
if sys.version_info >= (3,):
name: str
path: str
class LookupError(_StandardError): ...
class MemoryError(_StandardError): ...
class NameError(_StandardError): ...
@@ -1543,7 +1515,7 @@ class SyntaxError(_StandardError):
msg: str
lineno: int
offset: Optional[int]
text: Optional[str]
text: str
filename: str
class SystemError(_StandardError): ...
class TypeError(_StandardError): ...
@@ -1632,7 +1604,7 @@ if sys.version_info < (3,):
def next(self) -> str: ...
def read(self, n: int = ...) -> str: ...
def __enter__(self) -> BinaryIO: ...
def __exit__(self, t: Optional[type] = ..., exc: Optional[BaseException] = ..., tb: Optional[Any] = ...) -> Optional[bool]: ...
def __exit__(self, t: Optional[type] = ..., exc: Optional[BaseException] = ..., tb: Optional[Any] = ...) -> bool: ...
def flush(self) -> None: ...
def fileno(self) -> int: ...
def isatty(self) -> bool: ...
+17 -14
View File
@@ -1,19 +1,18 @@
"""Stub file for the '_collections' module."""
from typing import Any, Callable, Dict, Generic, Iterator, TypeVar, Optional, Union
from typing import Any, Generic, Iterator, TypeVar, Optional, Union
class defaultdict(dict):
default_factory: None
def __init__(self, default: Any = ..., init: Any = ...) -> None: ...
def __missing__(self, key) -> Any:
raise KeyError()
def __copy__(self) -> defaultdict: ...
def copy(self) -> defaultdict: ...
_K = TypeVar("_K")
_V = TypeVar("_V")
_T = TypeVar('_T')
_T2 = TypeVar('_T2')
class defaultdict(Dict[_K, _V]):
default_factory: None
def __init__(self, __default_factory: Callable[[], _V] = ..., init: Any = ...) -> None: ...
def __missing__(self, key: _K) -> _V: ...
def __copy__(self: _T) -> _T: ...
def copy(self: _T) -> _T: ...
class deque(Generic[_T]):
maxlen: Optional[int]
def __init__(self, iterable: Iterator[_T] = ..., maxlen: int = ...) -> None: ...
@@ -23,14 +22,18 @@ class deque(Generic[_T]):
def count(self, x: Any) -> int: ...
def extend(self, iterable: Iterator[_T]) -> None: ...
def extendleft(self, iterable: Iterator[_T]) -> None: ...
def pop(self) -> _T: ...
def popleft(self) -> _T: ...
def remove(self, value: _T) -> None: ...
def pop(self) -> _T:
raise IndexError()
def popleft(self) -> _T:
raise IndexError()
def remove(self, value: _T) -> None:
raise IndexError()
def reverse(self) -> None: ...
def rotate(self, n: int = ...) -> None: ...
def __contains__(self, o: Any) -> bool: ...
def __copy__(self) -> deque[_T]: ...
def __getitem__(self, i: int) -> _T: ...
def __getitem__(self, i: int) -> _T:
raise IndexError()
def __iadd__(self, other: deque[_T2]) -> deque[Union[_T, _T2]]: ...
def __iter__(self) -> Iterator[_T]: ...
def __len__(self) -> int: ...
+73 -6
View File
@@ -3,6 +3,10 @@
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Tuple, overload
_T = TypeVar("_T")
_T2 = TypeVar("_T2")
_T3 = TypeVar("_T3")
_T4 = TypeVar("_T4")
_T5 = TypeVar("_T5")
_S = TypeVar("_S")
@overload
@@ -12,9 +16,72 @@ def reduce(function: Callable[[_T, _T], _T],
def reduce(function: Callable[[_T, _S], _T],
sequence: Iterable[_S], initial: _T) -> _T: ...
class partial(object):
func: Callable[..., Any]
args: Tuple[Any, ...]
keywords: Dict[str, Any]
def __init__(self, func: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ...
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
@overload
def partial(__func: Callable[[_T], _S], __arg: _T) -> Callable[[], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2], _S], __arg: _T) -> Callable[[_T2], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2, _T3], _S], __arg: _T) -> Callable[[_T2, _T3], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], __arg: _T) -> Callable[[_T2, _T3, _T4], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], __arg: _T) -> Callable[[_T2, _T3, _T4, _T5], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2], _S],
__arg1: _T,
__arg2: _T2) -> Callable[[], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2, _T3], _S],
__arg1: _T,
__arg2: _T2) -> Callable[[_T3], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2, _T3, _T4], _S],
__arg1: _T,
__arg2: _T2) -> Callable[[_T3, _T4], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S],
__arg1: _T,
__arg2: _T2) -> Callable[[_T3, _T4, _T5], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2, _T3], _S],
__arg1: _T,
__arg2: _T2,
__arg3: _T3) -> Callable[[], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2, _T3, _T4], _S],
__arg1: _T,
__arg2: _T2,
__arg3: _T3) -> Callable[[_T4], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S],
__arg1: _T,
__arg2: _T2,
__arg3: _T3) -> Callable[[_T4, _T5], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2, _T3, _T4], _S],
__arg1: _T,
__arg2: _T2,
__arg3: _T3,
__arg4: _T4) -> Callable[[], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S],
__arg1: _T,
__arg2: _T2,
__arg3: _T3,
__arg4: _T4) -> Callable[[_T5], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S],
__arg1: _T,
__arg2: _T2,
__arg3: _T3,
__arg4: _T4,
__arg5: _T5) -> Callable[[], _S]: ...
@overload
def partial(__func: Callable[..., _S],
*args: Any,
**kwargs: Any) -> Callable[..., _S]: ...
+16 -6
View File
@@ -6,19 +6,29 @@
from typing import Any, List, Tuple, Dict, Generic
def coverage(a: str) -> Any: ...
def logreader(a: str) -> LogReaderType: ...
def profiler(a: str, *args, **kwargs) -> Any: ...
def resolution() -> Tuple[Any, ...]: ...
def logreader(a: str) -> LogReaderType:
raise IOError()
raise RuntimeError()
def profiler(a: str, *args, **kwargs) -> Any:
raise IOError()
def resolution() -> tuple: ...
class LogReaderType(object):
def close(self) -> None: ...
def fileno(self) -> int: ...
def fileno(self) -> int:
raise ValueError()
class ProfilerType(object):
def addinfo(self, a: str, b: str) -> None: ...
def close(self) -> None: ...
def fileno(self) -> int: ...
def fileno(self) -> int:
raise ValueError()
def runcall(self, *args, **kwargs) -> Any: ...
def runcode(self, a, b, *args, **kwargs) -> Any: ...
def runcode(self, a, b, *args, **kwargs) -> Any:
raise TypeError()
def start(self) -> None: ...
def stop(self) -> None: ...
+14 -17
View File
@@ -16,7 +16,7 @@ _T = TypeVar("_T")
class _IOBase(BinaryIO):
@property
def closed(self) -> bool: ...
def _checkClosed(self, msg: Optional[str] = ...) -> None: ... # undocumented
def _checkClosed(self) -> None: ...
def _checkReadable(self) -> None: ...
def _checkSeekable(self) -> None: ...
def _checkWritable(self) -> None: ...
@@ -32,7 +32,7 @@ class _IOBase(BinaryIO):
def truncate(self, size: Optional[int] = ...) -> int: ...
def writable(self) -> bool: ...
def __enter__(self: _T) -> _T: ...
def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[Any]) -> Optional[bool]: ...
def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[Any]) -> bool: ...
def __iter__(self: _T) -> _T: ...
# The parameter type of writelines[s]() is determined by that of write():
def writelines(self, lines: Iterable[bytes]) -> None: ...
@@ -84,8 +84,8 @@ class BufferedWriter(_BufferedIOBase):
class BytesIO(_BufferedIOBase):
def __init__(self, initial_bytes: bytes = ...) -> None: ...
def __setstate__(self, state: Tuple[Any, ...]) -> None: ...
def __getstate__(self) -> Tuple[Any, ...]: ...
def __setstate__(self, tuple) -> None: ...
def __getstate__(self) -> tuple: ...
# 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[].
@@ -129,7 +129,7 @@ class _TextIOBase(TextIO):
def _checkSeekable(self) -> None: ...
def _checkWritable(self) -> None: ...
def close(self) -> None: ...
def detach(self) -> IO[Any]: ...
def detach(self) -> IO: ...
def fileno(self) -> int: ...
def flush(self) -> None: ...
def isatty(self) -> bool: ...
@@ -146,7 +146,7 @@ class _TextIOBase(TextIO):
def write(self, pbuf: unicode) -> int: ...
def writelines(self, lines: Iterable[unicode]) -> None: ...
def __enter__(self: _T) -> _T: ...
def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[Any]) -> Optional[bool]: ...
def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[Any]) -> bool: ...
def __iter__(self: _T) -> _T: ...
class StringIO(_TextIOBase):
@@ -154,8 +154,8 @@ class StringIO(_TextIOBase):
def __init__(self,
initial_value: Optional[unicode] = ...,
newline: Optional[unicode] = ...) -> None: ...
def __setstate__(self, state: Tuple[Any, ...]) -> None: ...
def __getstate__(self) -> Tuple[Any, ...]: ...
def __setstate__(self, state: tuple) -> None: ...
def __getstate__(self) -> tuple: ...
# 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[].
@@ -167,15 +167,12 @@ class TextIOWrapper(_TextIOBase):
line_buffering: bool
buffer: BinaryIO
_CHUNK_SIZE: int
def __init__(
self,
buffer: IO[Any],
encoding: Optional[Text] = ...,
errors: Optional[Text] = ...,
newline: Optional[Text] = ...,
line_buffering: bool = ...,
write_through: bool = ...,
) -> None: ...
def __init__(self, buffer: IO,
encoding: Optional[Text] = ...,
errors: Optional[Text] = ...,
newline: Optional[Text] = ...,
line_buffering: bool = ...,
write_through: bool = ...) -> None: ...
def open(file: Union[str, unicode, int],
mode: Text = ...,
+13 -3
View File
@@ -1,7 +1,17 @@
from typing import Any, List, Tuple, Dict, Generic, Tuple
"""Stub file for the '_json' module."""
# This is an autogenerated file. It serves as a starting point
# for a more precise manual annotation of this module.
# Feel free to edit the source below, but remove this header when you do.
from typing import Any, List, Tuple, Dict, Generic
def encode_basestring_ascii(*args, **kwargs) -> str:
raise TypeError()
def scanstring(a, b, *args, **kwargs) -> tuple:
raise TypeError()
def encode_basestring_ascii(*args, **kwargs) -> str: ...
def scanstring(a, b, *args, **kwargs) -> Tuple[Any, ...]: ...
class Encoder(object): ...
class Scanner(object): ...
+14 -10
View File
@@ -253,30 +253,34 @@ class SocketType(object):
timeout: float
def __init__(self, family: int = ..., type: int = ..., proto: int = ...) -> None: ...
def accept(self) -> Tuple[SocketType, Tuple[Any, ...]]: ...
def bind(self, address: Tuple[Any, ...]) -> None: ...
def accept(self) -> Tuple[SocketType, tuple]: ...
def bind(self, address: tuple) -> None: ...
def close(self) -> None: ...
def connect(self, address: Tuple[Any, ...]) -> None: ...
def connect_ex(self, address: Tuple[Any, ...]) -> int: ...
def connect(self, address: tuple) -> None:
raise gaierror
raise timeout
def connect_ex(self, address: tuple) -> int: ...
def dup(self) -> SocketType: ...
def fileno(self) -> int: ...
def getpeername(self) -> Tuple[Any, ...]: ...
def getsockname(self) -> Tuple[Any, ...]: ...
def getpeername(self) -> tuple: ...
def getsockname(self) -> tuple: ...
def getsockopt(self, level: int, option: int, buffersize: int = ...) -> str: ...
def gettimeout(self) -> float: ...
def listen(self, backlog: int) -> None: ...
def listen(self, backlog: int) -> None:
raise error
def makefile(self, mode: str = ..., buffersize: int = ...) -> IO[Any]: ...
def recv(self, buffersize: int, flags: int = ...) -> str: ...
def recv_into(self, buffer: bytearray, nbytes: int = ..., flags: int = ...) -> int: ...
def recvfrom(self, buffersize: int, flags: int = ...) -> Tuple[Any, ...]: ...
def recvfrom(self, buffersize: int, flags: int = ...) -> tuple:
raise error
def recvfrom_into(self, buffer: bytearray, nbytes: int = ...,
flags: int = ...) -> int: ...
def send(self, data: str, flags: int = ...) -> int: ...
def sendall(self, data: str, flags: int = ...) -> None: ...
@overload
def sendto(self, data: str, address: Tuple[Any, ...]) -> int: ...
def sendto(self, data: str, address: tuple) -> int: ...
@overload
def sendto(self, data: str, flags: int, address: Tuple[Any, ...]) -> int: ...
def sendto(self, data: str, flags: int, address: tuple) -> int: ...
def setblocking(self, flag: bool) -> None: ...
def setsockopt(self, level: int, option: int, value: Union[int, str]) -> None: ...
def settimeout(self, value: Optional[float]) -> None: ...
+15 -17
View File
@@ -8,8 +8,10 @@ MAXREPEAT: long
copyright: str
class SRE_Match(object):
def start(self, group: int = ...) -> int: ...
def end(self, group: int = ...) -> int: ...
def start(self, group: int = ...) -> int:
raise IndexError()
def end(self, group: int = ...) -> int:
raise IndexError()
def expand(self, s: str) -> Any: ...
@overload
def group(self) -> str: ...
@@ -17,9 +19,8 @@ class SRE_Match(object):
def group(self, group: int = ...) -> Optional[str]: ...
def groupdict(self) -> Dict[int, Optional[str]]: ...
def groups(self) -> Tuple[Optional[str], ...]: ...
def span(self) -> Tuple[int, int]: ...
@property
def regs(self) -> Tuple[Tuple[int, int], ...]: ... # undocumented
def span(self) -> Tuple[int, int]:
raise IndexError()
class SRE_Scanner(object):
pattern: str
@@ -32,23 +33,20 @@ class SRE_Pattern(object):
groups: int
groupindex: Mapping[str, int]
indexgroup: Sequence[int]
def findall(self, source: str, pos: int = ..., endpos: int = ...) -> List[Union[Tuple[Any, ...], str]]: ...
def finditer(self, source: str, pos: int = ..., endpos: int = ...) -> Iterable[Union[Tuple[Any, ...], str]]: ...
def findall(self, source: str, pos: int = ..., endpos: int = ...) -> List[Union[tuple, str]]: ...
def finditer(self, source: str, pos: int = ..., endpos: int = ...) -> Iterable[Union[tuple, str]]: ...
def match(self, pattern, pos: int = ..., endpos: int = ...) -> SRE_Match: ...
def scanner(self, s: str, start: int = ..., end: int = ...) -> SRE_Scanner: ...
def search(self, pattern, pos: int = ..., endpos: int = ...) -> SRE_Match: ...
def split(self, source: str, maxsplit: int = ...) -> List[Optional[str]]: ...
def sub(self, repl: str, string: str, count: int = ...) -> Tuple[Any, ...]: ...
def subn(self, repl: str, string: str, count: int = ...) -> Tuple[Any, ...]: ...
def sub(self, repl: str, string: str, count: int = ...) -> tuple: ...
def subn(self, repl: str, string: str, count: int = ...) -> tuple: ...
def compile(
pattern: str,
flags: int,
code: List[int],
groups: int = ...,
groupindex: Mapping[str, int] = ...,
indexgroup: Sequence[int] = ...,
) -> SRE_Pattern: ...
def compile(pattern: str, flags: int, code: List[int],
groups: int = ...,
groupindex: Mapping[str, int] = ...,
indexgroup: Sequence[int] = ...) -> SRE_Pattern:
raise OverflowError()
def getcodesize() -> int: ...
+3 -1
View File
@@ -1,5 +1,7 @@
# Source: https://hg.python.org/cpython/file/2.7/Lib/_threading_local.py
from typing import Any
from typing import Any, List
__all__: List[str]
class _localbase(object): ...
+11
View File
@@ -0,0 +1,11 @@
from typing import Any, List, Optional, Type
default_action: str
filters: List[tuple]
once_registry: dict
def warn(message: Warning, category: Optional[Type[Warning]] = ..., stacklevel: int = ...) -> None: ...
def warn_explicit(message: Warning, category: Optional[Type[Warning]],
filename: str, lineno: int,
module: Any = ..., registry: dict = ...,
module_globals: dict = ...) -> None: ...
+5 -7
View File
@@ -1,20 +1,18 @@
from typing import Any, Callable, Dict, Set, Tuple, Type, TypeVar
from typing import Any, Dict, Set, Tuple, Type
import _weakrefset
_FuncT = TypeVar('_FuncT', bound=Callable[..., Any])
# NOTE: mypy has special processing for ABCMeta and abstractmethod.
def abstractmethod(funcobj: _FuncT) -> _FuncT: ...
def abstractmethod(funcobj: Any) -> Any: ...
class ABCMeta(type):
# TODO: FrozenSet
__abstractmethods__: Set[Any]
_abc_cache: _weakrefset.WeakSet[Any]
_abc_cache: _weakrefset.WeakSet
_abc_invalidation_counter: int
_abc_negative_cache: _weakrefset.WeakSet[Any]
_abc_negative_cache: _weakrefset.WeakSet
_abc_negative_cache_version: int
_abc_registry: _weakrefset.WeakSet[Any]
_abc_registry: _weakrefset.WeakSet
def __init__(self, name: str, bases: Tuple[type, ...], namespace: Dict[Any, Any]) -> None: ...
def __instancecheck__(cls: ABCMeta, instance: Any) -> Any: ...
def __subclasscheck__(cls: ABCMeta, subclass: Any) -> Any: ...
+11 -5
View File
@@ -1,5 +1,5 @@
# These are not exported.
from typing import Any, Dict, Generic, TypeVar, Tuple, overload, Type, Optional, List, Union, Reversible
from typing import Dict, Generic, TypeVar, Tuple, overload, Type, Optional, List, Union, Reversible
# These are exported.
from typing import (
@@ -28,7 +28,7 @@ _VT = TypeVar('_VT')
# namedtuple is special-cased in the type checker; the initializer is ignored.
def namedtuple(typename: Union[str, unicode], field_names: Union[str, unicode, Iterable[Union[str, unicode]]],
verbose: bool = ..., rename: bool = ...) -> Type[Tuple[Any, ...]]: ...
verbose: bool = ..., rename: bool = ...) -> Type[tuple]: ...
class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T] = ...,
@@ -56,6 +56,8 @@ class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]):
def __reversed__(self) -> Iterator[_T]: ...
def __iadd__(self: _S, iterable: Iterable[_T]) -> _S: ...
_CounterT = TypeVar('_CounterT', bound=Counter)
class Counter(Dict[_T, int], Generic[_T]):
@overload
def __init__(self, **kwargs: int) -> None: ...
@@ -63,7 +65,7 @@ class Counter(Dict[_T, int], Generic[_T]):
def __init__(self, mapping: Mapping[_T, int]) -> None: ...
@overload
def __init__(self, iterable: Iterable[_T]) -> None: ...
def copy(self: _S) -> _S: ...
def copy(self: _CounterT) -> _CounterT: ...
def elements(self) -> Iterator[_T]: ...
def most_common(self, n: Optional[int] = ...) -> List[Tuple[_T, int]]: ...
@overload
@@ -91,11 +93,15 @@ class Counter(Dict[_T, int], Generic[_T]):
def __iand__(self, other: Counter[_T]) -> Counter[_T]: ...
def __ior__(self, other: Counter[_T]) -> Counter[_T]: ...
_OrderedDictT = TypeVar('_OrderedDictT', bound=OrderedDict)
class OrderedDict(Dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]):
def popitem(self, last: bool = ...) -> Tuple[_KT, _VT]: ...
def copy(self: _S) -> _S: ...
def copy(self: _OrderedDictT) -> _OrderedDictT: ...
def __reversed__(self) -> Iterator[_KT]: ...
_DefaultDictT = TypeVar('_DefaultDictT', bound=defaultdict)
class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
default_factory: Callable[[], _VT]
@overload
@@ -117,4 +123,4 @@ class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
def __init__(self, default_factory: Optional[Callable[[], _VT]],
iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
def __missing__(self, key: _KT) -> _VT: ...
def copy(self: _S) -> _S: ...
def copy(self: _DefaultDictT) -> _DefaultDictT: ...
+3 -12
View File
@@ -1,19 +1,10 @@
# Stubs for compileall (Python 2)
from typing import Any, Optional, Pattern, Union
from typing import Optional, Pattern, Union
_Path = Union[str, bytes]
# rx can be any object with a 'search' method; once we have Protocols we can change the type
def compile_dir(
dir: _Path,
maxlevels: int = ...,
ddir: Optional[_Path] = ...,
force: bool = ...,
rx: Optional[Pattern[Any]] = ...,
quiet: int = ...,
) -> int: ...
def compile_file(
fullname: _Path, ddir: Optional[_Path] = ..., force: bool = ..., rx: Optional[Pattern[Any]] = ..., quiet: int = ...,
) -> int: ...
def compile_dir(dir: _Path, maxlevels: int = ..., ddir: Optional[_Path] = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ...) -> int: ...
def compile_file(fullname: _Path, ddir: Optional[_Path] = ..., force: bool = ..., rx: Optional[Pattern] = ..., quiet: int = ...) -> int: ...
def compile_path(skip_curdir: bool = ..., maxlevels: int = ..., force: bool = ..., quiet: int = ...) -> int: ...
+1 -3
View File
@@ -105,8 +105,6 @@ class FileCookieJar(CookieJar):
def load(self, filename: Optional[Any] = ..., ignore_discard: bool = ..., ignore_expires: bool = ...): ...
def revert(self, filename: Optional[Any] = ..., ignore_discard: bool = ..., ignore_expires: bool = ...): ...
class LWPCookieJar(FileCookieJar):
def as_lwp_str(self, ignore_discard: bool = ..., ignore_expires: bool = ...) -> str: ... # undocumented
MozillaCookieJar = FileCookieJar
LWPCookieJar = FileCookieJar
def lwp_cookie_str(cookie: Cookie) -> str: ...
-14
View File
@@ -1,14 +0,0 @@
from typing import TypeVar, Callable, Union, Tuple, Any, Optional, SupportsInt, Hashable, List
_Type = TypeVar("_Type", bound=type)
_Reduce = Union[Tuple[Callable[..., _Type], Tuple[Any, ...]], Tuple[Callable[..., _Type], Tuple[Any, ...], Optional[Any]]]
__all__: List[str]
def pickle(ob_type: _Type, pickle_function: Callable[[_Type], Union[str, _Reduce[_Type]]], constructor_ob: Optional[Callable[[_Reduce[_Type]], _Type]] = ...) -> None: ...
def constructor(object: Callable[[_Reduce[_Type]], _Type]) -> None: ...
def add_extension(module: Hashable, name: Hashable, code: SupportsInt) -> None: ...
def remove_extension(module: Hashable, name: Hashable, code: int) -> None: ...
def clear_extension_cache() -> None: ...
+4 -4
View File
@@ -1,5 +1,5 @@
from typing import Any, Generator
from typing import Generator
def walk(self) -> Generator[Any, Any, Any]: ...
def body_line_iterator(msg, decode: bool = ...) -> Generator[Any, Any, Any]: ...
def typed_subpart_iterator(msg, maintype=..., subtype=...) -> Generator[Any, Any, Any]: ...
def walk(self) -> Generator: ...
def body_line_iterator(msg, decode: bool = ...) -> Generator: ...
def typed_subpart_iterator(msg, maintype=..., subtype=...) -> Generator: ...
+2 -2
View File
@@ -1,4 +1,4 @@
from typing import Any, Generator
from typing import Generator
class Message:
preamble = ...
@@ -42,4 +42,4 @@ class Message:
def set_boundary(self, boundary) -> None: ...
def get_content_charset(self, failobj=...): ...
def get_charsets(self, failobj=...): ...
def walk(self) -> Generator[Any, Any, Any]: ...
def walk(self) -> Generator: ...
+74 -6
View File
@@ -4,10 +4,15 @@
from abc import ABCMeta, abstractmethod
from typing import Any, Callable, Generic, Dict, Iterable, Optional, Sequence, Tuple, TypeVar, overload
from collections import namedtuple
_AnyCallable = Callable[..., Any]
_T = TypeVar("_T")
_T2 = TypeVar("_T2")
_T3 = TypeVar("_T3")
_T4 = TypeVar("_T4")
_T5 = TypeVar("_T5")
_S = TypeVar("_S")
@overload
def reduce(function: Callable[[_T, _T], _T],
@@ -25,9 +30,72 @@ def wraps(wrapped: _AnyCallable, assigned: Sequence[str] = ..., updated: Sequenc
def total_ordering(cls: type) -> type: ...
def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], Any]: ...
class partial(Generic[_T]):
func = ... # Callable[..., _T]
args: Tuple[Any, ...]
keywords: Dict[str, Any]
def __init__(self, func: Callable[..., _T], *args: Any, **kwargs: Any) -> None: ...
def __call__(self, *args: Any, **kwargs: Any) -> _T: ...
@overload
def partial(__func: Callable[[_T], _S], __arg: _T) -> Callable[[], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2], _S], __arg: _T) -> Callable[[_T2], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2, _T3], _S], __arg: _T) -> Callable[[_T2, _T3], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2, _T3, _T4], _S], __arg: _T) -> Callable[[_T2, _T3, _T4], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S], __arg: _T) -> Callable[[_T2, _T3, _T4, _T5], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2], _S],
__arg1: _T,
__arg2: _T2) -> Callable[[], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2, _T3], _S],
__arg1: _T,
__arg2: _T2) -> Callable[[_T3], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2, _T3, _T4], _S],
__arg1: _T,
__arg2: _T2) -> Callable[[_T3, _T4], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S],
__arg1: _T,
__arg2: _T2) -> Callable[[_T3, _T4, _T5], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2, _T3], _S],
__arg1: _T,
__arg2: _T2,
__arg3: _T3) -> Callable[[], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2, _T3, _T4], _S],
__arg1: _T,
__arg2: _T2,
__arg3: _T3) -> Callable[[_T4], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S],
__arg1: _T,
__arg2: _T2,
__arg3: _T3) -> Callable[[_T4, _T5], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2, _T3, _T4], _S],
__arg1: _T,
__arg2: _T2,
__arg3: _T3,
__arg4: _T4) -> Callable[[], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S],
__arg1: _T,
__arg2: _T2,
__arg3: _T3,
__arg4: _T4) -> Callable[[_T5], _S]: ...
@overload
def partial(__func: Callable[[_T, _T2, _T3, _T4, _T5], _S],
__arg1: _T,
__arg2: _T2,
__arg3: _T3,
__arg4: _T4,
__arg5: _T5) -> Callable[[], _S]: ...
@overload
def partial(__func: Callable[..., _S],
*args: Any,
**kwargs: Any) -> Callable[..., _S]: ...
+3 -3
View File
@@ -6,9 +6,9 @@ _DataType = Union[str, unicode, bytearray, buffer, memoryview]
class _hash(object): # This is not actually in the module namespace.
name: str
block_size: int
digest_size: int
digestsize: int
block_size = 0
digest_size = 0
digestsize = 0
def __init__(self, arg: _DataType = ...) -> None: ...
def update(self, arg: _DataType) -> None: ...
def digest(self) -> str: ...
+7 -9
View File
@@ -1,18 +1,16 @@
from typing import TypeVar, List, Iterable, Any, Callable, Optional, Protocol
from typing import TypeVar, List, Iterable, Any, Callable, Optional
_T = TypeVar('_T')
class _Sortable(Protocol):
def __lt__(self: _T, other: _T) -> bool: ...
def cmp_lt(x, y) -> bool: ...
def heappush(heap: List[_T], item: _T) -> None: ...
def heappop(heap: List[_T]) -> _T: ...
def heappop(heap: List[_T]) -> _T:
raise IndexError() # if heap is empty
def heappushpop(heap: List[_T], item: _T) -> _T: ...
def heapify(x: List[_T]) -> None: ...
def heapreplace(heap: List[_T], item: _T) -> _T: ...
def heapreplace(heap: List[_T], item: _T) -> _T:
raise IndexError() # if heap is empty
def merge(*iterables: Iterable[_T]) -> Iterable[_T]: ...
def nlargest(n: int, iterable: Iterable[_T],
key: Optional[Callable[[_T], _Sortable]] = ...) -> List[_T]: ...
def nsmallest(n: int, iterable: Iterable[_T],
key: Optional[Callable[[_T], _Sortable]] = ...) -> List[_T]: ...
key: Optional[Callable[[_T], Any]] = ...) -> List[_T]: ...
def nsmallest(n: int, iterable: Iterable[_T]) -> List[_T]: ...
+4 -4
View File
@@ -1,5 +1,5 @@
from typing import Dict
from typing import Any, Mapping
name2codepoint: Dict[str, int]
codepoint2name: Dict[int, str]
entitydefs: Dict[str, str]
name2codepoint: Mapping[str, int]
codepoint2name: Mapping[int, str]
entitydefs: Mapping[str, str]
+1 -1
View File
@@ -15,7 +15,7 @@ PY_SOURCE: int
SEARCH_ERROR: int
def acquire_lock() -> None: ...
def find_module(name: str, path: Iterable[str] = ...) -> Optional[Tuple[IO[Any], str, Tuple[str, str, int]]]: ...
def find_module(name: str, path: Iterable[str] = ...) -> Optional[Tuple[str, str, Tuple[str, str, int]]]: ...
def get_magic() -> str: ...
def get_suffixes() -> List[Tuple[str, str, int]]: ...
def init_builtin(name: str) -> types.ModuleType: ...
+51 -45
View File
@@ -1,4 +1,4 @@
from types import CodeType, TracebackType, FrameType, FunctionType, MethodType, ModuleType
from types import CodeType, TracebackType, FrameType, ModuleType
from typing import Any, Dict, Callable, List, NamedTuple, Optional, Sequence, Tuple, Type, Union
# Types and members
@@ -22,12 +22,11 @@ CO_VARARGS: int
CO_VARKEYWORDS: int
TPFLAGS_IS_ABSTRACT: int
class ModuleInfo(NamedTuple):
name: str
suffix: str
mode: str
module_type: int
ModuleInfo = NamedTuple('ModuleInfo', [('name', str),
('suffix', str),
('mode', str),
('module_type', int),
])
def getmembers(
object: object,
predicate: Optional[Callable[[Any], bool]] = ...
@@ -53,40 +52,43 @@ def isgetsetdescriptor(object: object) -> bool: ...
def ismemberdescriptor(object: object) -> bool: ...
# Retrieving source code
_SourceObjectType = Union[ModuleType, Type[Any], MethodType, FunctionType, TracebackType, FrameType, CodeType, Callable[..., Any]]
def findsource(object: _SourceObjectType) -> Tuple[List[str], int]: ...
def getabsfile(object: _SourceObjectType) -> str: ...
def findsource(object: object) -> Tuple[List[str], int]: ...
def getabsfile(object: object) -> str: ...
def getblock(lines: Sequence[str]) -> Sequence[str]: ...
def getdoc(object: object) -> Optional[str]: ...
def getcomments(object: object) -> Optional[str]: ...
def getfile(object: _SourceObjectType) -> str: ...
def getmodule(object: object) -> Optional[ModuleType]: ...
def getsourcefile(object: _SourceObjectType) -> Optional[str]: ...
def getsourcelines(object: _SourceObjectType) -> Tuple[List[str], int]: ...
def getsource(object: _SourceObjectType) -> str: ...
def getdoc(object: object) -> str: ...
def getcomments(object: object) -> str: ...
def getfile(object: object) -> str: ...
def getmodule(object: object) -> ModuleType: ...
def getsourcefile(object: object) -> str: ...
# TODO restrict to "module, class, method, function, traceback, frame,
# or code object"
def getsourcelines(object: object) -> Tuple[List[str], int]: ...
# TODO restrict to "a module, class, method, function, traceback, frame,
# or code object"
def getsource(object: object) -> str: ...
def cleandoc(doc: str) -> str: ...
def indentsize(line: str) -> int: ...
# Classes and functions
def getclasstree(classes: List[type], unique: bool = ...) -> List[Union[Tuple[type, Tuple[type, ...]], List[Any]]]: ...
def getclasstree(classes: List[type], unique: bool = ...) -> List[
Union[Tuple[type, Tuple[type, ...]], list]]: ...
class ArgSpec(NamedTuple):
args: List[str]
varargs: Optional[str]
keywords: Optional[str]
defaults: Tuple[Any, ...]
ArgSpec = NamedTuple('ArgSpec', [('args', List[str]),
('varargs', Optional[str]),
('keywords', Optional[str]),
('defaults', tuple),
])
class ArgInfo(NamedTuple):
args: List[str]
varargs: Optional[str]
keywords: Optional[str]
locals: Dict[str, Any]
ArgInfo = NamedTuple('ArgInfo', [('args', List[str]),
('varargs', Optional[str]),
('keywords', Optional[str]),
('locals', Dict[str, Any]),
])
class Arguments(NamedTuple):
args: List[Union[str, List[Any]]]
varargs: Optional[str]
keywords: Optional[str]
Arguments = NamedTuple('Arguments', [('args', List[Union[str, List[Any]]]),
('varargs', Optional[str]),
('keywords', Optional[str]),
])
def getargs(co: CodeType) -> Arguments: ...
def getargspec(func: object) -> ArgSpec: ...
@@ -102,14 +104,18 @@ def getcallargs(func, *args, **kwds) -> Dict[str, Any]: ...
# The interpreter stack
class Traceback(NamedTuple):
filename: str
lineno: int
function: str
code_context: Optional[List[str]]
index: Optional[int] # type: ignore
Traceback = NamedTuple(
'Traceback',
[
('filename', str),
('lineno', int),
('function', str),
('code_context', List[str]),
('index', int),
]
)
_FrameInfo = Tuple[FrameType, str, int, str, Optional[List[str]], Optional[int]]
_FrameInfo = Tuple[FrameType, str, int, str, List[str], int]
def getouterframes(frame: FrameType, context: int = ...) -> List[_FrameInfo]: ...
def getframeinfo(frame: Union[FrameType, TracebackType], context: int = ...) -> Traceback: ...
@@ -120,10 +126,10 @@ def currentframe(depth: int = ...) -> FrameType: ...
def stack(context: int = ...) -> List[_FrameInfo]: ...
def trace(context: int = ...) -> List[_FrameInfo]: ...
class Attribute(NamedTuple):
name: str
kind: str
defining_class: type
object: object
Attribute = NamedTuple('Attribute', [('name', str),
('kind', str),
('defining_class', type),
('object', object),
])
def classify_class_attrs(cls: type) -> List[Attribute]: ...
+2
View File
@@ -14,6 +14,8 @@ def cycle(iterable: Iterable[_T]) -> Iterator[_T]: ...
def repeat(object: _T, times: int = ...) -> Iterator[_T]: ...
def accumulate(iterable: Iterable[_T]) -> Iterator[_T]: ...
class chain(Iterator[_T], Generic[_T]):
def __init__(self, *iterables: Iterable[_T]) -> None: ...
def next(self) -> _T: ...
+7 -7
View File
@@ -1,4 +1,4 @@
from typing import Any, IO, Optional, Tuple, Callable, Dict, List, Union, Text, Protocol, Type
from typing import Any, IO, Optional, Tuple, Callable, Dict, List, Union, Text, Protocol
class JSONDecodeError(ValueError):
def dumps(self, obj: Any) -> str: ...
@@ -11,7 +11,7 @@ def dumps(obj: Any,
ensure_ascii: bool = ...,
check_circular: bool = ...,
allow_nan: bool = ...,
cls: Optional[Type[JSONEncoder]] = ...,
cls: Any = ...,
indent: Optional[int] = ...,
separators: Optional[Tuple[str, str]] = ...,
encoding: str = ...,
@@ -25,7 +25,7 @@ def dump(obj: Any,
ensure_ascii: bool = ...,
check_circular: bool = ...,
allow_nan: bool = ...,
cls: Optional[Type[JSONEncoder]] = ...,
cls: Any = ...,
indent: Optional[int] = ...,
separators: Optional[Tuple[str, str]] = ...,
encoding: str = ...,
@@ -35,8 +35,8 @@ def dump(obj: Any,
def loads(s: Union[Text, bytes],
encoding: Any = ...,
cls: Optional[Type[JSONDecoder]] = ...,
object_hook: Optional[Callable[[Dict[Any, Any]], Any]] = ...,
cls: Any = ...,
object_hook: Optional[Callable[[Dict], Any]] = ...,
parse_float: Optional[Callable[[str], Any]] = ...,
parse_int: Optional[Callable[[str], Any]] = ...,
parse_constant: Optional[Callable[[str], Any]] = ...,
@@ -48,8 +48,8 @@ class _Reader(Protocol):
def load(fp: _Reader,
encoding: Optional[str] = ...,
cls: Optional[Type[JSONDecoder]] = ...,
object_hook: Optional[Callable[[Dict[Any, Any]], Any]] = ...,
cls: Any = ...,
object_hook: Optional[Callable[[Dict], Any]] = ...,
parse_float: Optional[Callable[[str], Any]] = ...,
parse_int: Optional[Callable[[str], Any]] = ...,
parse_constant: Optional[Callable[[str], Any]] = ...,
+2 -2
View File
@@ -2,5 +2,5 @@
from hashlib import md5 as md5, md5 as new
blocksize: int
digest_size: int
blocksize = 0
digest_size = 0
+3 -3
View File
@@ -14,7 +14,7 @@ from Queue import Queue
class DummyProcess(threading.Thread):
_children: weakref.WeakKeyDictionary[Any, Any]
_children: weakref.WeakKeyDictionary
_parent: threading.Thread
_pid: None
_start_called: bool
@@ -42,10 +42,10 @@ class Value(object):
JoinableQueue = Queue
def Array(typecode, sequence, lock=...) -> array.array[Any]: ...
def Array(typecode, sequence, lock=...) -> array.array: ...
def Manager() -> Any: ...
def Pool(processes=..., initializer=..., initargs=...) -> Any: ...
def active_children() -> List[Any]: ...
def active_children() -> List: ...
def current_process() -> threading.Thread: ...
def freeze_support() -> None: ...
def shutdown() -> None: ...
@@ -15,7 +15,7 @@ class Connection(object):
def poll(self, timeout=...) -> Any: ...
class Listener(object):
_backlog_queue: Optional[Queue[Any]]
_backlog_queue: Optional[Queue]
address: Any
def __init__(self, address=..., family=..., backlog=...) -> None: ...
def accept(self) -> Connection: ...
+3 -2
View File
@@ -1,12 +1,13 @@
# Source: https://hg.python.org/cpython/file/2.7/Lib/mutex.py
from typing import Any, Callable, Deque, TypeVar
from collections import deque
from typing import Any, Callable, TypeVar
_ArgType = TypeVar('_ArgType')
class mutex:
locked: bool
queue: Deque[Any]
queue: deque
def __init__(self) -> None: ...
def test(self) -> bool: ...
def testandset(self) -> bool: ...
+24 -13
View File
@@ -3,7 +3,7 @@
from builtins import OSError as error
from io import TextIOWrapper as _TextIOWrapper
from posix import listdir as listdir, stat_result as stat_result # TODO: use this, see https://github.com/python/mypy/issues/3078
from posix import stat_result as stat_result # TODO: use this, see https://github.com/python/mypy/issues/3078
import sys
from typing import (
Mapping, MutableMapping, Dict, List, Any, Tuple, Iterator, overload, Union, AnyStr,
@@ -136,17 +136,10 @@ if sys.version_info >= (3, 6):
_PathType = path._PathType
class _StatVFS(NamedTuple):
f_bsize: int
f_frsize: int
f_blocks: int
f_bfree: int
f_bavail: int
f_files: int
f_ffree: int
f_favail: int
f_flag: int
f_namemax: int
_StatVFS = NamedTuple('_StatVFS', [('f_bsize', int), ('f_frsize', int), ('f_blocks', int),
('f_bfree', int), ('f_bavail', int), ('f_files', int),
('f_ffree', int), ('f_favail', int), ('f_flag', int),
('f_namemax', int)])
def getlogin() -> str: ...
def getpid() -> int: ...
@@ -199,7 +192,7 @@ def lseek(fd: int, pos: int, how: int) -> int: ...
def open(file: _PathType, flags: int, mode: int = ...) -> int: ...
def pipe() -> Tuple[int, int]: ...
def read(fd: int, n: int) -> bytes: ...
def write(fd: int, string: Union[bytes, buffer]) -> int: ...
def write(fd: int, string: bytes) -> int: ...
def access(path: _PathType, mode: int) -> bool: ...
def chdir(path: _PathType) -> None: ...
def fchdir(fd: int) -> None: ...
@@ -207,6 +200,7 @@ def getcwd() -> str: ...
def getcwdu() -> unicode: ...
def chmod(path: _PathType, mode: int) -> None: ...
def link(src: _PathType, link_name: _PathType) -> None: ...
def listdir(path: AnyStr) -> List[AnyStr]: ...
def lstat(path: _PathType) -> Any: ...
def mknod(filename: _PathType, mode: int = ..., device: int = ...) -> None: ...
def major(device: int) -> int: ...
@@ -356,3 +350,20 @@ if sys.version_info < (3, 0):
P_ALL: int
WEXITED: int
WNOWAIT: int
if sys.version_info >= (3, 3):
if sys.platform != 'win32':
# Unix only
def sync() -> None: ...
def truncate(path: Union[_PathType, int], length: int) -> None: ... # Unix only up to version 3.4
def fwalk(top: AnyStr = ..., topdown: bool = ...,
onerror: Callable = ..., *, follow_symlinks: bool = ...,
dir_fd: int = ...) -> Iterator[Tuple[AnyStr, List[AnyStr], List[AnyStr], int]]: ...
terminal_size = NamedTuple('terminal_size', [('columns', int), ('lines', int)])
def get_terminal_size(fd: int = ...) -> terminal_size: ...
if sys.version_info >= (3, 4):
def cpu_count() -> Optional[int]: ...
+4 -1
View File
@@ -4,7 +4,10 @@
import os
import sys
from typing import overload, List, Any, AnyStr, Sequence, Tuple, TypeVar, Union, Text, Callable, Optional
from typing import (
overload, List, Any, AnyStr, Sequence, Tuple, BinaryIO, TextIO,
TypeVar, Union, Text, Callable, Optional
)
_T = TypeVar('_T')
+4 -1
View File
@@ -4,7 +4,10 @@
import os
import sys
from typing import overload, List, Any, AnyStr, Sequence, Tuple, TypeVar, Union, Text, Callable, Optional
from typing import (
overload, List, Any, AnyStr, Sequence, Tuple, BinaryIO, TextIO,
TypeVar, Union, Text, Callable, Optional
)
_T = TypeVar('_T')
+7 -7
View File
@@ -5,24 +5,24 @@ _T = TypeVar('_T')
class Popen3:
sts: int
cmd: Iterable[Any]
cmd: Iterable
pid: int
tochild: TextIO
fromchild: TextIO
childerr: Optional[TextIO]
def __init__(self, cmd: Iterable[Any] = ..., capturestderr: bool = ..., bufsize: int = ...) -> None: ...
def __init__(self, cmd: Iterable = ..., capturestderr: bool = ..., bufsize: int = ...) -> None: ...
def __del__(self) -> None: ...
def poll(self, _deadstate: _T = ...) -> Union[int, _T]: ...
def wait(self) -> int: ...
class Popen4(Popen3):
childerr: None
cmd: Iterable[Any]
cmd: Iterable
pid: int
tochild: TextIO
fromchild: TextIO
def __init__(self, cmd: Iterable[Any] = ..., bufsize: int = ...) -> None: ...
def __init__(self, cmd: Iterable = ..., bufsize: int = ...) -> None: ...
def popen2(cmd: Iterable[Any] = ..., bufsize: int = ..., mode: str = ...) -> Tuple[TextIO, TextIO]: ...
def popen3(cmd: Iterable[Any] = ..., bufsize: int = ..., mode: str = ...) -> Tuple[TextIO, TextIO, TextIO]: ...
def popen4(cmd: Iterable[Any] = ..., bufsize: int = ..., mode: str = ...) -> Tuple[TextIO, TextIO]: ...
def popen2(cmd: Iterable = ..., bufsize: int = ..., mode: str = ...) -> Tuple[TextIO, TextIO]: ...
def popen3(cmd: Iterable = ..., bufsize: int = ..., mode: str = ...) -> Tuple[TextIO, TextIO, TextIO]: ...
def popen4(cmd: Iterable = ..., bufsize: int = ..., mode: str = ...) -> Tuple[TextIO, TextIO]: ...
+13 -9
View File
@@ -1,4 +1,4 @@
from typing import AnyStr, Dict, List, Mapping, Tuple, Union, Sequence, IO, Optional, TypeVar
from typing import Dict, List, Mapping, Tuple, Union, Sequence, IO, Optional, TypeVar
error = OSError
@@ -7,8 +7,6 @@ environ: Dict[str, str]
pathconf_names: Dict[str, int]
sysconf_names: Dict[str, int]
_T = TypeVar("_T")
EX_CANTCREAT: int
EX_CONFIG: int
EX_DATAERR: int
@@ -113,8 +111,10 @@ def fchmod(fd: int, mode: int) -> None: ...
def fchown(fd: int, uid: int, gid: int) -> None: ...
def fdatasync(fd: int) -> None: ...
def fdopen(fd: int, mode: str = ..., bufsize: int = ...) -> IO[str]: ...
def fork() -> int: ...
def forkpty() -> Tuple[int, int]: ...
def fork() -> int:
raise OSError()
def forkpty() -> Tuple[int, int]:
raise OSError()
def fpathconf(fd: int, name: str) -> None: ...
def fstat(fd: int) -> stat_result: ...
def fstatvfs(fd: int) -> statvfs_result: ...
@@ -126,7 +126,8 @@ def getegid() -> int: ...
def geteuid() -> int: ...
def getgid() -> int: ...
def getgroups() -> List[int]: ...
def getloadavg() -> Tuple[float, float, float]: ...
def getloadavg() -> Tuple[float, float, float]:
raise OSError()
def getlogin() -> str: ...
def getpgid(pid: int) -> int: ...
def getpgrp() -> int: ...
@@ -142,7 +143,8 @@ def kill(pid: int, sig: int) -> None: ...
def killpg(pgid: int, sig: int) -> None: ...
def lchown(path: unicode, uid: int, gid: int) -> None: ...
def link(source: unicode, link_name: str) -> None: ...
def listdir(path: AnyStr) -> List[AnyStr]: ...
_T = TypeVar("_T")
def listdir(path: _T) -> List[_T]: ...
def lseek(fd: int, pos: int, how: int) -> None: ...
def lstat(path: unicode) -> stat_result: ...
def major(device: int) -> int: ...
@@ -192,10 +194,12 @@ def uname() -> Tuple[str, str, str, str, str]: ...
def unlink(path: unicode) -> None: ...
def unsetenv(varname: str) -> None: ...
def urandom(n: int) -> str: ...
def utime(path: unicode, times: Optional[Tuple[int, int]]) -> None: ...
def utime(path: unicode, times: Optional[Tuple[int, int]]) -> None:
raise OSError
def wait() -> int: ...
_r = Tuple[float, float, int, int, int, int, int, int, int, int, int, int, int, int, int, int]
def wait3(options: int) -> Tuple[int, int, _r]: ...
def wait4(pid: int, options: int) -> Tuple[int, int, _r]: ...
def waitpid(pid: int, options: int) -> int: ...
def waitpid(pid: int, options: int) -> int:
raise OSError()
def write(fd: int, str: str) -> int: ...
+7 -9
View File
@@ -7,14 +7,12 @@
# ----- random classes -----
import _random
from typing import AbstractSet, Any, Callable, Iterator, List, Protocol, Sequence, TypeVar, Union, overload
from typing import (
Any, TypeVar, Sequence, List, Callable, AbstractSet, Union,
overload
)
_T = TypeVar("_T")
_T_co = TypeVar('_T_co', covariant=True)
class _Sampleable(Protocol[_T_co]):
def __iter__(self) -> Iterator[_T_co]: ...
def __len__(self) -> int: ...
_T = TypeVar('_T')
class Random(_random.Random):
def __init__(self, x: object = ...) -> None: ...
@@ -30,7 +28,7 @@ class Random(_random.Random):
def randint(self, a: int, b: int) -> int: ...
def choice(self, seq: Sequence[_T]) -> _T: ...
def shuffle(self, x: List[Any], random: Callable[[], None] = ...) -> None: ...
def sample(self, population: _Sampleable[_T], k: int) -> List[_T]: ...
def sample(self, population: Union[Sequence[_T], AbstractSet[_T]], k: int) -> List[_T]: ...
def random(self) -> float: ...
def uniform(self, a: float, b: float) -> float: ...
def triangular(self, low: float = ..., high: float = ..., mode: float = ...) -> float: ...
@@ -61,7 +59,7 @@ def randrange(start: int, stop: int, step: int = ...) -> int: ...
def randint(a: int, b: int) -> int: ...
def choice(seq: Sequence[_T]) -> _T: ...
def shuffle(x: List[Any], random: Callable[[], float] = ...) -> None: ...
def sample(population: _Sampleable[_T], k: int) -> List[_T]: ...
def sample(population: Union[Sequence[_T], AbstractSet[_T]], k: int) -> List[_T]: ...
def random() -> float: ...
def uniform(a: float, b: float) -> float: ...
def triangular(low: float = ..., high: float = ...,
+15 -15
View File
@@ -10,21 +10,21 @@ from typing import (
)
# ----- re variables and constants -----
DEBUG: int
I: int
IGNORECASE: int
L: int
LOCALE: int
M: int
MULTILINE: int
S: int
DOTALL: int
X: int
VERBOSE: int
U: int
UNICODE: int
T: int
TEMPLATE: int
DEBUG = 0
I = 0
IGNORECASE = 0
L = 0
LOCALE = 0
M = 0
MULTILINE = 0
S = 0
DOTALL = 0
X = 0
VERBOSE = 0
U = 0
UNICODE = 0
T = 0
TEMPLATE = 0
class error(Exception): ...
+1 -3
View File
@@ -1,5 +1,3 @@
from typing import Any, List
class Repr:
maxarray: int
maxdeque: int
@@ -27,7 +25,7 @@ class Repr:
def repr_str(self, x, level: complex) -> str: ...
def repr_tuple(self, x, level: complex) -> str: ...
def _possibly_sorted(x) -> List[Any]: ...
def _possibly_sorted(x) -> list: ...
aRepr: Repr
def repr(x) -> str: ...
+6 -18
View File
@@ -19,24 +19,12 @@ RLIMIT_MEMLOCK: int
RLIMIT_VMEM: int
RLIMIT_AS: int
class _RUsage(NamedTuple):
ru_utime: float
ru_stime: float
ru_maxrss: int
ru_ixrss: int
ru_idrss: int
ru_isrss: int
ru_minflt: int
ru_majflt: int
ru_nswap: int
ru_inblock: int
ru_oublock: int
ru_msgsnd: int
ru_msgrcv: int
ru_nsignals: int
ru_nvcsw: int
ru_nivcsw: int
_RUsage = NamedTuple('_RUsage', [('ru_utime', float), ('ru_stime', float), ('ru_maxrss', int),
('ru_ixrss', int), ('ru_idrss', int), ('ru_isrss', int),
('ru_minflt', int), ('ru_majflt', int), ('ru_nswap', int),
('ru_inblock', int), ('ru_oublock', int), ('ru_msgsnd', int),
('ru_msgrcv', int), ('ru_nsignals', int), ('ru_nvcsw', int),
('ru_nivcsw', int)])
def getrusage(who: int) -> _RUsage: ...
def getpagesize() -> int: ...
+16 -16
View File
@@ -3,7 +3,7 @@ from typing import Any, Callable, Hashable, Iterable, Iterator, MutableMapping,
_T = TypeVar('_T')
_Setlike = Union[BaseSet[_T], Iterable[_T]]
_SelfT = TypeVar('_SelfT')
_SelfT = TypeVar('_SelfT', bound=BaseSet)
class BaseSet(Iterable[_T]):
def __init__(self) -> None: ...
@@ -18,13 +18,13 @@ class BaseSet(Iterable[_T]):
def __copy__(self: _SelfT) -> _SelfT: ...
def __deepcopy__(self: _SelfT, memo: MutableMapping[int, BaseSet[_T]]) -> _SelfT: ...
def __or__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
def union(self: _SelfT, other: _Setlike[_T]) -> _SelfT: ...
def union(self: _SelfT, other: _Setlike) -> _SelfT: ...
def __and__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
def intersection(self: _SelfT, other: _Setlike[Any]) -> _SelfT: ...
def intersection(self: _SelfT, other: _Setlike) -> _SelfT: ...
def __xor__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
def symmetric_difference(self: _SelfT, other: _Setlike[_T]) -> _SelfT: ...
def symmetric_difference(self: _SelfT, other: _Setlike) -> _SelfT: ...
def __sub__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
def difference(self: _SelfT, other: _Setlike[Any]) -> _SelfT: ...
def difference(self: _SelfT, other: _Setlike) -> _SelfT: ...
def __contains__(self, element: Any) -> bool: ...
def issubset(self, other: BaseSet[_T]) -> bool: ...
def issuperset(self, other: BaseSet[_T]) -> bool: ...
@@ -34,20 +34,20 @@ class BaseSet(Iterable[_T]):
def __gt__(self, other: BaseSet[_T]) -> bool: ...
class ImmutableSet(BaseSet[_T], Hashable):
def __init__(self, iterable: Optional[_Setlike[_T]] = ...) -> None: ...
def __init__(self, iterable: Optional[_Setlike] = ...) -> None: ...
def __hash__(self) -> int: ...
class Set(BaseSet[_T]):
def __init__(self, iterable: Optional[_Setlike[_T]] = ...) -> None: ...
def __ior__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
def union_update(self, other: _Setlike[_T]) -> None: ...
def __iand__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
def intersection_update(self, other: _Setlike[Any]) -> None: ...
def __ixor__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
def symmetric_difference_update(self, other: _Setlike[_T]) -> None: ...
def __isub__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
def difference_update(self, other: _Setlike[Any]) -> None: ...
def update(self, iterable: _Setlike[_T]) -> None: ...
def __init__(self, iterable: Optional[_Setlike] = ...) -> None: ...
def __ior__(self, other: BaseSet[_T]) -> Set: ...
def union_update(self, other: _Setlike) -> None: ...
def __iand__(self, other: BaseSet[_T]) -> Set: ...
def intersection_update(self, other: _Setlike) -> None: ...
def __ixor__(self, other: BaseSet[_T]) -> Set: ...
def symmetric_difference_update(self, other: _Setlike) -> None: ...
def __isub__(self, other: BaseSet[_T]) -> Set: ...
def difference_update(self, other: _Setlike) -> None: ...
def update(self, iterable: _Setlike) -> None: ...
def clear(self) -> None: ...
def add(self, element: _T) -> None: ...
def remove(self, element: _T) -> None: ...
+2 -2
View File
@@ -7,5 +7,5 @@ class sha(object):
def copy(self) -> sha: ...
def new(string: str = ...) -> sha: ...
blocksize: int
digest_size: int
blocksize = 0
digest_size = 0
+1 -1
View File
@@ -2,7 +2,7 @@ from typing import Any, Dict, Iterator, List, Optional, Tuple
import collections
class Shelf(collections.MutableMapping[Any, Any]):
class Shelf(collections.MutableMapping):
def __init__(self, dict: Dict[Any, Any], protocol: Optional[int] = ..., writeback: bool = ..., keyencoding: str = ...) -> None: ...
def __iter__(self) -> Iterator[str]: ...
def keys(self) -> List[Any]: ...
-1
View File
@@ -7,7 +7,6 @@ _SLT = TypeVar('_SLT', bound=shlex)
class shlex:
def __init__(self, instream: IO[Any] = ..., infile: IO[Any] = ..., posix: bool = ...) -> None: ...
def __iter__(self: _SLT) -> _SLT: ...
def next(self) -> str: ...
def get_token(self) -> Optional[str]: ...
def push_token(self, _str: str) -> None: ...
def read_token(self) -> str: ...
+6 -3
View File
@@ -63,6 +63,9 @@ def pause() -> None: ...
def setitimer(which: int, seconds: float, interval: float = ...) -> Tuple[float, float]: ...
def getitimer(which: int) -> Tuple[float, float]: ...
def set_wakeup_fd(fd: int) -> int: ...
def siginterrupt(signalnum: int, flag: bool) -> None: ...
def signal(signalnum: int, handler: _HANDLER) -> _HANDLER: ...
def default_int_handler(signum: int, frame: FrameType) -> None: ...
def siginterrupt(signalnum: int, flag: bool) -> None:
raise RuntimeError()
def signal(signalnum: int, handler: _HANDLER) -> _HANDLER:
raise RuntimeError()
def default_int_handler(signum: int, frame: FrameType) -> None:
raise KeyboardInterrupt()
+9 -10
View File
@@ -1,15 +1,14 @@
from typing import List, NamedTuple
class struct_spwd(NamedTuple):
sp_nam: str
sp_pwd: str
sp_lstchg: int
sp_min: int
sp_max: int
sp_warn: int
sp_inact: int
sp_expire: int
sp_flag: int
struct_spwd = NamedTuple("struct_spwd", [("sp_nam", str),
("sp_pwd", str),
("sp_lstchg", int),
("sp_min", int),
("sp_max", int),
("sp_warn", int),
("sp_inact", int),
("sp_expire", int),
("sp_flag", int)])
def getspall() -> List[struct_spwd]: ...
def getspnam(name: str) -> struct_spwd: ...
+6 -6
View File
@@ -4,10 +4,10 @@ from typing import Any, Dict, Iterable, List, Match, Optional, Pattern as _Patte
SPECIAL_CHARS: str
REPEAT_CHARS: str
DIGITS: Set[Any]
OCTDIGITS: Set[Any]
HEXDIGITS: Set[Any]
WHITESPACE: Set[Any]
DIGITS: Set
OCTDIGITS: Set
HEXDIGITS: Set
WHITESPACE: Set
ESCAPES: Dict[str, Tuple[str, int]]
CATEGORIES: Dict[str, Union[Tuple[str, str], Tuple[str, List[Tuple[str, str]]]]]
FLAGS: Dict[str, int]
@@ -59,5 +59,5 @@ def isdigit(char: str) -> bool: ...
def isname(name: str) -> bool: ...
def parse(str: str, flags: int = ..., pattern: Pattern = ...) -> SubPattern: ...
_Template = Tuple[List[Tuple[int, int]], List[Optional[int]]]
def parse_template(source: str, pattern: _Pattern[Any]) -> _Template: ...
def expand_template(template: _Template, match: Match[Any]) -> str: ...
def parse_template(source: str, pattern: _Pattern) -> _Template: ...
def expand_template(template: _Template, match: Match) -> str: ...
+48 -48
View File
@@ -9,51 +9,51 @@ def S_ISSOCK(mode: int) -> bool: ...
def S_IMODE(mode: int) -> int: ...
def S_IFMT(mode: int) -> int: ...
ST_MODE: int
ST_INO: int
ST_DEV: int
ST_NLINK: int
ST_UID: int
ST_GID: int
ST_SIZE: int
ST_ATIME: int
ST_MTIME: int
ST_CTIME: int
S_IFSOCK: int
S_IFLNK: int
S_IFREG: int
S_IFBLK: int
S_IFDIR: int
S_IFCHR: int
S_IFIFO: int
S_ISUID: int
S_ISGID: int
S_ISVTX: int
S_IRWXU: int
S_IRUSR: int
S_IWUSR: int
S_IXUSR: int
S_IRWXG: int
S_IRGRP: int
S_IWGRP: int
S_IXGRP: int
S_IRWXO: int
S_IROTH: int
S_IWOTH: int
S_IXOTH: int
S_ENFMT: int
S_IREAD: int
S_IWRITE: int
S_IEXEC: int
UF_NODUMP: int
UF_IMMUTABLE: int
UF_APPEND: int
UF_OPAQUE: int
UF_NOUNLINK: int
UF_COMPRESSED: int
UF_HIDDEN: int
SF_ARCHIVED: int
SF_IMMUTABLE: int
SF_APPEND: int
SF_NOUNLINK: int
SF_SNAPSHOT: int
ST_MODE = 0
ST_INO = 0
ST_DEV = 0
ST_NLINK = 0
ST_UID = 0
ST_GID = 0
ST_SIZE = 0
ST_ATIME = 0
ST_MTIME = 0
ST_CTIME = 0
S_IFSOCK = 0
S_IFLNK = 0
S_IFREG = 0
S_IFBLK = 0
S_IFDIR = 0
S_IFCHR = 0
S_IFIFO = 0
S_ISUID = 0
S_ISGID = 0
S_ISVTX = 0
S_IRWXU = 0
S_IRUSR = 0
S_IWUSR = 0
S_IXUSR = 0
S_IRWXG = 0
S_IRGRP = 0
S_IWGRP = 0
S_IXGRP = 0
S_IRWXO = 0
S_IROTH = 0
S_IWOTH = 0
S_IXOTH = 0
S_ENFMT = 0
S_IREAD = 0
S_IWRITE = 0
S_IEXEC = 0
UF_NODUMP = 0
UF_IMMUTABLE = 0
UF_APPEND = 0
UF_OPAQUE = 0
UF_NOUNLINK = 0
UF_COMPRESSED = 0
UF_HIDDEN = 0
SF_ARCHIVED = 0
SF_IMMUTABLE = 0
SF_APPEND = 0
SF_NOUNLINK = 0
SF_SNAPSHOT = 0
+4 -1
View File
@@ -68,7 +68,10 @@ class Formatter(object):
def parse(self, format_string: str) -> Iterable[Tuple[str, str, str, str]]: ...
def get_field(self, field_name: str, args: Sequence[Any],
kwargs: Mapping[str, Any]) -> Any: ...
def get_value(self, key: Union[int, str], args: Sequence[Any], kwargs: Mapping[str, Any]) -> Any: ...
def get_value(self, key: Union[int, str], args: Sequence[Any],
kwargs: Mapping[str, Any]) -> Any:
raise IndexError()
raise KeyError()
def check_unused_args(self, used_args: Sequence[Union[int, str]], args: Sequence[Any],
kwargs: Mapping[str, Any]) -> None: ...
def format_field(self, value: Any, format_spec: str) -> Any: ...
+63 -20
View File
@@ -6,24 +6,67 @@ lowercase: str
uppercase: str
whitespace: str
def atof(a: str) -> float: ...
def atoi(a: str, base: int = ...) -> int: ...
def atol(a: str, base: int = ...) -> long: ...
def capitalize(s: str) -> str: ...
def count(s: str, sub: str, start: int = ..., end: int = ...) -> int: ...
def expandtabs(string: str, tabsize: int = ...) -> str: ...
def find(s: str, sub: str, start: int = ..., end: int = ...) -> int: ...
def join(list: Sequence[str], sep: str = ...) -> str: ...
def joinfields(list: Sequence[str], sep: str = ...) -> str: ...
def lower(s: str) -> str: ...
def lstrip(s: str) -> str: ...
def atof(a: str) -> float:
raise DeprecationWarning()
def atoi(a: str, base: int = ...) -> int:
raise DeprecationWarning()
def atol(a: str, base: int = ...) -> long:
raise DeprecationWarning()
def capitalize(s: str) -> str:
raise DeprecationWarning()
def count(s: str, sub: str, start: int = ..., end: int = ...) -> int:
raise DeprecationWarning()
def expandtabs(string: str, tabsize: int = ...) -> str:
raise DeprecationWarning()
raise OverflowError()
def find(s: str, sub: str, start: int = ..., end: int = ...) -> int:
raise DeprecationWarning()
def join(list: Sequence[str], sep: str = ...) -> str:
raise DeprecationWarning()
raise OverflowError()
def joinfields(list: Sequence[str], sep: str = ...) -> str:
raise DeprecationWarning()
raise OverflowError()
def lower(s: str) -> str:
raise DeprecationWarning()
def lstrip(s: str) -> str:
raise DeprecationWarning()
def maketrans(frm: str, to: str) -> str: ...
def replace(s: str, old: str, new: str, maxsplit: int = ...) -> str: ...
def rfind(s: str, sub: str, start: int = ..., end: int = ...) -> int: ...
def rstrip(s: str) -> str: ...
def split(s: str, sep: str, maxsplit: int = ...) -> List[str]: ...
def splitfields(s: str, sep: str, maxsplit: int = ...) -> List[str]: ...
def strip(s: str) -> str: ...
def swapcase(s: str) -> str: ...
def translate(s: str, table: str, deletechars: str = ...) -> str: ...
def upper(s: str) -> str: ...
def replace(s: str, old: str, new: str, maxsplit: int = ...) -> str:
raise DeprecationWarning()
def rfind(s: str, sub: str, start: int = ..., end: int = ...) -> int:
raise DeprecationWarning()
def rstrip(s: str) -> str:
raise DeprecationWarning()
def split(s: str, sep: str, maxsplit: int = ...) -> List[str]:
raise DeprecationWarning()
def splitfields(s: str, sep: str, maxsplit: int = ...) -> List[str]:
raise DeprecationWarning()
def strip(s: str) -> str:
raise DeprecationWarning()
def swapcase(s: str) -> str:
raise DeprecationWarning()
def translate(s: str, table: str, deletechars: str = ...) -> str:
raise DeprecationWarning()
def upper(s: str) -> str:
raise DeprecationWarning()
+27 -30
View File
@@ -2,9 +2,7 @@
# Based on http://docs.python.org/2/library/subprocess.html and Python 3 stub
from typing import (
Sequence, Any, Mapping, Callable, Tuple, IO, Union, Optional, List, Text, TypeVar, Generic,
)
from typing import Sequence, Any, Mapping, Callable, Tuple, IO, Union, Optional, List, Text
_FILE = Union[None, int, IO[Any]]
_TXT = Union[bytes, Text]
@@ -61,50 +59,49 @@ PIPE: int
STDOUT: int
class CalledProcessError(Exception):
returncode: int
returncode = 0
# morally: _CMD
cmd: Any
# morally: Optional[bytes]
output: bytes
output: Any
def __init__(self,
returncode: int,
cmd: _CMD,
output: Optional[bytes] = ...) -> None: ...
# We use a dummy type variable used to make Popen generic like it is in python 3
_T = TypeVar('_T', bound=bytes)
class Popen:
stdin: Optional[IO[Any]]
stdout: Optional[IO[Any]]
stderr: Optional[IO[Any]]
pid = 0
returncode = 0
class Popen(Generic[_T]):
stdin: Optional[IO[bytes]]
stdout: Optional[IO[bytes]]
stderr: Optional[IO[bytes]]
pid: int
returncode: int
def __new__(cls,
args: _CMD,
bufsize: int = ...,
executable: Optional[_TXT] = ...,
stdin: Optional[_FILE] = ...,
stdout: Optional[_FILE] = ...,
stderr: Optional[_FILE] = ...,
preexec_fn: Optional[Callable[[], Any]] = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: Optional[_TXT] = ...,
env: Optional[_ENV] = ...,
universal_newlines: bool = ...,
startupinfo: Optional[Any] = ...,
creationflags: int = ...) -> Popen[bytes]: ...
def __init__(self,
args: _CMD,
bufsize: int = ...,
executable: Optional[_TXT] = ...,
stdin: Optional[_FILE] = ...,
stdout: Optional[_FILE] = ...,
stderr: Optional[_FILE] = ...,
preexec_fn: Optional[Callable[[], Any]] = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: Optional[_TXT] = ...,
env: Optional[_ENV] = ...,
universal_newlines: bool = ...,
startupinfo: Optional[Any] = ...,
creationflags: int = ...) -> None: ...
def poll(self) -> int: ...
def wait(self) -> int: ...
# morally: -> Tuple[Optional[bytes], Optional[bytes]]
def communicate(self, input: Optional[_TXT] = ...) -> Tuple[bytes, bytes]: ...
def communicate(self, input: Optional[_TXT] = ...) -> Tuple[Any, Any]: ...
def send_signal(self, signal: int) -> None: ...
def terminate(self) -> None: ...
def kill(self) -> None: ...
def __enter__(self) -> Popen: ...
def __exit__(self, type, value, traceback) -> bool: ...
def list2cmdline(seq: Sequence[str]) -> str: ... # undocumented
+9 -7
View File
@@ -8,7 +8,7 @@ from types import FrameType, ModuleType, TracebackType, ClassType
# The following type alias are stub-only and do not exist during runtime
_ExcInfo = Tuple[Type[BaseException], BaseException, TracebackType]
_OptExcInfo = Union[_ExcInfo, Tuple[None, None, None]]
_OptExcInfo = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
class _flags:
bytes_warning: int
@@ -42,11 +42,11 @@ class _float_info:
rounds: int
class _version_info(Tuple[int, int, int, str, int]):
major: int
minor: int
micro: int
major = 0
minor = 0
micro = 0
releaselevel: str
serial: int
serial = 0
_mercurial: Tuple[str, str, str]
api_version: int
@@ -114,11 +114,13 @@ def _getframe(depth: int = ...) -> FrameType: ...
def call_tracing(fn: Any, args: Any) -> Any: ...
def __displayhook__(value: int) -> None: ...
def __excepthook__(type_: type, value: BaseException, traceback: TracebackType) -> None: ...
def exc_clear() -> None: ...
def exc_clear() -> None:
raise DeprecationWarning()
def exc_info() -> _OptExcInfo: ...
# sys.exit() accepts an optional argument of anything printable
def exit(arg: Any = ...) -> NoReturn: ...
def exit(arg: Any = ...) -> NoReturn:
raise SystemExit()
def getcheckinterval() -> int: ... # deprecated
def getdefaultencoding() -> str: ...
def getdlopenflags() -> int: ...
+4 -4
View File
@@ -19,12 +19,12 @@ class _RandomNameSequence:
class _TemporaryFileWrapper(IO[str]):
delete: bool
file: IO[str]
file: IO
name: Any
def __init__(self, file: IO[str], name: Any, delete: bool = ...) -> None: ...
def __init__(self, file: IO, name: Any, delete: bool = ...) -> None: ...
def __del__(self) -> None: ...
def __enter__(self) -> _TemporaryFileWrapper: ...
def __exit__(self, exc, value, tb) -> Optional[bool]: ...
def __exit__(self, exc, value, tb) -> bool: ...
def __getattr__(self, name: unicode) -> Any: ...
def close(self) -> None: ...
def unlink(self, path: unicode) -> None: ...
@@ -88,7 +88,7 @@ class TemporaryDirectory:
dir: Union[bytes, unicode] = ...) -> None: ...
def cleanup(self) -> None: ...
def __enter__(self) -> Any: ... # Can be str or unicode
def __exit__(self, type, value, traceback) -> None: ...
def __exit__(self, type, value, traceback) -> bool: ...
@overload
def mkstemp() -> Tuple[int, str]: ...
+4 -2
View File
@@ -21,8 +21,10 @@ class _localdummy(object): ...
def start_new(function: Callable[..., Any], args: Any, kwargs: Any = ...) -> int: ...
def start_new_thread(function: Callable[..., Any], args: Any, kwargs: Any = ...) -> int: ...
def interrupt_main() -> None: ...
def exit() -> None: ...
def exit_thread() -> Any: ...
def exit() -> None:
raise SystemExit()
def exit_thread() -> Any:
raise SystemExit()
def allocate_lock() -> LockType: ...
def get_ident() -> int: ...
def stack_size(size: int = ...) -> int: ...
+2
View File
@@ -4,6 +4,8 @@
from pipes import Template
from typing import Dict, List
__all__: List[str]
table: Dict[str, Template]
t: Template
uncompress: Template
+2 -19
View File
@@ -64,23 +64,6 @@ class CodeType:
co_nlocals: int
co_stacksize: int
co_varnames: Tuple[str, ...]
def __init__(
self,
argcount: int,
nlocals: int,
stacksize: int,
flags: int,
codestring: str,
constants: Tuple[Any, ...],
names: Tuple[str, ...],
varnames: Tuple[str, ...],
filename: str,
name: str,
firstlineno: int,
lnotab: str,
freevars: Tuple[str, ...] = ...,
cellvars: Tuple[str, ...] = ...,
) -> None: ...
class GeneratorType:
gi_code: CodeType
@@ -103,7 +86,7 @@ class UnboundMethodType:
__name__: str
__func__ = im_func
__self__ = im_self
def __init__(self, func: Callable[..., Any], obj: object) -> None: ...
def __init__(self, func: Callable, obj: object) -> None: ...
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
class InstanceType(object): ...
@@ -154,7 +137,7 @@ class EllipsisType: ...
class DictProxyType:
# TODO is it possible to have non-string keys?
# no __init__
def copy(self) -> Dict[Any, Any]: ...
def copy(self) -> dict: ...
def get(self, key: str, default: _T = ...) -> Union[Any, _T]: ...
def has_key(self, key: str) -> bool: ...
def items(self) -> List[Tuple[str, Any]]: ...
+33 -59
View File
@@ -11,6 +11,7 @@ overload = object()
Any = object()
TypeVar = object()
_promote = object()
no_type_check = object()
class _SpecialForm(object):
def __getitem__(self, typeargs: Any) -> object: ...
@@ -21,12 +22,6 @@ Protocol: _SpecialForm = ...
Callable: _SpecialForm = ...
Type: _SpecialForm = ...
ClassVar: _SpecialForm = ...
Final: _SpecialForm = ...
_F = TypeVar('_F', bound=Callable[..., Any])
def final(f: _F) -> _F: ...
Literal: _SpecialForm = ...
# TypedDict is a (non-subscriptable) special form.
TypedDict: object = ...
class GenericMeta(type): ...
@@ -35,22 +30,6 @@ class GenericMeta(type): ...
# distinguish the None type from the None value.
NoReturn = Union[None]
# These type variables are used by the container types.
_T = TypeVar('_T')
_S = TypeVar('_S')
_KT = TypeVar('_KT') # Key type.
_VT = TypeVar('_VT') # Value type.
_T_co = TypeVar('_T_co', covariant=True) # Any type covariant containers.
_V_co = TypeVar('_V_co', covariant=True) # Any type covariant containers.
_KT_co = TypeVar('_KT_co', covariant=True) # Key type covariant containers.
_VT_co = TypeVar('_VT_co', covariant=True) # Value type covariant containers.
_T_contra = TypeVar('_T_contra', contravariant=True) # Ditto contravariant.
_TC = TypeVar('_TC', bound=Type[object])
_C = TypeVar("_C", bound=Callable[..., Any])
no_type_check = object()
def no_type_check_decorator(decorator: _C) -> _C: ...
# Type aliases and type constructors
class TypeAlias:
@@ -73,39 +52,52 @@ AnyStr = TypeVar('AnyStr', str, unicode)
# Abstract base classes.
def runtime_checkable(cls: _TC) -> _TC: ...
# These type variables are used by the container types.
_T = TypeVar('_T')
_S = TypeVar('_S')
_KT = TypeVar('_KT') # Key type.
_VT = TypeVar('_VT') # Value type.
_T_co = TypeVar('_T_co', covariant=True) # Any type covariant containers.
_V_co = TypeVar('_V_co', covariant=True) # Any type covariant containers.
_KT_co = TypeVar('_KT_co', covariant=True) # Key type covariant containers.
_VT_co = TypeVar('_VT_co', covariant=True) # Value type covariant containers.
_T_contra = TypeVar('_T_contra', contravariant=True) # Ditto contravariant.
_TC = TypeVar('_TC', bound=Type[object])
_C = TypeVar("_C", bound=Callable)
@runtime_checkable
def runtime(cls: _TC) -> _TC: ...
@runtime
class SupportsInt(Protocol, metaclass=ABCMeta):
@abstractmethod
def __int__(self) -> int: ...
@runtime_checkable
@runtime
class SupportsFloat(Protocol, metaclass=ABCMeta):
@abstractmethod
def __float__(self) -> float: ...
@runtime_checkable
@runtime
class SupportsComplex(Protocol, metaclass=ABCMeta):
@abstractmethod
def __complex__(self) -> complex: ...
@runtime_checkable
@runtime
class SupportsAbs(Protocol[_T_co]):
@abstractmethod
def __abs__(self) -> _T_co: ...
@runtime_checkable
@runtime
class Reversible(Protocol[_T_co]):
@abstractmethod
def __reversed__(self) -> Iterator[_T_co]: ...
@runtime_checkable
@runtime
class Sized(Protocol, metaclass=ABCMeta):
@abstractmethod
def __len__(self) -> int: ...
@runtime_checkable
@runtime
class Hashable(Protocol, metaclass=ABCMeta):
# TODO: This is special, in that a subclass of a hashable class may not be hashable
# (for example, list vs. object). It's not obvious how to represent this. This class
@@ -113,12 +105,12 @@ class Hashable(Protocol, metaclass=ABCMeta):
@abstractmethod
def __hash__(self) -> int: ...
@runtime_checkable
@runtime
class Iterable(Protocol[_T_co]):
@abstractmethod
def __iter__(self) -> Iterator[_T_co]: ...
@runtime_checkable
@runtime
class Iterator(Iterable[_T_co], Protocol[_T_co]):
@abstractmethod
def next(self) -> _T_co: ...
@@ -143,7 +135,7 @@ class Generator(Iterator[_T_co], Generic[_T_co, _T_contra, _V_co]):
@property
def gi_running(self) -> bool: ...
@runtime_checkable
@runtime
class Container(Protocol[_T_co]):
@abstractmethod
def __contains__(self, x: object) -> bool: ...
@@ -242,7 +234,7 @@ class ValuesView(MappingView, Iterable[_VT_co], Generic[_VT_co]):
def __contains__(self, o: object) -> bool: ...
def __iter__(self) -> Iterator[_VT_co]: ...
@runtime_checkable
@runtime
class ContextManager(Protocol[_T_co]):
def __enter__(self) -> _T_co: ...
def __exit__(self, __exc_type: Optional[Type[BaseException]],
@@ -345,7 +337,7 @@ class IO(Iterator[AnyStr], Generic[AnyStr]):
def __enter__(self) -> IO[AnyStr]: ...
@abstractmethod
def __exit__(self, t: Optional[Type[BaseException]], value: Optional[BaseException],
traceback: Optional[TracebackType]) -> Optional[bool]: ...
traceback: Optional[TracebackType]) -> bool: ...
class BinaryIO(IO[str]):
# TODO readinto
@@ -406,8 +398,6 @@ class Match(Generic[AnyStr]):
def start(self, group: Union[int, str] = ...) -> int: ...
def end(self, group: Union[int, str] = ...) -> int: ...
def span(self, group: Union[int, str] = ...) -> Tuple[int, int]: ...
@property
def regs(self) -> Tuple[Tuple[int, int], ...]: ... # undocumented
# We need a second TypeVar with the same definition as AnyStr, because
# Pattern is generic over AnyStr (determining the type of its .pattern
@@ -449,9 +439,8 @@ class Pattern(Generic[AnyStr]):
# Functions
def get_type_hints(
obj: Callable[..., Any], globalns: Optional[Dict[Text, Any]] = ..., localns: Optional[Dict[Text, Any]] = ...,
) -> None: ...
def get_type_hints(obj: Callable, globalns: Optional[dict[Text, Any]] = ...,
localns: Optional[dict[Text, Any]] = ...) -> None: ...
@overload
def cast(tp: Type[_T], obj: Any) -> _T: ...
@@ -461,33 +450,18 @@ def cast(tp: str, obj: Any) -> Any: ...
# Type constructors
# NamedTuple is special-cased in the type checker
class NamedTuple(Tuple[Any, ...]):
class NamedTuple(tuple):
_fields: Tuple[str, ...]
def __init__(self, typename: Text, fields: Iterable[Tuple[Text, Any]] = ...,
**kwargs: Any) -> None: ...
def __init__(self, typename: Text, fields: Iterable[Tuple[Text, Any]] = ..., *,
verbose: bool = ..., rename: bool = ..., **kwargs: Any) -> None: ...
@classmethod
def _make(cls: Type[_T], iterable: Iterable[Any]) -> _T: ...
def _asdict(self) -> Dict[str, Any]: ...
def _asdict(self) -> dict: ...
def _replace(self: _T, **kwargs: Any) -> _T: ...
# Internal mypy fallback type for all typed dicts (does not exist at runtime)
class _TypedDict(Mapping[str, object], metaclass=ABCMeta):
def copy(self: _T) -> _T: ...
# Using NoReturn so that only calls using mypy plugin hook that specialize the signature
# can go through.
def setdefault(self, k: NoReturn, default: object) -> object: ...
# Mypy plugin hook for 'pop' expects that 'default' has a type variable type.
def pop(self, k: NoReturn, default: _T = ...) -> object: ...
def update(self: _T, __m: _T) -> None: ...
def has_key(self, k: str) -> bool: ...
def viewitems(self) -> ItemsView[str, object]: ...
def viewkeys(self) -> KeysView[str]: ...
def viewvalues(self) -> ValuesView[object]: ...
def __delitem__(self, k: NoReturn) -> None: ...
def NewType(name: str, tp: Type[_T]) -> Type[_T]: ...
# This itself is only available during type checking
+3 -23
View File
@@ -3,10 +3,9 @@
# Based on http://docs.python.org/2.7/library/unittest.html
from typing import (Any, Callable, Dict, FrozenSet, Iterable, Iterator,
List, Mapping, NoReturn, Optional, overload, Pattern,
Sequence, Set, Text, TextIO, Tuple, Type, TypeVar, Union)
List, NoReturn, Optional, overload, Pattern, Sequence, Set,
Text, TextIO, Tuple, Type, TypeVar, Union)
from abc import abstractmethod, ABCMeta
import datetime
import types
_T = TypeVar('_T')
@@ -97,19 +96,11 @@ class TestCase(Testable):
def assertAlmostEqual(self, first: float, second: float, *,
msg: Any = ..., delta: float = ...) -> None: ...
@overload
def assertAlmostEqual(self, first: datetime.datetime,
second: datetime.datetime, *,
msg: Any = ..., delta: datetime.timedelta = ...) -> None: ...
@overload
def assertAlmostEquals(self, first: float, second: float,
places: int = ..., msg: Any = ...) -> None: ...
@overload
def assertAlmostEquals(self, first: float, second: float, *,
msg: Any = ..., delta: float = ...) -> None: ...
@overload
def assertAlmostEquals(self, first: datetime.datetime,
second: datetime.datetime, *,
msg: Any = ..., delta: datetime.timedelta = ...) -> None: ...
def failUnlessAlmostEqual(self, first: float, second: float, places: int = ...,
msg: object = ...) -> None: ...
@overload
@@ -119,19 +110,11 @@ class TestCase(Testable):
def assertNotAlmostEqual(self, first: float, second: float, *,
msg: Any = ..., delta: float = ...) -> None: ...
@overload
def assertNotAlmostEqual(self, first: datetime.datetime,
second: datetime.datetime, *,
msg: Any = ..., delta: datetime.timedelta = ...) -> None: ...
@overload
def assertNotAlmostEquals(self, first: float, second: float,
places: int = ..., msg: Any = ...) -> None: ...
@overload
def assertNotAlmostEquals(self, first: float, second: float, *,
msg: Any = ..., delta: float = ...) -> None: ...
@overload
def assertNotAlmostEquals(self, first: datetime.datetime,
second: datetime.datetime, *,
msg: Any = ..., delta: datetime.timedelta = ...) -> None: ...
def failIfAlmostEqual(self, first: float, second: float, places: int = ...,
msg: object = ...,
delta: float = ...) -> None: ...
@@ -166,10 +149,7 @@ class TestCase(Testable):
def assertRegexpMatches(self, text: Text, regexp: _Regexp, msg: object = ...) -> None: ...
def assertNotRegexpMatches(self, text: Text, regexp: _Regexp, msg: object = ...) -> None: ...
def assertItemsEqual(self, first: Iterable[Any], second: Iterable[Any], msg: object = ...) -> None: ...
def assertDictContainsSubset(self,
expected: Mapping[Any, Any],
actual: Mapping[Any, Any],
msg: object = ...) -> None: ...
def assertDictContainsSubset(self, expected: Dict[Any, Any], actual: Dict[Any, Any], msg: object = ...) -> None: ...
def addTypeEqualityFunc(self, typeobj: type, function: Callable[..., None]) -> None: ...
@overload
def failUnlessRaises(self, exception: _ExceptionType, callable: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ...
+1 -1
View File
@@ -128,7 +128,7 @@ def quote_plus(s: AnyStr, safe: Text = ...) -> AnyStr: ...
def urlencode(query: Union[Sequence[Tuple[Any, Any]], Mapping[Any, Any]], doseq=...) -> str: ...
def getproxies() -> Mapping[str, str]: ...
def proxy_bypass(host: str) -> Any: ... # Undocumented
def proxy_bypass(host): ...
# Names in __all__ with no definition:
# basejoin
+25 -21
View File
@@ -1,6 +1,6 @@
# Stubs for urlparse (Python 2)
from typing import AnyStr, Dict, List, NamedTuple, Tuple, Sequence, Union, overload, Optional
from typing import AnyStr, Dict, List, NamedTuple, Tuple, Sequence, Union, overload
_String = Union[str, unicode]
@@ -11,37 +11,41 @@ non_hierarchical: List[str]
uses_query: List[str]
uses_fragment: List[str]
scheme_chars: str
MAX_CACHE_SIZE: int
MAX_CACHE_SIZE = 0
def clear_cache() -> None: ...
class ResultMixin(object):
@property
def username(self) -> Optional[str]: ...
def username(self) -> str: ...
@property
def password(self) -> Optional[str]: ...
def password(self) -> str: ...
@property
def hostname(self) -> Optional[str]: ...
def hostname(self) -> str: ...
@property
def port(self) -> Optional[int]: ...
def port(self) -> int: ...
class _SplitResult(NamedTuple):
scheme: str
netloc: str
path: str
query: str
fragment: str
class SplitResult(_SplitResult, ResultMixin):
class SplitResult(
NamedTuple(
'SplitResult',
[
('scheme', str), ('netloc', str), ('path', str), ('query', str), ('fragment', str)
]
),
ResultMixin
):
def geturl(self) -> str: ...
class _ParseResult(NamedTuple):
scheme: str
netloc: str
path: str
params: str
query: str
fragment: str
class ParseResult(_ParseResult, ResultMixin):
class ParseResult(
NamedTuple(
'ParseResult',
[
('scheme', str), ('netloc', str), ('path', str), ('params', str), ('query', str),
('fragment', str)
]
),
ResultMixin
):
def geturl(self) -> str: ...
def urlparse(url: _String, scheme: _String = ...,
+20 -52
View File
@@ -12,7 +12,7 @@ from gzip import GzipFile
_Unmarshaller = Any
_timeTuple = Tuple[int, int, int, int, int, int, int, int, int]
# Represents types that can be compared against a DateTime object
_dateTimeComp = Union[unicode, DateTime, datetime]
_dateTimeComp = Union[AnyStr, DateTime, datetime, _timeTuple]
# A "host description" used by Transport factories
_hostDesc = Union[str, Tuple[str, Mapping[Any, Any]]]
@@ -55,26 +55,26 @@ Boolean: Type[bool]
class DateTime:
value: str
def __init__(self, value: Union[str, unicode, datetime, float, int, _timeTuple, struct_time] = ...) -> None: ...
def make_comparable(self, other: _dateTimeComp) -> Tuple[unicode, unicode]: ...
def make_comparable(self, other: _dateTimeComp) -> Tuple[_dateTimeComp, _dateTimeComp]: ...
def __lt__(self, other: _dateTimeComp) -> bool: ...
def __le__(self, other: _dateTimeComp) -> bool: ...
def __gt__(self, other: _dateTimeComp) -> bool: ...
def __ge__(self, other: _dateTimeComp) -> bool: ...
def __eq__(self, other: _dateTimeComp) -> bool: ... # type: ignore
def __ne__(self, other: _dateTimeComp) -> bool: ... # type: ignore
def __eq__(self, other: _dateTimeComp) -> bool: ...
def __ne__(self, other: _dateTimeComp) -> bool: ...
def timetuple(self) -> struct_time: ...
def __cmp__(self, other: _dateTimeComp) -> int: ...
def decode(self, data: Any) -> None: ...
def encode(self, out: IO[str]) -> None: ...
def encode(self, out: IO) -> None: ...
class Binary:
data: str
def __init__(self, data: Optional[str] = ...) -> None: ...
def __cmp__(self, other: Any) -> int: ...
def decode(self, data: str) -> None: ...
def encode(self, out: IO[str]) -> None: ...
def encode(self, out: IO) -> None: ...
WRAPPERS: Tuple[Type[Any], ...]
WRAPPERS: tuple
# Still part of the public API, but see http://bugs.python.org/issue1773632
FastParser: None
@@ -104,28 +104,7 @@ class Marshaller:
allow_none: bool
def __init__(self, encoding: Optional[str] = ..., allow_none: bool = ...) -> None: ...
dispatch: Mapping[type, Callable[[Marshaller, str, Callable[[str], None]], None]]
def dumps(
self,
values: Union[
Iterable[
Union[
None,
int,
bool,
long,
float,
str,
unicode,
List[Any],
Tuple[Any, ...],
Mapping[Any, Any],
datetime,
InstanceType,
],
],
Fault,
],
) -> str: ...
def dumps(self, values: Union[Iterable[Union[None, int, bool, long, float, str, unicode, List, Tuple, Mapping, datetime, InstanceType]], Fault]) -> str: ...
def dump_nil(self, value: None, write: Callable[[str], None]) -> None: ...
def dump_int(self, value: int, write: Callable[[str], None]) -> None: ...
def dump_bool(self, value: bool, write: Callable[[str], None]) -> None: ...
@@ -133,20 +112,15 @@ class Marshaller:
def dump_double(self, value: float, write: Callable[[str], None]) -> None: ...
def dump_string(self, value: str, write: Callable[[str], None], escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ...) -> None: ...
def dump_unicode(self, value: unicode, write: Callable[[str], None], escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ...) -> None: ...
def dump_array(self, value: Iterable[Any], write: Callable[[str], None]) -> None: ...
def dump_struct(
self,
value: Mapping[unicode, Any],
write: Callable[[str], None],
escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ...,
) -> None: ...
def dump_array(self, value: Union[List, Tuple], write: Callable[[str], None]) -> None: ...
def dump_struct(self, value: Mapping, write: Callable[[str], None], escape: Callable[[AnyStr, Callable[[AnyStr, AnyStr, AnyStr], AnyStr]], AnyStr] = ...) -> None: ...
def dump_datetime(self, value: datetime, write: Callable[[str], None]) -> None: ...
def dump_instance(self, value: InstanceType, write: Callable[[str], None]) -> None: ...
class Unmarshaller:
def append(self, object: Any) -> None: ...
def __init__(self, use_datetime: bool = ...) -> None: ...
def close(self) -> Tuple[Any, ...]: ...
def close(self) -> tuple: ...
def getmethodname(self) -> Optional[str]: ...
def xml(self, encoding: str, standalone: bool) -> None: ...
def start(self, tag: str, attrs: Any) -> None: ...
@@ -169,9 +143,9 @@ class Unmarshaller:
def end_methodName(self, data: str) -> None: ...
class _MultiCallMethod:
def __init__(self, call_list: List[Tuple[str, Tuple[Any, ...]]], name: str) -> None: ...
def __init__(self, call_list: List[Tuple[str, tuple]], name: str) -> None: ...
class MultiCallIterator:
def __init__(self, results: List[Any]) -> None: ...
def __init__(self, results: List) -> None: ...
class MultiCall:
def __init__(self, server: ServerProxy) -> None: ...
@@ -179,25 +153,19 @@ class MultiCall:
def __call__(self) -> MultiCallIterator: ...
def getparser(use_datetime: bool = ...) -> Tuple[Union[ExpatParser, SlowParser], Unmarshaller]: ...
def dumps(
params: Union[Tuple[Any, ...], Fault],
methodname: Optional[str] = ...,
methodresponse: Optional[bool] = ...,
encoding: Optional[str] = ...,
allow_none: bool = ...,
) -> str: ...
def loads(data: str, use_datetime: bool = ...) -> Tuple[Tuple[Any, ...], Optional[str]]: ...
def dumps(params: Union[tuple, Fault], methodname: Optional[str] = ..., methodresponse: Optional[bool] = ..., encoding: Optional[str] = ..., allow_none: bool = ...) -> str: ...
def loads(data: str, use_datetime: bool = ...) -> Tuple[tuple, Optional[str]]: ...
def gzip_encode(data: str) -> str: ...
def gzip_decode(data: str, max_decode: int = ...) -> str: ...
class GzipDecodedResponse(GzipFile):
stringio: StringIO[Any]
stringio: StringIO
def __init__(self, response: HTTPResponse) -> None: ...
def close(self): ...
class _Method:
def __init__(self, send: Callable[[str, Tuple[Any, ...]], Any], name: str) -> None: ...
def __init__(self, send: Callable[[str, tuple], Any], name: str) -> None: ...
def __getattr__(self, name: str) -> _Method: ...
def __call__(self, *args: Any) -> Any: ...
@@ -206,9 +174,9 @@ class Transport:
accept_gzip_encoding: bool
encode_threshold: Optional[int]
def __init__(self, use_datetime: bool = ...) -> None: ...
def request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> Tuple[Any, ...]: ...
def request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> tuple: ...
verbose: bool
def single_request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> Tuple[Any, ...]: ...
def single_request(self, host: _hostDesc, handler: str, request_body: str, verbose: bool = ...) -> tuple: ...
def getparser(self) -> Tuple[Union[ExpatParser, SlowParser], Unmarshaller]: ...
def get_host_info(self, host: _hostDesc) -> Tuple[str, Optional[List[Tuple[str, str]]], Optional[Mapping[Any, Any]]]: ...
def make_connection(self, host: _hostDesc) -> HTTPConnection: ...
@@ -217,7 +185,7 @@ class Transport:
def send_host(self, connection: HTTPConnection, host: str) -> None: ...
def send_user_agent(self, connection: HTTPConnection) -> None: ...
def send_content(self, connection: HTTPConnection, request_body: str) -> None: ...
def parse_response(self, response: HTTPResponse) -> Tuple[Any, ...]: ...
def parse_response(self, response: HTTPResponse) -> tuple: ...
class SafeTransport(Transport):
def __init__(self, use_datetime: bool = ..., context: Optional[SSLContext] = ...) -> None: ...
+1 -2
View File
@@ -4,7 +4,6 @@ from typing import List
class _Feature:
def getOptionalRelease(self) -> sys._version_info: ...
def getMandatoryRelease(self) -> sys._version_info: ...
compiler_flag: int
absolute_import: _Feature
division: _Feature
@@ -22,4 +21,4 @@ if sys.version_info >= (3, 5):
if sys.version_info >= (3, 7):
annotations: _Feature
all_feature_names: List[str] # undocumented
all_feature_names: List[str]
+4 -4
View File
@@ -1,11 +1,11 @@
"""Stub file for the '_bisect' module."""
from typing import Sequence, MutableSequence, TypeVar
from typing import Sequence, TypeVar
_T = TypeVar('_T')
def bisect(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
def bisect_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
def insort(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> None: ...
def insort_left(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> None: ...
def insort_right(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> None: ...
def insort(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> None: ...
def insort_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> None: ...
def insort_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> None: ...
+2 -3
View File
@@ -43,9 +43,8 @@ def raw_unicode_escape_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[
def readbuffer_encode(data: _String, errors: _Errors = ...) -> Tuple[bytes, int]: ...
def unicode_escape_decode(data: _String, errors: _Errors = ...) -> Tuple[Text, int]: ...
def unicode_escape_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
if sys.version_info < (3, 8):
def unicode_internal_decode(data: _String, errors: _Errors = ...) -> Tuple[Text, int]: ...
def unicode_internal_encode(data: _String, errors: _Errors = ...) -> Tuple[bytes, int]: ...
def unicode_internal_decode(data: _String, errors: _Errors = ...) -> Tuple[Text, int]: ...
def unicode_internal_encode(data: _String, errors: _Errors = ...) -> Tuple[bytes, int]: ...
def utf_16_be_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ...
def utf_16_be_encode(data: _Encodable, errors: _Errors = ...) -> Tuple[bytes, int]: ...
def utf_16_decode(data: _Decodable, errors: _Errors = ..., final: int = ...) -> Tuple[Text, int]: ...
+7 -7
View File
@@ -1,15 +1,15 @@
"""Stub file for the '_heapq' module."""
from typing import TypeVar, List, Iterable, Any, Callable, Optional
import sys
from typing import TypeVar, List
_T = TypeVar("_T")
def heapify(heap: List[_T]) -> None: ...
def heappop(heap: List[_T]) -> _T: ...
def heappop(heap: List[_T]) -> _T:
raise IndexError() # if list is empty
def heappush(heap: List[_T], item: _T) -> None: ...
def heappushpop(heap: List[_T], item: _T) -> _T: ...
def heapreplace(heap: List[_T], item: _T) -> _T: ...
if sys.version_info < (3,):
def nlargest(n: int, iterable: Iterable[_T]) -> List[_T]: ...
def nsmallest(n: int, iterable: Iterable[_T]) -> List[_T]: ...
def heapreplace(heap: List[_T], item: _T) -> _T:
raise IndexError() # if list is empty
def nlargest(a: int, b: List[_T]) -> List[_T]: ...
def nsmallest(a: int, b: List[_T]) -> List[_T]: ...
-34
View File
@@ -1,34 +0,0 @@
import sys
from typing import Any, Dict, List, Optional, Tuple, Type, Union, overload
if sys.version_info >= (3, 0):
_defaultaction: str
_onceregistry: Dict[Any, Any]
else:
default_action: str
once_registry: Dict[Any, Any]
filters: List[Tuple[Any, ...]]
@overload
def warn(message: str, category: Optional[Type[Warning]] = ..., stacklevel: int = ...) -> None: ...
@overload
def warn(message: Warning, category: Any = ..., stacklevel: int = ...) -> None: ...
@overload
def warn_explicit(
message: str,
category: Type[Warning],
filename: str,
lineno: int,
module: Optional[str] = ...,
registry: Optional[Dict[Union[str, Tuple[str, Type[Warning], int]], int]] = ...,
module_globals: Optional[Dict[str, Any]] = ...,
) -> None: ...
@overload
def warn_explicit(
message: Warning,
category: Any,
filename: str,
lineno: int,
module: Optional[str] = ...,
registry: Optional[Dict[Union[str, Tuple[str, Type[Warning], int]], int]] = ...,
module_globals: Optional[Dict[str, Any]] = ...,
) -> None: ...
+1 -1
View File
@@ -2,7 +2,7 @@ from typing import Iterator, Any, Iterable, MutableSet, Optional, TypeVar, Gener
_S = TypeVar('_S')
_T = TypeVar('_T')
_SelfT = TypeVar('_SelfT', bound=WeakSet[Any])
_SelfT = TypeVar('_SelfT', bound=WeakSet)
class WeakSet(MutableSet[_T], Generic[_T]):
def __init__(self, data: Optional[Iterable[_T]] = ...) -> None: ...
-85
View File
@@ -1,85 +0,0 @@
from typing import Union, IO, Optional, Type, NamedTuple, List, Tuple, Any, Text, overload
from typing_extensions import Literal
from types import TracebackType
import sys
class Error(Exception): ...
class _aifc_params(NamedTuple):
nchannels: int
sampwidth: int
framerate: int
nframes: int
comptype: bytes
compname: bytes
_File = Union[Text, IO[bytes]]
_Marker = Tuple[int, int, bytes]
class Aifc_read:
def __init__(self, f: _File) -> None: ...
if sys.version_info >= (3, 4):
def __enter__(self) -> Aifc_read: ...
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType]) -> None: ...
def initfp(self, file: IO[bytes]) -> None: ...
def getfp(self) -> IO[bytes]: ...
def rewind(self) -> None: ...
def close(self) -> None: ...
def tell(self) -> int: ...
def getnchannels(self) -> int: ...
def getnframes(self) -> int: ...
def getsampwidth(self) -> int: ...
def getframerate(self) -> int: ...
def getcomptype(self) -> bytes: ...
def getcompname(self) -> bytes: ...
def getparams(self) -> _aifc_params: ...
def getmarkers(self) -> Optional[List[_Marker]]: ...
def getmark(self, id: int) -> _Marker: ...
def setpos(self, pos: int) -> None: ...
def readframes(self, nframes: int) -> bytes: ...
class Aifc_write:
def __init__(self, f: _File) -> None: ...
def __del__(self) -> None: ...
if sys.version_info >= (3, 4):
def __enter__(self) -> Aifc_write: ...
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType]) -> None: ...
def initfp(self, file: IO[bytes]) -> None: ...
def aiff(self) -> None: ...
def aifc(self) -> None: ...
def setnchannels(self, nchannels: int) -> None: ...
def getnchannels(self) -> int: ...
def setsampwidth(self, sampwidth: int) -> None: ...
def getsampwidth(self) -> int: ...
def setframerate(self, framerate: int) -> None: ...
def getframerate(self) -> int: ...
def setnframes(self, nframes: int) -> None: ...
def getnframes(self) -> int: ...
def setcomptype(self, comptype: bytes, compname: bytes) -> None: ...
def getcomptype(self) -> bytes: ...
def getcompname(self) -> bytes: ...
def setparams(self, params: Tuple[int, int, int, int, bytes, bytes]) -> None: ...
def getparams(self) -> _aifc_params: ...
def setmark(self, id: int, pos: int, name: bytes) -> None: ...
def getmark(self, id: int) -> _Marker: ...
def getmarkers(self) -> Optional[List[_Marker]]: ...
def tell(self) -> int: ...
def writeframesraw(self, data: Any) -> None: ... # Actual type for data is Buffer Protocol
def writeframes(self, data: Any) -> None: ...
def close(self) -> None: ...
@overload
def open(f: _File, mode: Literal["r", "rb"] = ...) -> Aifc_read: ...
@overload
def open(f: _File, mode: Literal["w", "wb"]) -> Aifc_write: ...
@overload
def open(f: _File, mode: str) -> Any: ...
@overload
def openfp(f: _File, mode: Literal["r", "rb"] = ...) -> Aifc_read: ...
@overload
def openfp(f: _File, mode: Literal["w", "wb"]) -> Aifc_write: ...
@overload
def openfp(f: _File, mode: str) -> Any: ...
+130 -124
View File
@@ -1,11 +1,13 @@
# Stubs for argparse (Python 2.7 and 3.4)
from typing import (
Any, Callable, Dict, Generator, Iterable, List, IO, NoReturn, Optional,
Pattern, Sequence, Text, Tuple, Type, Union, TypeVar, overload
Pattern, Sequence, Tuple, Type, Union, TypeVar, overload
)
import sys
_T = TypeVar('_T')
_ActionT = TypeVar('_ActionT', bound=Action)
_ActionT = TypeVar('_ActionT', bound='Action')
_N = TypeVar('_N')
if sys.version_info >= (3,):
@@ -44,38 +46,38 @@ class _ActionsContainer:
_negative_number_matcher: Pattern[str]
_has_negative_number_optionals: List[bool]
def __init__(self, description: Optional[Text], prefix_chars: Text,
argument_default: Optional[Text], conflict_handler: Text) -> None: ...
def register(self, registry_name: Text, value: Any, object: Any) -> None: ...
def _registry_get(self, registry_name: Text, value: Any, default: Any = ...) -> Any: ...
def __init__(self, description: Optional[_Text], prefix_chars: _Text,
argument_default: Optional[_Text], conflict_handler: _Text) -> None: ...
def register(self, registry_name: _Text, value: Any, object: Any) -> None: ...
def _registry_get(self, registry_name: _Text, value: Any, default: Any = ...) -> Any: ...
def set_defaults(self, **kwargs: Any) -> None: ...
def get_default(self, dest: Text) -> Any: ...
def get_default(self, dest: _Text) -> Any: ...
def add_argument(self,
*name_or_flags: Text,
action: Union[Text, Type[Action]] = ...,
nargs: Union[int, Text] = ...,
*name_or_flags: _Text,
action: Union[_Text, Type[Action]] = ...,
nargs: Union[int, _Text] = ...,
const: Any = ...,
default: Any = ...,
type: Union[Callable[[Text], _T], Callable[[str], _T], FileType] = ...,
type: Union[Callable[[str], _T], FileType] = ...,
choices: Iterable[_T] = ...,
required: bool = ...,
help: Optional[Text] = ...,
metavar: Optional[Union[Text, Tuple[Text, ...]]] = ...,
dest: Optional[Text] = ...,
version: Text = ...,
help: Optional[_Text] = ...,
metavar: Optional[Union[_Text, Tuple[_Text, ...]]] = ...,
dest: Optional[_Text] = ...,
version: _Text = ...,
**kwargs: Any) -> Action: ...
def add_argument_group(self, *args: Any, **kwargs: Any) -> _ArgumentGroup: ...
def add_mutually_exclusive_group(self, **kwargs: Any) -> _MutuallyExclusiveGroup: ...
def _add_action(self, action: _ActionT) -> _ActionT: ...
def _remove_action(self, action: Action) -> None: ...
def _add_container_actions(self, container: _ActionsContainer) -> None: ...
def _get_positional_kwargs(self, dest: Text, **kwargs: Any) -> Dict[str, Any]: ...
def _get_positional_kwargs(self, dest: _Text, **kwargs: Any) -> Dict[str, Any]: ...
def _get_optional_kwargs(self, *args: Any, **kwargs: Any) -> Dict[str, Any]: ...
def _pop_action_class(self, kwargs: Any, default: Optional[Type[Action]] = ...) -> Type[Action]: ...
def _get_handler(self) -> Callable[[Action, Iterable[Tuple[Text, Action]]], Any]: ...
def _get_handler(self) -> Callable[[Action, Iterable[Tuple[_Text, Action]]], Any]: ...
def _check_conflict(self, action: Action) -> None: ...
def _handle_conflict_error(self, action: Action, conflicting_actions: Iterable[Tuple[Text, Action]]) -> NoReturn: ...
def _handle_conflict_resolve(self, action: Action, conflicting_actions: Iterable[Tuple[Text, Action]]) -> None: ...
def _handle_conflict_error(self, action: Action, conflicting_actions: Iterable[Tuple[_Text, Action]]) -> NoReturn: ...
def _handle_conflict_resolve(self, action: Action, conflicting_actions: Iterable[Tuple[_Text, Action]]) -> None: ...
class ArgumentParser(_AttributeHolder, _ActionsContainer):
prog: _Text
@@ -101,88 +103,88 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
epilog: Optional[str] = ...,
parents: Sequence[ArgumentParser] = ...,
formatter_class: Type[HelpFormatter] = ...,
prefix_chars: str = ...,
prefix_chars: _Text = ...,
fromfile_prefix_chars: Optional[str] = ...,
argument_default: Optional[str] = ...,
conflict_handler: str = ...,
conflict_handler: _Text = ...,
add_help: bool = ...,
allow_abbrev: bool = ...) -> None: ...
else:
def __init__(self,
prog: Optional[Text] = ...,
usage: Optional[Text] = ...,
description: Optional[Text] = ...,
epilog: Optional[Text] = ...,
prog: Optional[_Text] = ...,
usage: Optional[_Text] = ...,
description: Optional[_Text] = ...,
epilog: Optional[_Text] = ...,
parents: Sequence[ArgumentParser] = ...,
formatter_class: Type[HelpFormatter] = ...,
prefix_chars: Text = ...,
fromfile_prefix_chars: Optional[Text] = ...,
argument_default: Optional[Text] = ...,
conflict_handler: Text = ...,
prefix_chars: _Text = ...,
fromfile_prefix_chars: Optional[_Text] = ...,
argument_default: Optional[_Text] = ...,
conflict_handler: _Text = ...,
add_help: bool = ...) -> None: ...
# The type-ignores in these overloads should be temporary. See:
# https://github.com/python/typeshed/pull/2643#issuecomment-442280277
@overload
def parse_args(self, args: Optional[Sequence[Text]] = ...) -> Namespace: ...
def parse_args(self, args: Optional[Sequence[_Text]] = ...) -> Namespace: ...
@overload
def parse_args(self, args: Optional[Sequence[Text]], namespace: None) -> Namespace: ... # type: ignore
def parse_args(self, args: Optional[Sequence[_Text]], namespace: None) -> Namespace: ... # type: ignore
@overload
def parse_args(self, args: Optional[Sequence[Text]], namespace: _N) -> _N: ...
def parse_args(self, args: Optional[Sequence[_Text]], namespace: _N) -> _N: ...
@overload
def parse_args(self, *, namespace: None) -> Namespace: ... # type: ignore
@overload
def parse_args(self, *, namespace: _N) -> _N: ...
if sys.version_info >= (3, 7):
def add_subparsers(self, title: str = ...,
description: Optional[str] = ...,
prog: str = ...,
def add_subparsers(self, title: _Text = ...,
description: Optional[_Text] = ...,
prog: _Text = ...,
parser_class: Type[ArgumentParser] = ...,
action: Type[Action] = ...,
option_string: str = ...,
dest: Optional[str] = ...,
option_string: _Text = ...,
dest: Optional[_Text] = ...,
required: bool = ...,
help: Optional[str] = ...,
metavar: Optional[str] = ...) -> _SubParsersAction: ...
help: Optional[_Text] = ...,
metavar: Optional[_Text] = ...) -> _SubParsersAction: ...
else:
def add_subparsers(self, title: Text = ...,
description: Optional[Text] = ...,
prog: Text = ...,
def add_subparsers(self, title: _Text = ...,
description: Optional[_Text] = ...,
prog: _Text = ...,
parser_class: Type[ArgumentParser] = ...,
action: Type[Action] = ...,
option_string: Text = ...,
dest: Optional[Text] = ...,
help: Optional[Text] = ...,
metavar: Optional[Text] = ...) -> _SubParsersAction: ...
option_string: _Text = ...,
dest: Optional[_Text] = ...,
help: Optional[_Text] = ...,
metavar: Optional[_Text] = ...) -> _SubParsersAction: ...
def print_usage(self, file: Optional[IO[str]] = ...) -> None: ...
def print_help(self, file: Optional[IO[str]] = ...) -> None: ...
def format_usage(self) -> str: ...
def format_help(self) -> str: ...
def parse_known_args(self, args: Optional[Sequence[Text]] = ...,
def parse_known_args(self, args: Optional[Sequence[_Text]] = ...,
namespace: Optional[Namespace] = ...) -> Tuple[Namespace, List[str]]: ...
def convert_arg_line_to_args(self, arg_line: Text) -> List[str]: ...
def exit(self, status: int = ..., message: Optional[Text] = ...) -> NoReturn: ...
def error(self, message: Text) -> NoReturn: ...
def convert_arg_line_to_args(self, arg_line: _Text) -> List[str]: ...
def exit(self, status: int = ..., message: Optional[_Text] = ...) -> NoReturn: ...
def error(self, message: _Text) -> NoReturn: ...
if sys.version_info >= (3, 7):
def parse_intermixed_args(self, args: Optional[Sequence[str]] = ...,
def parse_intermixed_args(self, args: Optional[Sequence[_Text]] = ...,
namespace: Optional[Namespace] = ...) -> Namespace: ...
def parse_known_intermixed_args(self,
args: Optional[Sequence[str]] = ...,
args: Optional[Sequence[_Text]] = ...,
namespace: Optional[Namespace] = ...) -> Tuple[Namespace, List[str]]: ...
# undocumented
def _get_optional_actions(self) -> List[Action]: ...
def _get_positional_actions(self) -> List[Action]: ...
def _parse_known_args(self, arg_strings: List[Text], namespace: Namespace) -> Tuple[Namespace, List[str]]: ...
def _read_args_from_files(self, arg_strings: List[Text]) -> List[Text]: ...
def _match_argument(self, action: Action, arg_strings_pattern: Text) -> int: ...
def _match_arguments_partial(self, actions: Sequence[Action], arg_strings_pattern: Text) -> List[int]: ...
def _parse_optional(self, arg_string: Text) -> Optional[Tuple[Optional[Action], Text, Optional[Text]]]: ...
def _get_option_tuples(self, option_string: Text) -> List[Tuple[Action, Text, Optional[Text]]]: ...
def _parse_known_args(self, arg_strings: List[_Text], namespace: Namespace) -> Tuple[Namespace, List[str]]: ...
def _read_args_from_files(self, arg_strings: List[_Text]) -> List[_Text]: ...
def _match_argument(self, action: Action, arg_strings_pattern: _Text) -> int: ...
def _match_arguments_partial(self, actions: Sequence[Action], arg_strings_pattern: _Text) -> List[int]: ...
def _parse_optional(self, arg_string: _Text) -> Optional[Tuple[Optional[Action], _Text, Optional[_Text]]]: ...
def _get_option_tuples(self, option_string: _Text) -> List[Tuple[Action, _Text, Optional[_Text]]]: ...
def _get_nargs_pattern(self, action: Action) -> _Text: ...
def _get_values(self, action: Action, arg_strings: List[Text]) -> Any: ...
def _get_value(self, action: Action, arg_string: Text) -> Any: ...
def _get_values(self, action: Action, arg_strings: List[_Text]) -> Any: ...
def _get_value(self, action: Action, arg_string: _Text) -> Any: ...
def _check_value(self, action: Action, value: Any) -> None: ...
def _get_formatter(self) -> HelpFormatter: ...
def _print_message(self, message: str, file: Optional[IO[str]] = ...) -> None: ...
@@ -201,31 +203,31 @@ class HelpFormatter:
_whitespace_matcher: Pattern[str]
_long_break_matcher: Pattern[str]
_Section: Type[Any] # Nested class
def __init__(self, prog: Text, indent_increment: int = ...,
def __init__(self, prog: _Text, indent_increment: int = ...,
max_help_position: int = ...,
width: Optional[int] = ...) -> None: ...
def _indent(self) -> None: ...
def _dedent(self) -> None: ...
def _add_item(self, func: Callable[..., _Text], args: Iterable[Any]) -> None: ...
def start_section(self, heading: Optional[Text]) -> None: ...
def start_section(self, heading: Optional[_Text]) -> None: ...
def end_section(self) -> None: ...
def add_text(self, text: Optional[Text]) -> None: ...
def add_usage(self, usage: Text, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: Optional[Text] = ...) -> None: ...
def add_text(self, text: Optional[_Text]) -> None: ...
def add_usage(self, usage: _Text, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: Optional[_Text] = ...) -> None: ...
def add_argument(self, action: Action) -> None: ...
def add_arguments(self, actions: Iterable[Action]) -> None: ...
def format_help(self) -> _Text: ...
def _join_parts(self, part_strings: Iterable[Text]) -> _Text: ...
def _format_usage(self, usage: Text, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: Optional[Text]) -> _Text: ...
def _join_parts(self, part_strings: Iterable[_Text]) -> _Text: ...
def _format_usage(self, usage: _Text, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: Optional[_Text]) -> _Text: ...
def _format_actions_usage(self, actions: Iterable[Action], groups: Iterable[_ArgumentGroup]) -> _Text: ...
def _format_text(self, text: Text) -> _Text: ...
def _format_text(self, text: _Text) -> _Text: ...
def _format_action(self, action: Action) -> _Text: ...
def _format_action_invocation(self, action: Action) -> _Text: ...
def _metavar_formatter(self, action: Action, default_metavar: Text) -> Callable[[int], Tuple[_Text, ...]]: ...
def _format_args(self, action: Action, default_metavar: Text) -> _Text: ...
def _metavar_formatter(self, action: Action, default_metavar: _Text) -> Callable[[int], Tuple[_Text, ...]]: ...
def _format_args(self, action: Action, default_metavar: _Text) -> _Text: ...
def _expand_help(self, action: Action) -> _Text: ...
def _iter_indented_subactions(self, action: Action) -> Generator[Action, None, None]: ...
def _split_lines(self, text: Text, width: int) -> List[_Text]: ...
def _fill_text(self, text: Text, width: int, indent: Text) -> _Text: ...
def _split_lines(self, text: _Text, width: int) -> List[_Text]: ...
def _fill_text(self, text: _Text, width: int, indent: int) -> _Text: ...
def _get_help_string(self, action: Action) -> Optional[_Text]: ...
def _get_default_metavar_for_optional(self, action: Action) -> _Text: ...
def _get_default_metavar_for_positional(self, action: Action) -> _Text: ...
@@ -249,48 +251,52 @@ class Action(_AttributeHolder):
metavar: Optional[Union[_Text, Tuple[_Text, ...]]]
def __init__(self,
option_strings: Sequence[Text],
dest: Text,
nargs: Optional[Union[int, Text]] = ...,
option_strings: Sequence[_Text],
dest: _Text,
nargs: Optional[Union[int, _Text]] = ...,
const: Any = ...,
default: Any = ...,
type: Optional[Union[Callable[[Text], _T], Callable[[str], _T], FileType]] = ...,
type: Optional[Union[Callable[[str], _T], FileType]] = ...,
choices: Optional[Iterable[_T]] = ...,
required: bool = ...,
help: Optional[Text] = ...,
metavar: Optional[Union[Text, Tuple[Text, ...]]] = ...) -> None: ...
help: Optional[_Text] = ...,
metavar: Optional[Union[_Text, Tuple[_Text, ...]]] = ...) -> None: ...
def __call__(self, parser: ArgumentParser, namespace: Namespace,
values: Union[Text, Sequence[Any], None],
option_string: Optional[Text] = ...) -> None: ...
values: Union[_Text, Sequence[Any], None],
option_string: Optional[_Text] = ...) -> None: ...
class Namespace(_AttributeHolder):
def __init__(self, **kwargs: Any) -> None: ...
def __getattr__(self, name: Text) -> Any: ...
def __setattr__(self, name: Text, value: Any) -> None: ...
def __getattr__(self, name: _Text) -> Any: ...
def __setattr__(self, name: _Text, value: Any) -> None: ...
def __contains__(self, key: str) -> bool: ...
class FileType:
# undocumented
_mode: _Text
_bufsize: int
if sys.version_info >= (3,):
_encoding: Optional[str]
_errors: Optional[str]
def __init__(self, mode: str = ..., bufsize: int = ...,
encoding: Optional[str] = ...,
errors: Optional[str] = ...) -> None: ...
if sys.version_info >= (3, 4):
_encoding: Optional[_Text]
_errors: Optional[_Text]
if sys.version_info >= (3, 4):
def __init__(self, mode: _Text = ..., bufsize: int = ...,
encoding: Optional[_Text] = ...,
errors: Optional[_Text] = ...) -> None: ...
elif sys.version_info >= (3,):
def __init__(self,
mode: _Text = ..., bufsize: int = ...) -> None: ...
else:
def __init__(self,
mode: Text = ..., bufsize: Optional[int] = ...) -> None: ...
def __call__(self, string: Text) -> IO[Any]: ...
mode: _Text = ..., bufsize: Optional[int] = ...) -> None: ...
def __call__(self, string: _Text) -> IO[Any]: ...
# undocumented
class _ArgumentGroup(_ActionsContainer):
title: Optional[_Text]
_group_actions: List[Action]
def __init__(self, container: _ActionsContainer,
title: Optional[Text] = ...,
description: Optional[Text] = ..., **kwargs: Any) -> None: ...
title: Optional[_Text] = ...,
description: Optional[_Text] = ..., **kwargs: Any) -> None: ...
# undocumented
class _MutuallyExclusiveGroup(_ArgumentGroup):
@@ -304,31 +310,31 @@ class _StoreAction(Action): ...
# undocumented
class _StoreConstAction(Action):
def __init__(self,
option_strings: Sequence[Text],
dest: Text,
option_strings: Sequence[_Text],
dest: _Text,
const: Any,
default: Any = ...,
required: bool = ...,
help: Optional[Text] = ...,
metavar: Optional[Union[Text, Tuple[Text, ...]]] = ...) -> None: ...
help: Optional[_Text] = ...,
metavar: Optional[Union[_Text, Tuple[_Text, ...]]] = ...) -> None: ...
# undocumented
class _StoreTrueAction(_StoreConstAction):
def __init__(self,
option_strings: Sequence[Text],
dest: Text,
option_strings: Sequence[_Text],
dest: _Text,
default: bool = ...,
required: bool = ...,
help: Optional[Text] = ...) -> None: ...
help: Optional[_Text] = ...) -> None: ...
# undocumented
class _StoreFalseAction(_StoreConstAction):
def __init__(self,
option_strings: Sequence[Text],
dest: Text,
option_strings: Sequence[_Text],
dest: _Text,
default: bool = ...,
required: bool = ...,
help: Optional[Text] = ...) -> None: ...
help: Optional[_Text] = ...) -> None: ...
# undocumented
class _AppendAction(Action): ...
@@ -336,40 +342,40 @@ class _AppendAction(Action): ...
# undocumented
class _AppendConstAction(Action):
def __init__(self,
option_strings: Sequence[Text],
dest: Text,
option_strings: Sequence[_Text],
dest: _Text,
const: Any,
default: Any = ...,
required: bool = ...,
help: Optional[Text] = ...,
metavar: Optional[Union[Text, Tuple[Text, ...]]] = ...) -> None: ...
help: Optional[_Text] = ...,
metavar: Optional[Union[_Text, Tuple[_Text, ...]]] = ...) -> None: ...
# undocumented
class _CountAction(Action):
def __init__(self,
option_strings: Sequence[Text],
dest: Text,
option_strings: Sequence[_Text],
dest: _Text,
default: Any = ...,
required: bool = ...,
help: Optional[Text] = ...) -> None: ...
help: Optional[_Text] = ...) -> None: ...
# undocumented
class _HelpAction(Action):
def __init__(self,
option_strings: Sequence[Text],
dest: Text = ...,
default: Text = ...,
help: Optional[Text] = ...) -> None: ...
option_strings: Sequence[_Text],
dest: _Text = ...,
default: _Text = ...,
help: Optional[_Text] = ...) -> None: ...
# undocumented
class _VersionAction(Action):
version: Optional[_Text]
def __init__(self,
option_strings: Sequence[Text],
version: Optional[Text] = ...,
dest: Text = ...,
default: Text = ...,
help: Text = ...) -> None: ...
option_strings: Sequence[_Text],
version: Optional[_Text] = ...,
dest: _Text = ...,
default: _Text = ...,
help: _Text = ...) -> None: ...
# undocumented
class _SubParsersAction(Action):
@@ -380,15 +386,15 @@ class _SubParsersAction(Action):
choices: Dict[_Text, ArgumentParser]
_choices_actions: List[Action]
def __init__(self,
option_strings: Sequence[Text],
prog: Text,
option_strings: Sequence[_Text],
prog: _Text,
parser_class: Type[ArgumentParser],
dest: Text = ...,
dest: _Text = ...,
required: bool = ...,
help: Optional[Text] = ...,
metavar: Optional[Union[Text, Tuple[Text, ...]]] = ...) -> None: ...
help: Optional[_Text] = ...,
metavar: Optional[Union[_Text, Tuple[_Text, ...]]] = ...) -> None: ...
# TODO: Type keyword args properly.
def add_parser(self, name: Text, **kwargs: Any) -> ArgumentParser: ...
def add_parser(self, name: _Text, **kwargs: Any) -> ArgumentParser: ...
def _get_subactions(self) -> List[Action]: ...
# undocumented
@@ -396,7 +402,7 @@ class ArgumentTypeError(Exception): ...
if sys.version_info < (3, 7):
# undocumented
def _ensure_value(namespace: Namespace, name: Text, value: Any) -> Any: ...
def _ensure_value(namespace: Namespace, name: _Text, value: Any) -> Any: ...
# undocumented
def _get_action_name(argument: Optional[Action]) -> Optional[str]: ...
+4 -5
View File
@@ -13,9 +13,8 @@ from errno import (EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, EINVAL,
EPIPE, EAGAIN, errorcode)
# cyclic dependence with asynchat
_maptype = Dict[int, Any]
_maptype = Dict[str, Any]
socket_map: _maptype = ... # Undocumented
class ExitNow(Exception): ...
@@ -51,8 +50,8 @@ class dispatcher:
def readable(self) -> bool: ...
def writable(self) -> bool: ...
def listen(self, backlog: int) -> None: ...
def bind(self, address: Union[Tuple[Any, ...], str]) -> None: ...
def connect(self, address: Union[Tuple[Any, ...], str]) -> None: ...
def bind(self, address: Union[tuple, str]) -> None: ...
def connect(self, address: Union[tuple, str]) -> None: ...
def accept(self) -> Optional[Tuple[SocketType, Any]]: ...
def send(self, data: bytes) -> int: ...
def recv(self, buffer_size: int) -> bytes: ...
@@ -104,7 +103,7 @@ class dispatcher:
def recvfrom_into(self, buffer: bytes, nbytes: int, flags: int = ...) -> Any: ...
def recv_into(self, buffer: bytes, nbytes: int, flags: int = ...) -> Any: ...
def sendall(self, data: bytes, flags: int = ...) -> None: ...
def sendto(self, data: bytes, address: Union[Tuple[str, int], str], flags: int = ...) -> int: ...
def sendto(self, data: bytes, address: Union[tuple, str], flags: int = ...) -> int: ...
def setblocking(self, flag: bool) -> None: ...
def settimeout(self, value: Union[float, None]) -> None: ...
def setsockopt(self, level: int, optname: int, value: Union[int, bytes]) -> None: ...
-42
View File
@@ -1,42 +0,0 @@
from typing import Any, Optional, Tuple
AdpcmState = Tuple[int, int]
RatecvState = Tuple[int, Tuple[Tuple[int, int], ...]]
class error(Exception): ...
def add(fragment1: bytes, fragment2: bytes, width: int) -> bytes: ...
def adpcm2lin(adpcmfragment: bytes, width: int, state: Optional[AdpcmState]) -> Tuple[bytes, AdpcmState]: ...
def alaw2lin(fragment: bytes, width: int) -> bytes: ...
def avg(fragment: bytes, width: int) -> int: ...
def avgpp(fragment: bytes, width: int) -> int: ...
def bias(fragment: bytes, width: int, bias: int) -> bytes: ...
def byteswap(fragment: bytes, width: int) -> bytes: ...
def cross(fragment: bytes, width: int) -> int: ...
def findfactor(fragment: bytes, reference: bytes) -> float: ...
def findfit(fragment: bytes, reference: bytes) -> Tuple[int, float]: ...
def findmax(fragment: bytes, length: int) -> int: ...
def getsample(fragment: bytes, width: int, index: int) -> int: ...
def lin2adpcm(fragment: bytes, width: int, state: Optional[AdpcmState]) -> Tuple[bytes, AdpcmState]: ...
def lin2alaw(fragment: bytes, width: int) -> bytes: ...
def lin2lin(fragment: bytes, width: int, newwidth: int) -> bytes: ...
def lin2ulaw(fragment: bytes, width: int) -> bytes: ...
def max(fragment: bytes, width: int) -> int: ...
def maxpp(fragment: bytes, width: int) -> int: ...
def minmax(fragment: bytes, width: int) -> Tuple[int, int]: ...
def mul(fragment: bytes, width: int, factor: float) -> bytes: ...
def ratecv(
fragment: bytes,
width: int,
nchannels: int,
inrate: int,
outrate: int,
state: Optional[RatecvState],
weightA: int = ...,
weightB: int = ...,
) -> Tuple[bytes, RatecvState]: ...
def reverse(fragment: bytes, width: int) -> bytes: ...
def rms(fragment: bytes, width: int) -> int: ...
def tomono(fragment: bytes, width: int, lfactor: float, rfactor: float) -> bytes: ...
def tostereo(fragment: bytes, width: int, lfactor: float, rfactor: float) -> bytes: ...
def ulaw2lin(fragment: bytes, width: int) -> bytes: ...
-94
View File
@@ -1,94 +0,0 @@
from typing import Set, Dict, Iterable, Any, Callable, Tuple, Type, SupportsInt, List, Union, TypeVar, Optional, IO
from types import FrameType, TracebackType, CodeType
_T = TypeVar("_T")
_TraceDispatch = Callable[[FrameType, str, Any], Any] # TODO: Recursive type
_ExcInfo = Tuple[Type[BaseException], BaseException, FrameType]
GENERATOR_AND_COROUTINE_FLAGS: int = ...
class BdbQuit(Exception): ...
class Bdb:
skip: Optional[Set[str]]
breaks: Dict[str, List[int]]
fncache: Dict[str, str]
frame_returning: Optional[FrameType]
botframe: Optional[FrameType]
quitting: bool
stopframe: Optional[FrameType]
returnframe: Optional[FrameType]
stoplineno: int
def __init__(self, skip: Iterable[str] = ...) -> None: ...
def canonic(self, filename: str) -> str: ...
def reset(self) -> None: ...
def trace_dispatch(self, frame: FrameType, event: str, arg: Any) -> _TraceDispatch: ...
def dispatch_line(self, frame: FrameType) -> _TraceDispatch: ...
def dispatch_call(self, frame: FrameType, arg: None) -> _TraceDispatch: ...
def dispatch_return(self, frame: FrameType, arg: Any) -> _TraceDispatch: ...
def dispatch_exception(self, frame: FrameType, arg: _ExcInfo) -> _TraceDispatch: ...
def is_skipped_module(self, module_name: str) -> bool: ...
def stop_here(self, frame: FrameType) -> bool: ...
def break_here(self, frame: FrameType) -> bool: ...
def do_clear(self, arg: Any) -> None: ...
def break_anywhere(self, frame: FrameType) -> bool: ...
def user_call(self, frame: FrameType, argument_list: None) -> None: ...
def user_line(self, frame: FrameType) -> None: ...
def user_return(self, frame: FrameType, return_value: Any) -> None: ...
def user_exception(self, frame: FrameType, exc_info: _ExcInfo) -> None: ...
def set_until(self, frame: FrameType, lineno: Optional[int] = ...) -> None: ...
def set_step(self) -> None: ...
def set_next(self, frame: FrameType) -> None: ...
def set_return(self, frame: FrameType) -> None: ...
def set_trace(self, frame: Optional[FrameType] = ...) -> None: ...
def set_continue(self) -> None: ...
def set_quit(self) -> None: ...
def set_break(self, filename: str, lineno: int, temporary: bool = ..., cond: Optional[str] = ..., funcname: Optional[str] = ...) -> None: ...
def clear_break(self, filename: str, lineno: int) -> None: ...
def clear_bpbynumber(self, arg: SupportsInt) -> None: ...
def clear_all_file_breaks(self, filename: str) -> None: ...
def clear_all_breaks(self) -> None: ...
def get_bpbynumber(self, arg: SupportsInt) -> Breakpoint: ...
def get_break(self, filename: str, lineno: int) -> bool: ...
def get_breaks(self, filename: str, lineno: int) -> List[Breakpoint]: ...
def get_file_breaks(self, filename: str) -> List[Breakpoint]: ...
def get_all_breaks(self) -> List[Breakpoint]: ...
def get_stack(self, f: FrameType, t: TracebackType) -> Tuple[List[Tuple[FrameType, int]], int]: ...
def format_stack_entry(self, frame_lineno: int, lprefix: str = ...) -> str: ...
def run(self, cmd: Union[str, CodeType], globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ...) -> None: ...
def runeval(self, expr: str, globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ...) -> None: ...
def runctx(self, cmd: Union[str, CodeType], globals: Dict[str, Any], locals: Dict[str, Any]) -> None: ...
def runcall(self, func: Callable[[Any], _T], *args: Any, **kwds: Any) -> Optional[_T]: ...
class Breakpoint:
next: int = ...
bplist: Dict[Tuple[str, int], List[Breakpoint]] = ...
bpbynumber: List[Optional[Breakpoint]] = ...
funcname: Optional[str]
func_first_executable_line: Optional[int]
file: str
line: int
temporary: bool
cond: Optional[str]
enabled: bool
ignore: int
hits: int
number: int
def __init__(self, file: str, line: int, temporary: bool = ..., cond: Optional[str] = ..., funcname: Optional[str] = ...) -> None: ...
def deleteMe(self) -> None: ...
def enable(self) -> None: ...
def disable(self) -> None: ...
def bpprint(self, out: Optional[IO[str]] = ...) -> None: ...
def bpformat(self) -> str: ...
def __str__(self) -> str: ...
def checkfuncname(b: Breakpoint, frame: FrameType) -> bool: ...
def effective(file: str, line: int, frame: FrameType) -> Union[Tuple[Breakpoint, bool], Tuple[None, None]]: ...
def set_trace() -> None: ...
+8 -3
View File
@@ -5,15 +5,20 @@
import sys
from typing import Union, Text
if sys.version_info < (3,):
# Python 2 accepts unicode ascii pretty much everywhere.
_Bytes = Text
_Ascii = Text
_Bytes = Union[bytes, Text]
_Ascii = Union[bytes, Text]
elif sys.version_info < (3, 3):
# Python 3.2 and below only accepts bytes.
_Bytes = bytes
_Ascii = bytes
else:
# But since Python 3.3 ASCII-only unicode strings are accepted by the
# a2b_* functions.
_Bytes = bytes
_Ascii = Union[bytes, str]
_Ascii = Union[bytes, Text]
def a2b_uu(string: _Ascii) -> bytes: ...
if sys.version_info >= (3, 7):
+16 -7
View File
@@ -1,13 +1,22 @@
# Stubs for bisect
from typing import Any, Sequence, MutableSequence, TypeVar
from typing import Any, Sequence, TypeVar
_T = TypeVar('_T')
def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
def bisect_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
def bisect(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
# TODO uncomment when mypy# 2035 is fixed
# def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
# def bisect_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
# def bisect(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
#
# def insort_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
# def insort_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
# def insort(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
def insort_left(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
def insort_right(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
def insort(a: MutableSequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
def bisect_left(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
def bisect_right(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
def bisect(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
def insort_left(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
def insort_right(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
def insort(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
+58 -86
View File
@@ -17,11 +17,6 @@ import sys
if sys.version_info >= (3,):
from typing import SupportsBytes, SupportsRound
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal
_T = TypeVar('_T')
_T_co = TypeVar('_T_co', covariant=True)
_KT = TypeVar('_KT')
@@ -34,9 +29,6 @@ _T4 = TypeVar('_T4')
_T5 = TypeVar('_T5')
_TT = TypeVar('_TT', bound='type')
class _SupportsIndex(Protocol):
def __index__(self) -> int: ...
class object:
__doc__: Optional[str]
__dict__: Dict[str, Any]
@@ -61,30 +53,30 @@ class object:
def __getattribute__(self, name: str) -> Any: ...
def __delattr__(self, name: str) -> None: ...
def __sizeof__(self) -> int: ...
def __reduce__(self) -> Union[str, Tuple[Any, ...]]: ...
def __reduce_ex__(self, protocol: int) -> Union[str, Tuple[Any, ...]]: ...
def __reduce__(self) -> tuple: ...
def __reduce_ex__(self, protocol: int) -> tuple: ...
if sys.version_info >= (3,):
def __dir__(self) -> Iterable[str]: ...
if sys.version_info >= (3, 6):
def __init_subclass__(cls) -> None: ...
class staticmethod(object): # Special, only valid as a decorator.
__func__: Callable[..., Any]
__func__: Callable
if sys.version_info >= (3,):
__isabstractmethod__: bool
def __init__(self, f: Callable[..., Any]) -> None: ...
def __init__(self, f: Callable) -> None: ...
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
class classmethod(object): # Special, only valid as a decorator.
__func__: Callable[..., Any]
__func__: Callable
if sys.version_info >= (3,):
__isabstractmethod__: bool
def __init__(self, f: Callable[..., Any]) -> None: ...
def __init__(self, f: Callable) -> None: ...
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable: ...
class type(object):
__base__: type
@@ -137,12 +129,10 @@ class super(object):
class int:
@overload
def __init__(self, x: Union[Text, bytes, SupportsInt, _SupportsIndex] = ...) -> None: ...
def __init__(self, x: Union[Text, bytes, SupportsInt] = ...) -> None: ...
@overload
def __init__(self, x: Union[Text, bytes, bytearray], base: int) -> None: ...
if sys.version_info >= (3, 8):
def as_integer_ratio(self) -> Tuple[int, Literal[1]]: ...
@property
def real(self) -> int: ...
@property
@@ -178,7 +168,7 @@ class int:
def __rtruediv__(self, x: int) -> float: ...
def __rmod__(self, x: int) -> int: ...
def __rdivmod__(self, x: int) -> Tuple[int, int]: ...
def __pow__(self, __x: int, __modulo: Optional[int] = ...) -> Any: ... # Return type can be int or float, depending on x.
def __pow__(self, x: int) -> Any: ... # Return type can be int or float, depending on x.
def __rpow__(self, x: int) -> Any: ...
def __and__(self, n: int) -> int: ...
def __or__(self, n: int) -> int: ...
@@ -193,10 +183,7 @@ class int:
def __neg__(self) -> int: ...
def __pos__(self) -> int: ...
def __invert__(self) -> int: ...
def __trunc__(self) -> int: ...
if sys.version_info >= (3,):
def __ceil__(self) -> int: ...
def __floor__(self) -> int: ...
def __round__(self, ndigits: Optional[int] = ...) -> int: ...
def __getnewargs__(self) -> Tuple[int]: ...
@@ -219,7 +206,7 @@ class int:
def __index__(self) -> int: ...
class float:
def __init__(self, x: Union[SupportsFloat, _SupportsIndex, Text, bytes, bytearray] = ...) -> None: ...
def __init__(self, x: Union[SupportsFloat, Text, bytes, bytearray] = ...) -> None: ...
def as_integer_ratio(self) -> Tuple[int, int]: ...
def hex(self) -> str: ...
def is_integer(self) -> bool: ...
@@ -253,10 +240,11 @@ class float:
def __rdivmod__(self, x: float) -> Tuple[float, float]: ...
def __rpow__(self, x: float) -> float: ...
def __getnewargs__(self) -> Tuple[float]: ...
def __trunc__(self) -> int: ...
if sys.version_info >= (3,):
@overload
def __round__(self, ndigits: None = ...) -> int: ...
def __round__(self) -> int: ...
@overload
def __round__(self, ndigits: None) -> int: ...
@overload
def __round__(self, ndigits: int) -> float: ...
@@ -281,9 +269,11 @@ class float:
class complex:
@overload
def __init__(self, real: float = ..., imag: float = ...) -> None: ...
def __init__(self, re: float = ..., im: float = ...) -> None: ...
@overload
def __init__(self, real: Union[str, SupportsComplex, _SupportsIndex]) -> None: ...
def __init__(self, s: str) -> None: ...
@overload
def __init__(self, s: SupportsComplex) -> None: ...
@property
def real(self) -> float: ...
@@ -342,7 +332,7 @@ else:
end: int = ...) -> bool: ...
def expandtabs(self, tabsize: int = ...) -> unicode: ...
def find(self, sub: unicode, start: int = ..., end: int = ...) -> int: ...
def format(self, *args: object, **kwargs: object) -> unicode: ...
def format(self, *args: Any, **kwargs: Any) -> unicode: ...
def index(self, sub: unicode, start: int = ..., end: int = ...) -> int: ...
def isalnum(self) -> bool: ...
def isalpha(self) -> bool: ...
@@ -431,7 +421,7 @@ class str(Sequence[str], _str_base):
def endswith(self, suffix: Union[Text, Tuple[Text, ...]]) -> bool: ...
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(self, *args: Any, **kwargs: Any) -> str: ...
if sys.version_info >= (3,):
def format_map(self, map: Mapping[str, Any]) -> str: ...
def index(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ...
@@ -677,8 +667,6 @@ class bytearray(MutableSequence[int], ByteString):
def decode(self, encoding: Text = ..., errors: Text = ...) -> str: ...
def endswith(self, suffix: Union[bytes, Tuple[bytes, ...]]) -> bool: ...
def expandtabs(self, tabsize: int = ...) -> bytearray: ...
if sys.version_info < (3,):
def extend(self, iterable: Union[str, Iterable[int]]) -> None: ...
if sys.version_info >= (3,):
def find(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ...
if sys.version_info >= (3, 5):
@@ -746,7 +734,7 @@ class bytearray(MutableSequence[int], ByteString):
def __repr__(self) -> str: ...
def __int__(self) -> int: ...
def __float__(self) -> float: ...
__hash__: None # type: ignore
def __hash__(self) -> int: ...
@overload
def __getitem__(self, i: int) -> int: ...
@overload
@@ -796,10 +784,9 @@ class memoryview(Sized, Container[_mv_container_type]):
c_contiguous: bool
f_contiguous: bool
contiguous: bool
nbytes: int
def __init__(self, obj: Union[bytes, bytearray, memoryview]) -> None: ...
def __enter__(self) -> memoryview: ...
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> None: ...
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> bool: ...
else:
def __init__(self, obj: Union[bytes, bytearray, buffer, memoryview]) -> None: ...
@@ -812,19 +799,16 @@ class memoryview(Sized, Container[_mv_container_type]):
def __iter__(self) -> Iterator[_mv_container_type]: ...
def __len__(self) -> int: ...
@overload
def __setitem__(self, s: slice, o: memoryview) -> None: ...
@overload
def __setitem__(self, i: int, o: bytes) -> None: ...
@overload
def __setitem__(self, s: slice, o: Sequence[bytes]) -> None: ...
@overload
def __setitem__(self, s: slice, o: memoryview) -> None: ...
def tobytes(self) -> bytes: ...
def tolist(self) -> List[int]: ...
if sys.version_info >= (3, 2):
def release(self) -> None: ...
if sys.version_info >= (3, 5):
def hex(self) -> str: ...
@@ -857,14 +841,13 @@ class bool(int):
def __getnewargs__(self) -> Tuple[int]: ...
class slice(object):
start: Any
step: Any
stop: Any
start: Optional[int]
step: Optional[int]
stop: Optional[int]
@overload
def __init__(self, stop: Any) -> None: ...
def __init__(self, stop: Optional[int]) -> None: ...
@overload
def __init__(self, start: Any, stop: Any, step: Any = ...) -> None: ...
__hash__: None # type: ignore
def __init__(self, start: Optional[int], stop: Optional[int], step: Optional[int] = ...) -> None: ...
def indices(self, len: int) -> Tuple[int, int, int]: ...
class tuple(Sequence[_T_co], Generic[_T_co]):
@@ -881,10 +864,7 @@ class tuple(Sequence[_T_co], Generic[_T_co]):
def __le__(self, x: Tuple[_T_co, ...]) -> bool: ...
def __gt__(self, x: Tuple[_T_co, ...]) -> bool: ...
def __ge__(self, x: Tuple[_T_co, ...]) -> bool: ...
@overload
def __add__(self, x: Tuple[_T_co, ...]) -> Tuple[_T_co, ...]: ...
@overload
def __add__(self, x: Tuple[Any, ...]) -> Tuple[Any, ...]: ...
def __mul__(self, n: int) -> Tuple[_T_co, ...]: ...
def __rmul__(self, n: int) -> Tuple[_T_co, ...]: ...
def count(self, x: Any) -> int: ...
@@ -917,7 +897,7 @@ class list(MutableSequence[_T], Generic[_T]):
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_T]: ...
def __str__(self) -> str: ...
__hash__: None # type: ignore
def __hash__(self) -> int: ...
@overload
def __getitem__(self, i: int) -> _T: ...
@overload
@@ -990,10 +970,7 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def __setitem__(self, k: _KT, v: _VT) -> None: ...
def __delitem__(self, v: _KT) -> None: ...
def __iter__(self) -> Iterator[_KT]: ...
if sys.version_info >= (3, 8):
def __reversed__(self) -> Iterator[_KT]: ...
def __str__(self) -> str: ...
__hash__: None # type: ignore
class set(MutableSet[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
@@ -1030,7 +1007,6 @@ class set(MutableSet[_T], Generic[_T]):
def __lt__(self, s: AbstractSet[object]) -> bool: ...
def __ge__(self, s: AbstractSet[object]) -> bool: ...
def __gt__(self, s: AbstractSet[object]) -> bool: ...
__hash__: None # type: ignore
class frozenset(AbstractSet[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
@@ -1122,6 +1098,8 @@ if sys.version_info < (3,):
if sys.version_info >= (3,):
def ascii(__o: object) -> str: ...
class _SupportsIndex(Protocol):
def __index__(self) -> int: ...
def bin(__number: Union[int, _SupportsIndex]) -> str: ...
if sys.version_info >= (3, 7):
@@ -1138,7 +1116,7 @@ if sys.version_info >= (3, 6):
# See https://github.com/python/typeshed/pull/991#issuecomment-288160993
class _PathLike(Generic[AnyStr]):
def __fspath__(self) -> AnyStr: ...
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes, _PathLike[Any]], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes, _PathLike], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
elif sys.version_info >= (3,):
def compile(source: Union[str, bytes, mod, AST], filename: Union[str, bytes], mode: str, flags: int = ..., dont_inherit: int = ..., optimize: int = ...) -> Any: ...
else:
@@ -1163,15 +1141,20 @@ if sys.version_info >= (3,):
def filter(__function: Callable[[_T], Any], __iterable: Iterable[_T]) -> Iterator[_T]: ...
else:
@overload
def filter(__function: Callable[[AnyStr], Any], __iterable: AnyStr) -> AnyStr: ... # type: ignore
def filter(__function: Callable[[AnyStr], Any], # type: ignore
__iterable: AnyStr) -> AnyStr: ...
@overload
def filter(__function: None, __iterable: Tuple[Optional[_T], ...]) -> Tuple[_T, ...]: ... # type: ignore
def filter(__function: None, # type: ignore
__iterable: Tuple[Optional[_T], ...]) -> Tuple[_T, ...]: ...
@overload
def filter(__function: Callable[[_T], Any], __iterable: Tuple[_T, ...]) -> Tuple[_T, ...]: ... # type: ignore
def filter(__function: Callable[[_T], Any], # type: ignore
__iterable: Tuple[_T, ...]) -> Tuple[_T, ...]: ...
@overload
def filter(__function: None, __iterable: Iterable[Optional[_T]]) -> List[_T]: ...
def filter(__function: None,
__iterable: Iterable[Optional[_T]]) -> List[_T]: ...
@overload
def filter(__function: Callable[[_T], Any], __iterable: Iterable[_T]) -> List[_T]: ...
def filter(__function: Callable[[_T], Any],
__iterable: Iterable[_T]) -> List[_T]: ...
def format(__o: object, __format_spec: str = ...) -> str: ... # TODO unicode
def getattr(__o: Any, name: Text, __default: Any = ...) -> Any: ...
def globals() -> Dict[str, Any]: ...
@@ -1189,11 +1172,9 @@ else:
@overload
def iter(__iterable: Iterable[_T]) -> Iterator[_T]: ...
@overload
def iter(__function: Callable[[], Optional[_T]], __sentinel: None) -> Iterator[_T]: ...
@overload
def iter(__function: Callable[[], _T], __sentinel: Any) -> Iterator[_T]: ...
def isinstance(__o: object, __t: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
def issubclass(__cls: type, __classinfo: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
def iter(__function: Callable[[], _T], __sentinel: _T) -> Iterator[_T]: ...
def isinstance(__o: object, __t: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ...
def issubclass(__cls: type, __classinfo: Union[type, Tuple[Union[type, Tuple], ...]]) -> bool: ...
def len(__o: Sized) -> int: ...
if sys.version_info >= (3,):
def license() -> None: ...
@@ -1329,7 +1310,7 @@ def next(__i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...
def oct(__i: 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] = ...,
def open(file: Union[str, bytes, int, _PathLike], mode: str = ..., buffering: int = ..., encoding: Optional[str] = ...,
errors: Optional[str] = ..., newline: Optional[str] = ..., closefd: bool = ...,
opener: Optional[Callable[[str, int], int]] = ...) -> IO[Any]: ...
elif sys.version_info >= (3,):
@@ -1343,16 +1324,12 @@ def ord(__c: Union[Text, bytes]) -> int: ...
if sys.version_info >= (3,):
class _Writer(Protocol):
def write(self, __s: str) -> Any: ...
def print(
*values: object, sep: Optional[Text] = ..., end: Optional[Text] = ..., file: Optional[_Writer] = ..., flush: bool = ...
) -> None: ...
def print(*values: object, sep: Text = ..., end: Text = ..., file: Optional[_Writer] = ..., flush: bool = ...) -> None: ...
else:
class _Writer(Protocol):
def write(self, __s: Any) -> Any: ...
# This is only available after from __future__ import print_function.
def print(*values: object, sep: Optional[Text] = ..., end: Optional[Text] = ..., file: Optional[_Writer] = ...) -> None: ...
def print(*values: object, sep: Text = ..., end: Text = ..., file: Optional[_Writer] = ...) -> None: ...
@overload
def pow(__x: int, __y: int) -> Any: ... # The return type can be int or float, depending on y
@overload
@@ -1385,7 +1362,7 @@ if sys.version_info >= (3,):
@overload
def round(number: SupportsRound[_T]) -> int: ...
@overload
def round(number: SupportsRound[_T], ndigits: None) -> int: ...
def round(number: SupportsRound[_T], ndigits: None) -> int: ... # type: ignore
@overload
def round(number: SupportsRound[_T], ndigits: int) -> _T: ...
else:
@@ -1405,7 +1382,7 @@ if sys.version_info >= (3,):
else:
def sorted(__iterable: Iterable[_T], *,
cmp: Callable[[_T, _T], int] = ...,
key: Optional[Callable[[_T], Any]] = ...,
key: Callable[[_T], Any] = ...,
reverse: bool = ...) -> List[_T]: ...
@overload
def sum(__iterable: Iterable[_T]) -> Union[_T, int]: ...
@@ -1451,10 +1428,8 @@ else:
def zip(__iter1: Iterable[Any], __iter2: Iterable[Any], __iter3: Iterable[Any],
__iter4: Iterable[Any], __iter5: Iterable[Any], __iter6: Iterable[Any],
*iterables: Iterable[Any]) -> List[Tuple[Any, ...]]: ...
def __import__(name: Text, globals: Optional[Mapping[str, Any]] = ...,
locals: Optional[Mapping[str, Any]] = ...,
fromlist: Sequence[str] = ...,
level: int = ...) -> Any: ...
def __import__(name: Text, globals: Dict[str, Any] = ..., locals: Dict[str, Any] = ...,
fromlist: List[str] = ..., level: int = ...) -> Any: ...
# Actually the type of Ellipsis is <type 'ellipsis'>, but since it's
# not exposed anywhere under that name, we make it private here.
@@ -1484,8 +1459,6 @@ class BaseException(object):
__suppress_context__: bool
__traceback__: Optional[TracebackType]
def __init__(self, *args: object) -> None: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
if sys.version_info < (3,):
def __getitem__(self, i: int) -> Any: ...
def __getslice__(self, start: int, stop: int) -> Tuple[Any, ...]: ...
@@ -1527,10 +1500,9 @@ class AttributeError(_StandardError): ...
class BufferError(_StandardError): ...
class EOFError(_StandardError): ...
class ImportError(_StandardError):
if sys.version_info >= (3, 3):
def __init__(self, *args, name: Optional[str] = ..., path: Optional[str] = ...) -> None: ...
name: Optional[str]
path: Optional[str]
if sys.version_info >= (3,):
name: str
path: str
class LookupError(_StandardError): ...
class MemoryError(_StandardError): ...
class NameError(_StandardError): ...
@@ -1543,7 +1515,7 @@ class SyntaxError(_StandardError):
msg: str
lineno: int
offset: Optional[int]
text: Optional[str]
text: str
filename: str
class SystemError(_StandardError): ...
class TypeError(_StandardError): ...
@@ -1632,7 +1604,7 @@ if sys.version_info < (3,):
def next(self) -> str: ...
def read(self, n: int = ...) -> str: ...
def __enter__(self) -> BinaryIO: ...
def __exit__(self, t: Optional[type] = ..., exc: Optional[BaseException] = ..., tb: Optional[Any] = ...) -> Optional[bool]: ...
def __exit__(self, t: Optional[type] = ..., exc: Optional[BaseException] = ..., tb: Optional[Any] = ...) -> bool: ...
def flush(self) -> None: ...
def fileno(self) -> int: ...
def isatty(self) -> bool: ...
+1 -4
View File
@@ -5,7 +5,7 @@ from typing import Any, Callable, Dict, Optional, Text, TypeVar, Union
def run(statement: str, filename: Optional[str] = ..., sort: Union[str, int] = ...) -> None: ...
def runctx(statement: str, globals: Dict[str, Any], locals: Dict[str, Any], filename: Optional[str] = ..., sort: Union[str, int] = ...) -> None: ...
_SelfT = TypeVar('_SelfT', bound=Profile)
_SelfT = TypeVar('_SelfT', bound='Profile')
_T = TypeVar('_T')
if sys.version_info >= (3, 6):
_Path = Union[bytes, Text, os.PathLike[Any]]
@@ -22,6 +22,3 @@ class Profile:
def run(self: _SelfT, cmd: str) -> _SelfT: ...
def runctx(self: _SelfT, cmd: str, globals: Dict[str, Any], locals: Dict[str, Any]) -> _SelfT: ...
def runcall(self, func: Callable[..., _T], *args: Any, **kw: Any) -> _T: ...
if sys.version_info >= (3, 8):
def __enter__(self: _SelfT) -> _SelfT: ...
def __exit__(self, *exc_info: Any) -> None: ...
+7 -7
View File
@@ -5,9 +5,8 @@ _T = TypeVar('_T', bound=FieldStorage)
def parse(fp: IO[Any] = ..., environ: Mapping[str, str] = ...,
keep_blank_values: bool = ..., strict_parsing: bool = ...) -> Dict[str, List[str]]: ...
if sys.version_info < (3, 8):
def parse_qs(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> Dict[str, List[str]]: ...
def parse_qsl(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> Dict[str, List[str]]: ...
def parse_qs(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> Dict[str, List[str]]: ...
def parse_qsl(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> Dict[str, List[str]]: ...
if sys.version_info >= (3, 7):
def parse_multipart(fp: IO[Any], pdict: Mapping[str, bytes], encoding: str = ..., errors: str = ...) -> Dict[str, List[Any]]: ...
else:
@@ -18,10 +17,11 @@ def print_environ(environ: Mapping[str, str] = ...) -> None: ...
def print_form(form: Dict[str, Any]) -> None: ...
def print_directory() -> None: ...
def print_environ_usage() -> None: ...
if sys.version_info < (3,):
def escape(s: AnyStr, quote: bool = ...) -> AnyStr: ...
elif sys.version_info < (3, 8):
if sys.version_info >= (3, 0):
def escape(s: str, quote: bool = ...) -> str: ...
else:
def escape(s: AnyStr, quote: bool = ...) -> AnyStr: ...
class MiniFieldStorage:
# The first five "Any" attributes here are always None, but mypy doesn't support that
@@ -101,7 +101,7 @@ class FieldStorage(object):
if sys.version_info < (3, 0):
from UserDict import UserDict
class FormContentDict(UserDict[str, List[str]]):
class FormContentDict(UserDict):
query_string: str
def __init__(self, environ: Mapping[str, str] = ..., keep_blank_values: int = ..., strict_parsing: int = ...) -> None: ...
-33
View File
@@ -1,33 +0,0 @@
from typing import Dict, Any, List, Tuple, Optional, Callable, Type, Union, IO, AnyStr, TypeVar
from types import FrameType, TracebackType
import sys
_T = TypeVar("_T")
_ExcInfo = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
if sys.version_info >= (3, 6):
from os import PathLike
_Path = Union[_T, PathLike[_T]]
else:
_Path = Union[_T]
def reset() -> str: ... # undocumented
def small(text: str) -> str: ... # undocumented
def strong(text: str) -> str: ... # undocumented
def grey(text: str) -> str: ... # undocumented
def lookup(name: str, frame: FrameType, locals: Dict[str, Any]) -> Tuple[Optional[str], Any]: ... # undocumented
def scanvars(reader: Callable[[], bytes], frame: FrameType, locals: Dict[str, Any]) -> List[Tuple[str, Optional[str], Any]]: ... # undocumented
def html(einfo: _ExcInfo, context: int = ...) -> str: ...
def text(einfo: _ExcInfo, context: int = ...) -> str: ...
class Hook: # undocumented
def __init__(self, display: int = ..., logdir: Optional[_Path[AnyStr]] = ..., context: int = ..., file: Optional[IO[str]] = ..., format: str = ...) -> None: ...
def __call__(self, etype: Optional[Type[BaseException]], evalue: Optional[BaseException], etb: Optional[TracebackType]) -> None: ...
def handle(self, info: Optional[_ExcInfo] = ...) -> None: ...
def handler(info: Optional[_ExcInfo] = ...) -> None: ...
def enable(display: int = ..., logdir: Optional[_Path[AnyStr]] = ..., context: int = ..., format: str = ...) -> None: ...
+3 -5
View File
@@ -31,8 +31,6 @@ class _IncrementalDecoder(Protocol):
def encode(obj: _Decoded, encoding: str = ..., errors: str = ...) -> _Encoded: ...
def decode(obj: _Encoded, encoding: str = ..., errors: str = ...) -> _Decoded: ...
def lookup(encoding: str) -> CodecInfo: ...
def utf_16_be_decode(__obj: _Encoded, __errors: str = ..., __final: bool = ...) -> Tuple[_Decoded, int]: ... # undocumented
def utf_16_be_encode(__obj: _Decoded, __errors: str = ...) -> Tuple[_Encoded, int]: ... # undocumented
class CodecInfo(Tuple[_Encoder, _Decoder, _StreamReader, _StreamWriter]):
@property
@@ -65,7 +63,7 @@ def getincrementalencoder(encoding: str) -> _IncrementalEncoder: ...
def getincrementaldecoder(encoding: str) -> _IncrementalDecoder: ...
def getreader(encoding: str) -> _StreamReader: ...
def getwriter(encoding: str) -> _StreamWriter: ...
def register(search_function: Callable[[str], Optional[CodecInfo]]) -> None: ...
def register(search_function: Callable[[str], CodecInfo]) -> None: ...
def open(filename: str, mode: str = ..., encoding: str = ..., errors: str = ..., buffering: int = ...) -> StreamReaderWriter: ...
def EncodedFile(file: IO[_Encoded], data_encoding: str, file_encoding: str = ..., errors: str = ...) -> StreamRecoder: ...
def iterencode(iterator: Iterable[_Decoded], encoding: str, errors: str = ...) -> Generator[_Encoded, None, None]: ...
@@ -188,7 +186,7 @@ class StreamReaderWriter(TextIO):
def __enter__(self: _T) -> _T: ...
def __exit__(
self, typ: Optional[Type[BaseException]], exc: Optional[BaseException], tb: Optional[types.TracebackType]
) -> None: ...
) -> bool: ...
def __getattr__(self, name: str) -> Any: ...
# These methods don't actually exist directly, but they are needed to satisfy the TextIO
# interface. At runtime, they are delegated through __getattr__.
@@ -229,7 +227,7 @@ class StreamRecoder(BinaryIO):
def __enter__(self: _SRT) -> _SRT: ...
def __exit__(
self, type: Optional[Type[BaseException]], value: Optional[BaseException], tb: Optional[types.TracebackType]
) -> None: ...
) -> bool: ...
# These methods don't actually exist directly, but they are needed to satisfy the BinaryIO
# interface. At runtime, they are delegated through __getattr__.
def seek(self, offset: int, whence: int = ...) -> int: ...
+9 -21
View File
@@ -18,20 +18,17 @@ if sys.version_info >= (3, 7):
from typing import AsyncContextManager as AbstractAsyncContextManager
_T = TypeVar('_T')
_F = TypeVar('_F', bound=Callable[..., Any])
_ExitFunc = Callable[[Optional[Type[BaseException]],
Optional[BaseException],
Optional[TracebackType]], bool]
_CM_EF = TypeVar('_CM_EF', ContextManager[Any], _ExitFunc)
_CM_EF = TypeVar('_CM_EF', ContextManager, _ExitFunc)
if sys.version_info >= (3, 2):
class _GeneratorContextManager(ContextManager[_T], Generic[_T]):
def __call__(self, func: _F) -> _F: ...
def contextmanager(func: Callable[..., Iterator[_T]]) -> Callable[..., _GeneratorContextManager[_T]]: ...
else:
class GeneratorContextManager(ContextManager[_T], Generic[_T]):
def __call__(self, func: _F) -> _F: ...
def __call__(self, func: Callable[..., _T]) -> Callable[..., _T]: ...
def contextmanager(func: Callable[..., Iterator[_T]]) -> Callable[..., GeneratorContextManager[_T]]: ...
else:
def contextmanager(func: Callable[..., Iterator[_T]]) -> Callable[..., ContextManager[_T]]: ...
if sys.version_info >= (3, 7):
@@ -46,22 +43,19 @@ class closing(ContextManager[_T], Generic[_T]):
if sys.version_info >= (3, 4):
class suppress(ContextManager[None]):
def __init__(self, *exceptions: Type[BaseException]) -> None: ...
def __exit__(self, exctype: Optional[Type[BaseException]],
excinst: Optional[BaseException],
exctb: Optional[TracebackType]) -> bool: ...
class redirect_stdout(ContextManager[None]):
def __init__(self, new_target: Optional[IO[str]]) -> None: ...
def __init__(self, new_target: IO[str]) -> None: ...
if sys.version_info >= (3, 5):
class redirect_stderr(ContextManager[None]):
def __init__(self, new_target: Optional[IO[str]]) -> None: ...
def __init__(self, new_target: IO[str]) -> None: ...
if sys.version_info >= (3,):
class ContextDecorator:
def __call__(self, func: Callable[..., None]) -> Callable[..., ContextManager[None]]: ...
_U = TypeVar('_U', bound=ExitStack)
_U = TypeVar('_U', bound='ExitStack')
class ExitStack(ContextManager[ExitStack]):
def __init__(self) -> None: ...
@@ -72,20 +66,17 @@ if sys.version_info >= (3,):
def pop_all(self: _U) -> _U: ...
def close(self) -> None: ...
def __enter__(self: _U) -> _U: ...
def __exit__(self, __exc_type: Optional[Type[BaseException]],
__exc_value: Optional[BaseException],
__traceback: Optional[TracebackType]) -> bool: ...
if sys.version_info >= (3, 7):
from typing import Awaitable
_S = TypeVar('_S', bound=AsyncExitStack)
_S = TypeVar('_S', bound='AsyncExitStack')
_ExitCoroFunc = Callable[[Optional[Type[BaseException]],
Optional[BaseException],
Optional[TracebackType]], Awaitable[bool]]
_CallbackCoroFunc = Callable[..., Awaitable[Any]]
_ACM_EF = TypeVar('_ACM_EF', AsyncContextManager[Any], _ExitCoroFunc)
_ACM_EF = TypeVar('_ACM_EF', AsyncContextManager, _ExitCoroFunc)
class AsyncExitStack(AsyncContextManager[AsyncExitStack]):
def __init__(self) -> None: ...
@@ -100,9 +91,6 @@ if sys.version_info >= (3, 7):
def pop_all(self: _S) -> _S: ...
def aclose(self) -> Awaitable[None]: ...
def __aenter__(self: _S) -> Awaitable[_S]: ...
def __aexit__(self, __exc_type: Optional[Type[BaseException]],
__exc_value: Optional[BaseException],
__traceback: Optional[TracebackType]) -> Awaitable[bool]: ...
if sys.version_info >= (3, 7):
@overload
+2 -1
View File
@@ -1,5 +1,6 @@
import sys
from typing import List, Optional, Union
from typing import List, NamedTuple, Optional, Union
if sys.version_info >= (3, 3):
class _Method: ...
+28 -40
View File
@@ -1,24 +1,24 @@
import sys
from _csv import (
QUOTE_ALL as QUOTE_ALL,
QUOTE_MINIMAL as QUOTE_MINIMAL,
QUOTE_NONE as QUOTE_NONE,
QUOTE_NONNUMERIC as QUOTE_NONNUMERIC,
Error as Error,
_reader,
_writer,
field_size_limit as field_size_limit,
get_dialect as get_dialect,
list_dialects as list_dialects,
reader as reader,
register_dialect as register_dialect,
unregister_dialect as unregister_dialect,
writer as writer,
)
from collections import OrderedDict
from typing import Any, Dict, Iterable, Iterator, List, Mapping, Optional, Sequence, Text, Type, Union
import sys
from typing import Any, Dict, Iterable, Iterator, List, Mapping, Optional, Sequence, Union
_Dialect = Union[str, Dialect, Type[Dialect]]
from _csv import (_reader,
_writer,
reader as reader,
writer as writer,
register_dialect as register_dialect,
unregister_dialect as unregister_dialect,
get_dialect as get_dialect,
list_dialects as list_dialects,
field_size_limit as field_size_limit,
QUOTE_ALL as QUOTE_ALL,
QUOTE_MINIMAL as QUOTE_MINIMAL,
QUOTE_NONE as QUOTE_NONE,
QUOTE_NONNUMERIC as QUOTE_NONNUMERIC,
Error as Error,
)
_Dialect = Union[str, Dialect]
_DictRow = Mapping[str, Any]
class Dialect(object):
@@ -56,6 +56,7 @@ if sys.version_info >= (3, 6):
else:
_DRMapping = Dict[str, str]
class DictReader(Iterator[_DRMapping]):
restkey: Optional[str]
restval: Optional[str]
@@ -63,37 +64,24 @@ class DictReader(Iterator[_DRMapping]):
dialect: _Dialect
line_num: int
fieldnames: Sequence[str]
def __init__(
self,
f: Iterable[Text],
fieldnames: Optional[Sequence[str]] = ...,
restkey: Optional[str] = ...,
restval: Optional[str] = ...,
dialect: _Dialect = ...,
*args: Any,
**kwds: Any,
) -> None: ...
def __init__(self, f: Iterable[str], fieldnames: Sequence[str] = ...,
restkey: Optional[str] = ..., restval: Optional[str] = ..., dialect: _Dialect = ...,
*args: Any, **kwds: Any) -> None: ...
def __iter__(self) -> DictReader: ...
if sys.version_info >= (3,):
def __next__(self) -> _DRMapping: ...
else:
def next(self) -> _DRMapping: ...
class DictWriter(object):
fieldnames: Sequence[str]
restval: Optional[Any]
extrasaction: str
writer: _writer
def __init__(
self,
f: Any,
fieldnames: Iterable[str],
restval: Optional[Any] = ...,
extrasaction: str = ...,
dialect: _Dialect = ...,
*args: Any,
**kwds: Any,
) -> None: ...
def __init__(self, f: Any, fieldnames: Sequence[str],
restval: Optional[Any] = ..., extrasaction: str = ..., dialect: _Dialect = ...,
*args: Any, **kwds: Any) -> None: ...
def writeheader(self) -> None: ...
def writerow(self, rowdict: _DictRow) -> None: ...
def writerows(self, rowdicts: Iterable[_DictRow]) -> None: ...
@@ -101,5 +89,5 @@ class DictWriter(object):
class Sniffer(object):
preferred: List[str]
def __init__(self) -> None: ...
def sniff(self, sample: str, delimiters: Optional[str] = ...) -> Type[Dialect]: ...
def sniff(self, sample: str, delimiters: Optional[str] = ...) -> Dialect: ...
def has_header(self, sample: str) -> bool: ...
+3 -10
View File
@@ -24,15 +24,8 @@ class CDLL(object):
_name: str = ...
_handle: int = ...
_FuncPtr: Type[_FuncPointer] = ...
def __init__(
self,
name: str,
mode: int = ...,
handle: Optional[int] = ...,
use_errno: bool = ...,
use_last_error: bool = ...,
winmode: Optional[int] = ...,
) -> None: ...
def __init__(self, name: str, mode: int = ..., handle: Optional[int] = ...,
use_errno: bool = ..., use_last_error: bool = ...) -> None: ...
def __getattr__(self, name: str) -> _FuncPointer: ...
def __getitem__(self, name: str) -> _FuncPointer: ...
if sys.platform == 'win32':
@@ -235,7 +228,7 @@ class c_wchar_p(_PointerLike, _SimpleCData[Optional[Text]]):
def __init__(self, value: Optional[_UnionT[int, Text]] = ...) -> None: ...
class c_bool(_SimpleCData[bool]):
def __init__(self, value: bool = ...) -> None: ...
def __init__(self, value: bool) -> None: ...
if sys.platform == 'win32':
class HRESULT(_SimpleCData[int]): ... # TODO undocumented
-15
View File
@@ -1,15 +0,0 @@
from _curses import * # noqa: F403
from _curses import _CursesWindow as _CursesWindow
from typing import TypeVar, Callable, Any
_T = TypeVar('_T')
# available after calling `curses.initscr()`
LINES: int
COLS: int
# available after calling `curses.start_color()`
COLORS: int
COLOR_PAIRS: int
def wrapper(func: Callable[..., _T], *arg: Any, **kwds: Any) -> _T: ...
+23 -48
View File
@@ -1,8 +1,9 @@
import sys
from time import struct_time
from typing import AnyStr, Optional, SupportsAbs, Tuple, Union, overload, ClassVar, Type, TypeVar
_S = TypeVar("_S")
from typing import (
AnyStr, Optional, SupportsAbs, Tuple, Union, overload,
ClassVar,
)
if sys.version_info >= (3,):
_Text = str
@@ -37,17 +38,14 @@ class date:
def __init__(self, year: int, month: int, day: int) -> None: ...
@classmethod
def fromtimestamp(cls: Type[_S], t: float) -> _S: ...
def fromtimestamp(cls, t: float) -> date: ...
@classmethod
def today(cls: Type[_S]) -> _S: ...
def today(cls) -> date: ...
@classmethod
def fromordinal(cls: Type[_S], n: int) -> _S: ...
def fromordinal(cls, n: int) -> date: ...
if sys.version_info >= (3, 7):
@classmethod
def fromisoformat(cls: Type[_S], date_string: str) -> _S: ...
if sys.version_info >= (3, 8):
@classmethod
def fromisocalendar(cls: Type[_S], year: int, week: int, day: int) -> _S: ...
def fromisoformat(cls, date_string: str) -> date: ...
@property
def year(self) -> int: ...
@@ -70,12 +68,7 @@ class date:
def __lt__(self, other: date) -> bool: ...
def __ge__(self, other: date) -> bool: ...
def __gt__(self, other: date) -> bool: ...
if sys.version_info >= (3, 8):
def __add__(self: _S, other: timedelta) -> _S: ...
def __radd__(self: _S, other: timedelta) -> _S: ...
else:
def __add__(self, other: timedelta) -> date: ...
def __radd__(self, other: timedelta) -> date: ...
def __add__(self, other: timedelta) -> date: ...
@overload
def __sub__(self, other: timedelta) -> date: ...
@overload
@@ -116,13 +109,10 @@ class time:
def __ge__(self, other: time) -> bool: ...
def __gt__(self, other: time) -> bool: ...
def __hash__(self) -> int: ...
if sys.version_info >= (3, 6):
def isoformat(self, timespec: str = ...) -> str: ...
else:
def isoformat(self) -> str: ...
def isoformat(self) -> str: ...
if sys.version_info >= (3, 7):
@classmethod
def fromisoformat(cls: Type[_S], time_string: str) -> _S: ...
def fromisoformat(cls, time_string: str) -> time: ...
def strftime(self, fmt: _Text) -> str: ...
if sys.version_info >= (3,):
def __format__(self, fmt: str) -> str: ...
@@ -230,34 +220,26 @@ class datetime(date):
def fold(self) -> int: ...
@classmethod
def fromtimestamp(cls: Type[_S], t: float, tz: Optional[_tzinfo] = ...) -> _S: ...
def fromtimestamp(cls, t: float, tz: Optional[_tzinfo] = ...) -> datetime: ...
@classmethod
def utcfromtimestamp(cls: Type[_S], t: float) -> _S: ...
def utcfromtimestamp(cls, t: float) -> datetime: ...
@classmethod
def today(cls: Type[_S]) -> _S: ...
def today(cls) -> datetime: ...
@classmethod
def fromordinal(cls: Type[_S], n: int) -> _S: ...
if sys.version_info >= (3, 8):
@classmethod
def now(cls: Type[_S], tz: Optional[_tzinfo] = ...) -> _S: ...
else:
@overload
@classmethod
def now(cls: Type[_S], tz: None = ...) -> _S: ...
@overload
@classmethod
def now(cls, tz: _tzinfo) -> datetime: ...
def fromordinal(cls, n: int) -> datetime: ...
@classmethod
def utcnow(cls: Type[_S]) -> _S: ...
def now(cls, tz: Optional[_tzinfo] = ...) -> datetime: ...
@classmethod
def utcnow(cls) -> datetime: ...
if sys.version_info >= (3, 6):
@classmethod
def combine(cls, date: _date, time: _time, tzinfo: Optional[_tzinfo] = ...) -> datetime: ...
def combine(cls, date: date, time: time, tzinfo: Optional[_tzinfo] = ...) -> datetime: ...
else:
@classmethod
def combine(cls, date: _date, time: _time) -> datetime: ...
def combine(cls, date: date, time: time) -> datetime: ...
if sys.version_info >= (3, 7):
@classmethod
def fromisoformat(cls: Type[_S], date_string: str) -> _S: ...
def fromisoformat(cls, date_string: str) -> datetime: ...
def strftime(self, fmt: _Text) -> str: ...
if sys.version_info >= (3,):
def __format__(self, fmt: str) -> str: ...
@@ -279,9 +261,7 @@ class datetime(date):
def replace(self, year: int = ..., month: int = ..., day: int = ..., hour: int = ...,
minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo:
Optional[_tzinfo] = ...) -> datetime: ...
if sys.version_info >= (3, 8):
def astimezone(self: _S, tz: Optional[_tzinfo] = ...) -> _S: ...
elif sys.version_info >= (3, 3):
if sys.version_info >= (3, 3):
def astimezone(self, tz: Optional[_tzinfo] = ...) -> datetime: ...
else:
def astimezone(self, tz: _tzinfo) -> datetime: ...
@@ -299,12 +279,7 @@ class datetime(date):
def __lt__(self, other: datetime) -> bool: ... # type: ignore
def __ge__(self, other: datetime) -> bool: ... # type: ignore
def __gt__(self, other: datetime) -> bool: ... # type: ignore
if sys.version_info >= (3, 8):
def __add__(self: _S, other: timedelta) -> _S: ...
def __radd__(self: _S, other: timedelta) -> _S: ...
else:
def __add__(self, other: timedelta) -> datetime: ...
def __radd__(self, other: timedelta) -> datetime: ...
def __add__(self, other: timedelta) -> datetime: ...
@overload # type: ignore
def __sub__(self, other: datetime) -> timedelta: ...
@overload
+4 -4
View File
@@ -13,10 +13,10 @@ else:
_ComparableNum = Union[Decimal, float]
_DecimalT = TypeVar('_DecimalT', bound=Decimal)
class DecimalTuple(NamedTuple):
sign: int
digits: Tuple[int, ...]
exponent: int
DecimalTuple = NamedTuple('DecimalTuple',
[('sign', int),
('digits', Tuple[int, ...]),
('exponent', int)])
ROUND_DOWN: str
ROUND_HALF_UP: str

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