mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-10 13:32:26 +08:00
Fixing flake8 E121, E122, E123, E124, E125, E126 errors
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
# Better codecs stubs hand-written by o11c.
|
||||
# https://docs.python.org/2/library/codecs.html
|
||||
from typing import (
|
||||
BinaryIO,
|
||||
Callable,
|
||||
Iterable,
|
||||
Iterator,
|
||||
List,
|
||||
Tuple,
|
||||
Union,
|
||||
BinaryIO,
|
||||
Callable,
|
||||
Iterable,
|
||||
Iterator,
|
||||
List,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
from abc import abstractmethod
|
||||
|
||||
@@ -9,7 +9,7 @@ class FileInput(Iterable[str]):
|
||||
bufsize: int = ...,
|
||||
mode: str = ...,
|
||||
openhook: Callable[[str, str], IO[str]] = ...
|
||||
) -> None: ...
|
||||
) -> None: ...
|
||||
|
||||
def __del__(self) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
@@ -8,9 +8,10 @@ ModuleInfo = NamedTuple('ModuleInfo', [('name', str),
|
||||
('mode', str),
|
||||
('module_type', int),
|
||||
])
|
||||
def getmembers(object: object,
|
||||
predicate: Callable[[Any], bool] = ...
|
||||
) -> List[Tuple[str, Any]]: ...
|
||||
def getmembers(
|
||||
object: object,
|
||||
predicate: Callable[[Any], bool] = ...
|
||||
) -> List[Tuple[str, Any]]: ...
|
||||
def getmoduleinfo(path: str) -> Optional[ModuleInfo]: ...
|
||||
def getmodulename(path: str) -> Optional[str]: ...
|
||||
|
||||
@@ -65,12 +66,16 @@ def getmro(cls: type) -> Tuple[type, ...]: ...
|
||||
|
||||
# The interpreter stack
|
||||
|
||||
Traceback = NamedTuple('Traceback', [('filename', str),
|
||||
('lineno', int),
|
||||
('function', str),
|
||||
('code_context', List[str]),
|
||||
('index', int),
|
||||
])
|
||||
Traceback = NamedTuple(
|
||||
'Traceback',
|
||||
[
|
||||
('filename', str),
|
||||
('lineno', int),
|
||||
('function', str),
|
||||
('code_context', List[str]),
|
||||
('index', int),
|
||||
]
|
||||
)
|
||||
|
||||
_FrameRecord = Tuple[FrameType, str, int, str, List[str], int]
|
||||
|
||||
|
||||
@@ -45,26 +45,32 @@ class _TemporaryFileWrapper(IO[str]):
|
||||
# TODO text files
|
||||
|
||||
def TemporaryFile(
|
||||
mode: Union[bytes, unicode] = ...,
|
||||
bufsize: int = ...,
|
||||
suffix: Union[bytes, unicode] = ...,
|
||||
prefix: Union[bytes, unicode] = ...,
|
||||
dir: Union[bytes, unicode] = ...) -> _TemporaryFileWrapper: ...
|
||||
mode: Union[bytes, unicode] = ...,
|
||||
bufsize: int = ...,
|
||||
suffix: Union[bytes, unicode] = ...,
|
||||
prefix: Union[bytes, unicode] = ...,
|
||||
dir: Union[bytes, unicode] = ...
|
||||
) -> _TemporaryFileWrapper:
|
||||
...
|
||||
|
||||
def NamedTemporaryFile(
|
||||
mode: Union[bytes, unicode] = ...,
|
||||
bufsize: int = ...,
|
||||
suffix: Union[bytes, unicode] = ...,
|
||||
prefix: Union[bytes, unicode] = ...,
|
||||
dir: Union[bytes, unicode] = ...,
|
||||
delete: bool = ...
|
||||
) -> _TemporaryFileWrapper: ...
|
||||
mode: Union[bytes, unicode] = ...,
|
||||
bufsize: int = ...,
|
||||
suffix: Union[bytes, unicode] = ...,
|
||||
prefix: Union[bytes, unicode] = ...,
|
||||
dir: Union[bytes, unicode] = ...,
|
||||
delete: bool = ...
|
||||
) -> _TemporaryFileWrapper:
|
||||
...
|
||||
|
||||
def SpooledTemporaryFile(
|
||||
max_size: int = ...,
|
||||
mode: Union[bytes, unicode] = ...,
|
||||
buffering: int = ...,
|
||||
suffix: Union[bytes, unicode] = ...,
|
||||
prefix: Union[bytes, unicode] = ...,
|
||||
dir: Union[bytes, unicode] = ...) -> _TemporaryFileWrapper:
|
||||
max_size: int = ...,
|
||||
mode: Union[bytes, unicode] = ...,
|
||||
buffering: int = ...,
|
||||
suffix: Union[bytes, unicode] = ...,
|
||||
prefix: Union[bytes, unicode] = ...,
|
||||
dir: Union[bytes, unicode] = ...
|
||||
) -> _TemporaryFileWrapper:
|
||||
...
|
||||
|
||||
class TemporaryDirectory:
|
||||
|
||||
@@ -23,15 +23,27 @@ class ResultMixin(object):
|
||||
@property
|
||||
def port(self) -> int: ...
|
||||
|
||||
class SplitResult(NamedTuple('SplitResult', [
|
||||
('scheme', str), ('netloc', str), ('path', str), ('query', str), ('fragment', str)
|
||||
]), ResultMixin):
|
||||
class SplitResult(
|
||||
NamedTuple(
|
||||
'SplitResult',
|
||||
[
|
||||
('scheme', str), ('netloc', str), ('path', str), ('query', str), ('fragment', str)
|
||||
]
|
||||
),
|
||||
ResultMixin
|
||||
):
|
||||
def geturl(self) -> str: ...
|
||||
|
||||
class ParseResult(NamedTuple('ParseResult', [
|
||||
('scheme', str), ('netloc', str), ('path', str), ('params', str), ('query', str),
|
||||
('fragment', str)
|
||||
]), 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: Union[str, unicode], scheme: str = ...,
|
||||
|
||||
@@ -18,31 +18,34 @@ class LimitOverrunError(Exception):
|
||||
|
||||
@coroutines.coroutine
|
||||
def open_connection(
|
||||
host: str = ...,
|
||||
port: int = ...,
|
||||
*,
|
||||
loop: events.AbstractEventLoop = ...,
|
||||
limit: int = ...,
|
||||
**kwds: Any) -> Generator[Any, None, Tuple[StreamReader, StreamWriter]]: ...
|
||||
host: str = ...,
|
||||
port: int = ...,
|
||||
*,
|
||||
loop: events.AbstractEventLoop = ...,
|
||||
limit: int = ...,
|
||||
**kwds: Any
|
||||
) -> Generator[Any, None, Tuple[StreamReader, StreamWriter]]: ...
|
||||
|
||||
@coroutines.coroutine
|
||||
def start_server(
|
||||
client_connected_cb: ClientConnectedCallback,
|
||||
host: str = ...,
|
||||
port: int = ...,
|
||||
*,
|
||||
loop: events.AbstractEventLoop = ...,
|
||||
limit: int = ...,
|
||||
**kwds: Any) -> Generator[Any, None, events.AbstractServer]: ...
|
||||
client_connected_cb: ClientConnectedCallback,
|
||||
host: str = ...,
|
||||
port: int = ...,
|
||||
*,
|
||||
loop: events.AbstractEventLoop = ...,
|
||||
limit: int = ...,
|
||||
**kwds: Any
|
||||
) -> Generator[Any, None, events.AbstractServer]: ...
|
||||
|
||||
if hasattr(socket, 'AF_UNIX'):
|
||||
@coroutines.coroutine
|
||||
def open_unix_connection(
|
||||
path: str = ...,
|
||||
*,
|
||||
loop: events.AbstractEventLoop = ...,
|
||||
limit: int = ...,
|
||||
**kwds: Any)-> Generator[Any, None, Tuple[StreamReader, StreamWriter]]: ...
|
||||
path: str = ...,
|
||||
*,
|
||||
loop: events.AbstractEventLoop = ...,
|
||||
limit: int = ...,
|
||||
**kwds: Any
|
||||
) -> Generator[Any, None, Tuple[StreamReader, StreamWriter]]: ...
|
||||
|
||||
@coroutines.coroutine
|
||||
def start_unix_server(
|
||||
|
||||
@@ -40,21 +40,23 @@ class Process:
|
||||
|
||||
@coroutine
|
||||
def create_subprocess_shell(
|
||||
*Args: Union[str, bytes], # Union used instead of AnyStr due to mypy issue #1236
|
||||
stdin: int = ...,
|
||||
stdout: int = ...,
|
||||
stderr: int = ...,
|
||||
loop: events.AbstractEventLoop = ...,
|
||||
limit: int = ...,
|
||||
**kwds: Any): ...
|
||||
*Args: Union[str, bytes], # Union used instead of AnyStr due to mypy issue #1236
|
||||
stdin: int = ...,
|
||||
stdout: int = ...,
|
||||
stderr: int = ...,
|
||||
loop: events.AbstractEventLoop = ...,
|
||||
limit: int = ...,
|
||||
**kwds: Any
|
||||
): ...
|
||||
|
||||
@coroutine
|
||||
def create_subprocess_exec(
|
||||
program: Union[str, bytes], # Union used instead of AnyStr due to mypy issue #1236
|
||||
*args: Any,
|
||||
stdin: int = ...,
|
||||
stdout: int = ...,
|
||||
stderr: int = ...,
|
||||
loop: events.AbstractEventLoop = ...,
|
||||
limit: int = ...,
|
||||
**kwds: Any) -> Process: ...
|
||||
program: Union[str, bytes], # Union used instead of AnyStr due to mypy issue #1236
|
||||
*args: Any,
|
||||
stdin: int = ...,
|
||||
stdout: int = ...,
|
||||
stderr: int = ...,
|
||||
loop: events.AbstractEventLoop = ...,
|
||||
limit: int = ...,
|
||||
**kwds: Any
|
||||
) -> Process: ...
|
||||
|
||||
@@ -14,7 +14,8 @@ class ReadTransport(BaseTransport):
|
||||
|
||||
class WriteTransport(BaseTransport):
|
||||
def set_write_buffer_limits(
|
||||
self, high: int = ..., low: int = ...) -> None: ...
|
||||
self, high: int = ..., low: int = ...
|
||||
) -> None: ...
|
||||
def get_write_buffer_size(self) -> int: ...
|
||||
def write(self, data: Any) -> None: ...
|
||||
def writelines(self, list_of_data: List[Any]): ...
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# Better codecs stubs hand-written by o11c.
|
||||
# https://docs.python.org/3/library/codecs.html
|
||||
from typing import (
|
||||
BinaryIO,
|
||||
Callable,
|
||||
Iterable,
|
||||
Iterator,
|
||||
List,
|
||||
Tuple,
|
||||
Union,
|
||||
BinaryIO,
|
||||
Callable,
|
||||
Iterable,
|
||||
Iterator,
|
||||
List,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
|
||||
from abc import abstractmethod
|
||||
|
||||
@@ -10,7 +10,9 @@ _have_code = Union[types.MethodType, types.FunctionType, types.CodeType, type]
|
||||
_have_code_or_string = Union[_have_code, str, bytes]
|
||||
|
||||
|
||||
Instruction = NamedTuple("Instruction", [
|
||||
Instruction = NamedTuple(
|
||||
"Instruction",
|
||||
[
|
||||
('opname', str),
|
||||
('opcode', int),
|
||||
('arg', Optional[int]),
|
||||
@@ -19,7 +21,8 @@ Instruction = NamedTuple("Instruction", [
|
||||
('offset', int),
|
||||
('starts_line', Optional[int]),
|
||||
('is_jump_target', bool)
|
||||
])
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
# if sys.version_info >= (3, 4):
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Stubs for email.message (Python 3.4)
|
||||
|
||||
from typing import (
|
||||
Optional, Union, Tuple, TypeVar, Generator, Sequence, Iterator, Any
|
||||
)
|
||||
Optional, Union, Tuple, TypeVar, Generator, Sequence, Iterator, Any
|
||||
)
|
||||
import sys
|
||||
from email.charset import Charset
|
||||
from email.errors import MessageDefect
|
||||
|
||||
@@ -28,5 +28,6 @@ def encode_rfc2231(s: str, charset: Optional[str] = ...,
|
||||
language: Optional[str] = ...) -> str: ...
|
||||
def collapse_rfc2231_value(value: _ParamType, errors: str = ...,
|
||||
fallback_charset: str = ...) -> str: ...
|
||||
def decode_params(params: List[Tuple[str, str]]) \
|
||||
-> List[Tuple[str, _ParamType]]: ...
|
||||
def decode_params(
|
||||
params: List[Tuple[str, str]]
|
||||
) -> List[Tuple[str, _ParamType]]: ...
|
||||
|
||||
@@ -26,7 +26,7 @@ class FileInput(Iterable[AnyStr], Generic[AnyStr]):
|
||||
bufsize: int=...,
|
||||
mode: str=...,
|
||||
openhook: Callable[[str, str], IO[AnyStr]]=...
|
||||
) -> None: ...
|
||||
) -> None: ...
|
||||
|
||||
def __del__(self) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
@@ -20,8 +20,9 @@ def reduce(function: Callable[[_T, _T], _T],
|
||||
|
||||
|
||||
class CacheInfo(NamedTuple('CacheInfo', [
|
||||
('hits', int), ('misses', int), ('maxsize', int), ('currsize', int)])):
|
||||
pass
|
||||
('hits', int), ('misses', int), ('maxsize', int), ('currsize', int)])
|
||||
):
|
||||
...
|
||||
|
||||
class _lru_cache_wrapper(Generic[_T]):
|
||||
__wrapped__ = ... # type: Callable[..., _T]
|
||||
@@ -29,8 +30,7 @@ class _lru_cache_wrapper(Generic[_T]):
|
||||
def cache_info(self) -> CacheInfo: ...
|
||||
|
||||
class lru_cache():
|
||||
def __init__(self, maxsize: Optional[int] = ..., typed: bool = ...) -> None:
|
||||
pass
|
||||
def __init__(self, maxsize: Optional[int] = ..., typed: bool = ...) -> None: ...
|
||||
def __call__(self, f: Callable[..., _T]) -> _lru_cache_wrapper[_T]: ...
|
||||
|
||||
|
||||
|
||||
@@ -125,17 +125,19 @@ else:
|
||||
|
||||
class HTTPConnection:
|
||||
if sys.version_info >= (3, 4):
|
||||
def __init__(self,
|
||||
host: str, port: Optional[int] = ...,
|
||||
timeout: int = ...,
|
||||
source_address: Optional[Tuple[str, int]] = ...) \
|
||||
-> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
host: str, port: Optional[int] = ...,
|
||||
timeout: int = ...,
|
||||
source_address: Optional[Tuple[str, int]] = ...
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(self,
|
||||
host: str, port: Optional[int] = ...,
|
||||
strict: bool = ..., timeout: int = ...,
|
||||
source_address: Optional[Tuple[str, int]] = ...) \
|
||||
-> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
host: str, port: Optional[int] = ...,
|
||||
strict: bool = ..., timeout: int = ...,
|
||||
source_address: Optional[Tuple[str, int]] = ...
|
||||
)-> None: ...
|
||||
def request(self, method: str, url: str,
|
||||
body: Optional[_DataType] = ...,
|
||||
headers: Mapping[str, str] = ...) -> None: ...
|
||||
|
||||
@@ -60,22 +60,24 @@ if sys.version_info >= (3, 3):
|
||||
def invalidate_caches(self) -> None: ...
|
||||
if sys.version_info >= (3, 4):
|
||||
# Not defined on the actual class, but expected to exist.
|
||||
def find_spec(self, fullname: str, path: Optional[Sequence[_Path]],
|
||||
target: types.ModuleType = None
|
||||
) -> Optional[ModuleSpec]:
|
||||
def find_spec(
|
||||
self, fullname: str, path: Optional[Sequence[_Path]],
|
||||
target: types.ModuleType = None
|
||||
) -> Optional[ModuleSpec]:
|
||||
...
|
||||
|
||||
class PathEntryFinder(Finder):
|
||||
def find_module(self, fullname: str) -> Optional[Loader]: ...
|
||||
def find_loader(self, fullname: str
|
||||
) -> Tuple[Optional[Loader], Sequence[_Path]]: ...
|
||||
def find_loader(
|
||||
self, fullname: str
|
||||
) -> Tuple[Optional[Loader], Sequence[_Path]]: ...
|
||||
def invalidate_caches(self) -> None: ...
|
||||
if sys.version_info >= (3, 4):
|
||||
# Not defined on the actual class, but expected to exist.
|
||||
def find_spec(self, fullname: str,
|
||||
target: types.ModuleType = None
|
||||
) -> Optional[ModuleSpec]:
|
||||
...
|
||||
def find_spec(
|
||||
self, fullname: str,
|
||||
target: types.ModuleType = None
|
||||
) -> Optional[ModuleSpec]: ...
|
||||
|
||||
class FileLoader(ResourceLoader, ExecutionLoader):
|
||||
name = ... # type: str
|
||||
|
||||
@@ -13,9 +13,10 @@ if sys.version_info >= (3, 3):
|
||||
importlib.abc.InspectLoader):
|
||||
# MetaPathFinder
|
||||
@classmethod
|
||||
def find_module(cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]]
|
||||
) -> Optional[importlib.abc.Loader]:
|
||||
def find_module(
|
||||
cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]]
|
||||
) -> Optional[importlib.abc.Loader]:
|
||||
...
|
||||
if sys.version_info >= (3, 4):
|
||||
@classmethod
|
||||
@@ -40,17 +41,17 @@ if sys.version_info >= (3, 3):
|
||||
def module_repr(module: types.ModuleType) -> str: ... # type: ignore
|
||||
if sys.version_info >= (3, 4):
|
||||
@classmethod
|
||||
def create_module(cls, spec: ModuleSpec) -> Optional[types.ModuleType]:
|
||||
...
|
||||
def create_module(cls, spec: ModuleSpec) -> Optional[types.ModuleType]: ...
|
||||
@classmethod
|
||||
def exec_module(cls, module: types.ModuleType) -> None: ...
|
||||
else:
|
||||
class BuiltinImporter(importlib.abc.InspectLoader):
|
||||
# MetaPathFinder
|
||||
@classmethod
|
||||
def find_module(cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]]
|
||||
) -> Optional[importlib.abc.Loader]:
|
||||
def find_module(
|
||||
cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]]
|
||||
) -> Optional[importlib.abc.Loader]:
|
||||
...
|
||||
# InspectLoader
|
||||
@classmethod
|
||||
@@ -69,9 +70,10 @@ if sys.version_info >= (3, 3):
|
||||
class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader):
|
||||
# MetaPathFinder
|
||||
@classmethod
|
||||
def find_module(cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]]
|
||||
) -> Optional[importlib.abc.Loader]:
|
||||
def find_module(
|
||||
cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]]
|
||||
) -> Optional[importlib.abc.Loader]:
|
||||
...
|
||||
if sys.version_info >= (3, 4):
|
||||
@classmethod
|
||||
@@ -104,9 +106,10 @@ else:
|
||||
class FrozenImporter(importlib.abc.InspectLoader):
|
||||
# MetaPathFinder
|
||||
@classmethod
|
||||
def find_module(cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]]
|
||||
) -> Optional[importlib.abc.Loader]:
|
||||
def find_module(
|
||||
cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]]
|
||||
) -> Optional[importlib.abc.Loader]:
|
||||
...
|
||||
# InspectLoader
|
||||
@classmethod
|
||||
@@ -124,9 +127,10 @@ else:
|
||||
if sys.version_info >= (3, 3):
|
||||
class WindowsRegisteryFinder(importlib.abc.MetaPathFinder):
|
||||
@classmethod
|
||||
def find_module(cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]]
|
||||
) -> Optional[importlib.abc.Loader]:
|
||||
def find_module(
|
||||
cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]]
|
||||
) -> Optional[importlib.abc.Loader]:
|
||||
...
|
||||
if sys.version_info >= (3, 4):
|
||||
@classmethod
|
||||
@@ -137,9 +141,10 @@ if sys.version_info >= (3, 3):
|
||||
else:
|
||||
class WindowsRegisteryFinder:
|
||||
@classmethod
|
||||
def find_module(cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]]
|
||||
) -> Optional[importlib.abc.Loader]:
|
||||
def find_module(
|
||||
cls, fullname: str,
|
||||
path: Optional[Sequence[importlib.abc._Path]]
|
||||
) -> Optional[importlib.abc.Loader]:
|
||||
...
|
||||
|
||||
if sys.version_info >= (3, 3):
|
||||
@@ -158,12 +163,14 @@ if sys.version_info >= (3, 3):
|
||||
|
||||
class FileFinder(importlib.abc.PathEntryFinder):
|
||||
path = ... # type: str
|
||||
def __init__(self, path: str,
|
||||
*loader_details: Tuple[importlib.abc.Loader, List[str]]
|
||||
) -> None: ...
|
||||
def __init__(
|
||||
self, path: str,
|
||||
*loader_details: Tuple[importlib.abc.Loader, List[str]]
|
||||
) -> None: ...
|
||||
@classmethod
|
||||
def path_hook(*loader_details: Tuple[importlib.abc.Loader, List[str]]
|
||||
) -> Callable[[str], importlib.abc.PathEntryFinder]: ...
|
||||
def path_hook(
|
||||
*loader_details: Tuple[importlib.abc.Loader, List[str]]
|
||||
) -> Callable[[str], importlib.abc.PathEntryFinder]: ...
|
||||
|
||||
class SourceFileLoader(importlib.abc.FileLoader,
|
||||
importlib.abc.SourceLoader):
|
||||
|
||||
@@ -4,12 +4,15 @@ import sys
|
||||
import types
|
||||
from typing import Any, Callable, List, Optional
|
||||
|
||||
def module_for_loader(fxn: Callable[..., types.ModuleType]
|
||||
) -> Callable[..., types.ModuleType]: ...
|
||||
def set_loader(fxn: Callable[..., types.ModuleType]
|
||||
) -> Callable[..., types.ModuleType]: ...
|
||||
def set_package(fxn: Callable[..., types.ModuleType]
|
||||
) -> Callable[..., types.ModuleType]: ...
|
||||
def module_for_loader(
|
||||
fxn: Callable[..., types.ModuleType]
|
||||
) -> Callable[..., types.ModuleType]: ...
|
||||
def set_loader(
|
||||
fxn: Callable[..., types.ModuleType]
|
||||
) -> Callable[..., types.ModuleType]: ...
|
||||
def set_package(
|
||||
fxn: Callable[..., types.ModuleType]
|
||||
) -> Callable[..., types.ModuleType]: ...
|
||||
|
||||
if sys.version_info >= (3, 3):
|
||||
def resolve_name(name: str, package: str) -> str: ...
|
||||
@@ -21,27 +24,32 @@ if sys.version_info >= (3, 4):
|
||||
optimization: Any = None) -> str: ...
|
||||
def source_from_cache(path: str) -> str: ...
|
||||
def decode_source(source_bytes: bytes) -> str: ...
|
||||
def find_spec(name: str, package: str = None
|
||||
) -> importlib.machinery.ModuleSpec: ...
|
||||
def spec_from_loader(name: str, loader: Optional[importlib.abc.Loader], *,
|
||||
origin: str = None, loader_state: Any = None,
|
||||
is_package: bool = None
|
||||
) -> importlib.machinery.ModuleSpec: ...
|
||||
def spec_from_file_location(name: str, location: str, *,
|
||||
loader: importlib.abc.Loader = None,
|
||||
submodule_search_locations: List[str]=None
|
||||
) -> importlib.machinery.ModuleSpec: ...
|
||||
def find_spec(
|
||||
name: str, package: str = None
|
||||
) -> importlib.machinery.ModuleSpec: ...
|
||||
def spec_from_loader(
|
||||
name: str, loader: Optional[importlib.abc.Loader], *,
|
||||
origin: str = None, loader_state: Any = None,
|
||||
is_package: bool = None
|
||||
) -> importlib.machinery.ModuleSpec: ...
|
||||
def spec_from_file_location(
|
||||
name: str, location: str, *,
|
||||
loader: importlib.abc.Loader = None,
|
||||
submodule_search_locations: List[str]=None
|
||||
) -> importlib.machinery.ModuleSpec: ...
|
||||
|
||||
if sys.version_info >= (3, 5):
|
||||
def module_from_spec(spec: importlib.machinery.ModuleSpec
|
||||
) -> types.ModuleType: ...
|
||||
def module_from_spec(
|
||||
spec: importlib.machinery.ModuleSpec
|
||||
) -> types.ModuleType: ...
|
||||
|
||||
class LazyLoader(importlib.abc.Loader):
|
||||
def __init__(self, loader: importlib.abc.Loader) -> None: ...
|
||||
@classmethod
|
||||
def factory(cls, loader: importlib.abc.Loader
|
||||
) -> Callable[..., 'LazyLoader']: ...
|
||||
def create_module(self, spec: importlib.machinery.ModuleSpec
|
||||
) -> Optional[types.ModuleType]:
|
||||
...
|
||||
def factory(
|
||||
cls, loader: importlib.abc.Loader
|
||||
) -> Callable[..., 'LazyLoader']: ...
|
||||
def create_module(
|
||||
self, spec: importlib.machinery.ModuleSpec
|
||||
) -> Optional[types.ModuleType]: ...
|
||||
def exec_module(self, module: types.ModuleType) -> None: ...
|
||||
|
||||
@@ -85,11 +85,13 @@ class FileIO(RawIOBase):
|
||||
mode = ... # type: str
|
||||
name = ... # type: Union[int, str]
|
||||
if sys.version_info >= (3, 3):
|
||||
def __init__(self, name: Union[str, bytes, int], mode: str = ...,
|
||||
closefd: bool = ...,
|
||||
opener: Optional[
|
||||
Callable[[Union[int, str], str], int]] = ...) \
|
||||
-> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
name: Union[str, bytes, int],
|
||||
mode: str = ...,
|
||||
closefd: bool = ...,
|
||||
opener: Optional[Callable[[Union[int, str], str], int]] = ...
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(self, name: Union[str, bytes, int],
|
||||
mode: str = ..., closefd: bool = ...) -> None: ...
|
||||
@@ -198,10 +200,15 @@ class TextIOWrapper(TextIO):
|
||||
# encoding: str = ..., errors: Optional[str] = ...,
|
||||
# newline: Optional[str] = ..., line_buffering: bool = ...) \
|
||||
# -> None: ...
|
||||
def __init__(self, buffer: IO[bytes], encoding: str = ...,
|
||||
errors: Optional[str] = ..., newline: Optional[str] = ...,
|
||||
line_buffering: bool = ..., write_through: bool = ...) \
|
||||
-> None: ...
|
||||
def __init__(
|
||||
self,
|
||||
buffer: IO[bytes],
|
||||
encoding: str = ...,
|
||||
errors: Optional[str] = ...,
|
||||
newline: Optional[str] = ...,
|
||||
line_buffering: bool = ...,
|
||||
write_through: bool = ...
|
||||
) -> None: ...
|
||||
# copied from IOBase
|
||||
def __exit__(self, t: type = None, value: BaseException = None,
|
||||
traceback: Any = None) -> bool: ...
|
||||
|
||||
@@ -14,19 +14,22 @@ template = ... # type: str
|
||||
|
||||
# function stubs
|
||||
def TemporaryFile(
|
||||
mode: str = ..., buffering: int = ..., encoding: str = ...,
|
||||
newline: str = ..., suffix: str = ..., prefix: str = ...,
|
||||
dir: str = ...) -> BinaryIO:
|
||||
mode: str = ..., buffering: int = ..., encoding: str = ...,
|
||||
newline: str = ..., suffix: str = ..., prefix: str = ...,
|
||||
dir: str = ...
|
||||
) -> BinaryIO:
|
||||
...
|
||||
def NamedTemporaryFile(
|
||||
mode: str = ..., buffering: int = ..., encoding: str = ...,
|
||||
newline: str = ..., suffix: str = ..., prefix: str = ...,
|
||||
dir: str = ..., delete: bool =...) -> BinaryIO:
|
||||
mode: str = ..., buffering: int = ..., encoding: str = ...,
|
||||
newline: str = ..., suffix: str = ..., prefix: str = ...,
|
||||
dir: str = ..., delete: bool =...
|
||||
) -> BinaryIO:
|
||||
...
|
||||
def SpooledTemporaryFile(
|
||||
max_size: int = ..., mode: str = ..., buffering: int = ...,
|
||||
encoding: str = ..., newline: str = ..., suffix: str = ...,
|
||||
prefix: str = ..., dir: str = ...) -> BinaryIO:
|
||||
max_size: int = ..., mode: str = ..., buffering: int = ...,
|
||||
encoding: str = ..., newline: str = ..., suffix: str = ...,
|
||||
prefix: str = ..., dir: str = ...
|
||||
) -> BinaryIO:
|
||||
...
|
||||
|
||||
class TemporaryDirectory:
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
# Better textwrap stubs hand-written by o11c.
|
||||
# https://docs.python.org/3/library/textwrap.html
|
||||
from typing import (
|
||||
Callable,
|
||||
List,
|
||||
Callable,
|
||||
List,
|
||||
)
|
||||
|
||||
class TextWrapper:
|
||||
def __init__(self,
|
||||
width: int = ...,
|
||||
*,
|
||||
initial_indent: str = ...,
|
||||
subsequent_indent: str = ...,
|
||||
expand_tabs: bool = ...,
|
||||
tabsize: int = ...,
|
||||
replace_whitespace: bool = ...,
|
||||
fix_sentence_endings: bool = ...,
|
||||
break_long_words: bool = ...,
|
||||
break_on_hyphens: bool = ...,
|
||||
drop_whitespace: bool = ...,
|
||||
max_lines: int = ...,
|
||||
placeholder: str = ...
|
||||
def __init__(
|
||||
self,
|
||||
width: int = ...,
|
||||
*,
|
||||
initial_indent: str = ...,
|
||||
subsequent_indent: str = ...,
|
||||
expand_tabs: bool = ...,
|
||||
tabsize: int = ...,
|
||||
replace_whitespace: bool = ...,
|
||||
fix_sentence_endings: bool = ...,
|
||||
break_long_words: bool = ...,
|
||||
break_on_hyphens: bool = ...,
|
||||
drop_whitespace: bool = ...,
|
||||
max_lines: int = ...,
|
||||
placeholder: str = ...
|
||||
) -> None:
|
||||
self.width = width
|
||||
self.initial_indent = initial_indent
|
||||
|
||||
@@ -30,10 +30,10 @@ if sys.version_info >= (3, 3):
|
||||
class struct_time(
|
||||
NamedTuple(
|
||||
'_struct_time',
|
||||
[('tm_year', int), ('tm_mon', int), ('tm_mday', int),
|
||||
('tm_hour', int), ('tm_min', int), ('tm_sec', int),
|
||||
('tm_wday', int), ('tm_yday', int), ('tm_isdst', int),
|
||||
('tm_zone', str), ('tm_gmtoff', int)]
|
||||
[('tm_year', int), ('tm_mon', int), ('tm_mday', int),
|
||||
('tm_hour', int), ('tm_min', int), ('tm_sec', int),
|
||||
('tm_wday', int), ('tm_yday', int), ('tm_isdst', int),
|
||||
('tm_zone', str), ('tm_gmtoff', int)]
|
||||
)
|
||||
):
|
||||
def __init__(
|
||||
@@ -49,9 +49,9 @@ else:
|
||||
class struct_time(
|
||||
NamedTuple(
|
||||
'_struct_time',
|
||||
[('tm_year', int), ('tm_mon', int), ('tm_mday', int),
|
||||
('tm_hour', int), ('tm_min', int), ('tm_sec', int),
|
||||
('tm_wday', int), ('tm_yday', int), ('tm_isdst', int)]
|
||||
[('tm_year', int), ('tm_mon', int), ('tm_mday', int),
|
||||
('tm_hour', int), ('tm_min', int), ('tm_sec', int),
|
||||
('tm_wday', int), ('tm_yday', int), ('tm_isdst', int)]
|
||||
)
|
||||
):
|
||||
def __init__(self, o: TimeTuple, _arg: Any = ...) -> None: ...
|
||||
|
||||
@@ -44,22 +44,23 @@ class CodeType:
|
||||
co_lnotab = ... # type: bytes
|
||||
co_freevars = ... # type: Tuple[str, ...]
|
||||
co_cellvars = ... # type: Tuple[str, ...]
|
||||
def __init__(self,
|
||||
argcount: int,
|
||||
kwonlyargcount: int,
|
||||
nlocals: int,
|
||||
stacksize: int,
|
||||
flags: int,
|
||||
codestring: bytes,
|
||||
constants: Tuple[Any, ...],
|
||||
names: Tuple[str, ...],
|
||||
varnames: Tuple[str, ...],
|
||||
filename: str,
|
||||
name: str,
|
||||
firstlineno: int,
|
||||
lnotab: bytes,
|
||||
freevars: Tuple[str, ...] = ...,
|
||||
cellvars: Tuple[str, ...] = ...,
|
||||
def __init__(
|
||||
self,
|
||||
argcount: int,
|
||||
kwonlyargcount: int,
|
||||
nlocals: int,
|
||||
stacksize: int,
|
||||
flags: int,
|
||||
codestring: bytes,
|
||||
constants: Tuple[Any, ...],
|
||||
names: Tuple[str, ...],
|
||||
varnames: Tuple[str, ...],
|
||||
filename: str,
|
||||
name: str,
|
||||
firstlineno: int,
|
||||
lnotab: bytes,
|
||||
freevars: Tuple[str, ...] = ...,
|
||||
cellvars: Tuple[str, ...] = ...,
|
||||
) -> None: ...
|
||||
|
||||
class MappingProxyType(Mapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
|
||||
@@ -104,9 +104,10 @@ class TestCase:
|
||||
exception: Union[Type[Warning], Tuple[Type[Warning], ...]],
|
||||
msg: Any = ...) -> _AssertWarnsContext: ...
|
||||
if sys.version_info >= (3, 4):
|
||||
def assertLogs(self, logger: Optional[logging.Logger] = ...,
|
||||
level: Union[int, str, None] = ...) \
|
||||
-> _AssertLogsContext: ...
|
||||
def assertLogs(
|
||||
self, logger: Optional[logging.Logger] = ...,
|
||||
level: Union[int, str, None] = ...
|
||||
) -> _AssertLogsContext: ...
|
||||
def assertAlmostEqual(self, first: float, second: float, places: int = ...,
|
||||
msg: Any = ..., delta: float = ...) -> None: ...
|
||||
def assertNotAlmostEqual(self, first: float, second: float,
|
||||
|
||||
@@ -16,14 +16,16 @@ _T = TypeVar('_T')
|
||||
_UrlopenRet = Union[HTTPResponse, addinfourl]
|
||||
|
||||
|
||||
def urlopen(url: Union[str, 'Request'], data: Optional[bytes] = ...,
|
||||
timeout: float = ..., *, cafile: Optional[str] = ...,
|
||||
capath: Optional[str] = ..., cadefault: bool = ...,
|
||||
context: Optional[ssl.SSLContext] = ...) \
|
||||
-> _UrlopenRet: ...
|
||||
def urlopen(
|
||||
url: Union[str, 'Request'], data: Optional[bytes] = ...,
|
||||
timeout: float = ..., *, cafile: Optional[str] = ...,
|
||||
capath: Optional[str] = ..., cadefault: bool = ...,
|
||||
context: Optional[ssl.SSLContext] = ...
|
||||
) -> _UrlopenRet: ...
|
||||
def install_opener(opener: OpenerDirector) -> None: ...
|
||||
def build_opener(*handlers: Union[BaseHandler, Callable[[], BaseHandler]]) \
|
||||
-> OpenerDirector: ...
|
||||
def build_opener(
|
||||
*handlers: Union[BaseHandler, Callable[[], BaseHandler]]
|
||||
) -> OpenerDirector: ...
|
||||
def url2pathname(path: str) -> str: ...
|
||||
def pathname2url(path: str) -> str: ...
|
||||
def getproxies() -> Dict[str, str]: ...
|
||||
|
||||
Reference in New Issue
Block a user