Fixing flake8 E121, E122, E123, E124, E125, E126 errors

This commit is contained in:
Lukasz Langa
2016-12-19 23:47:57 -08:00
parent 67e38b6806
commit 6b5c6626d6
33 changed files with 354 additions and 286 deletions

20
.flake8
View File

@@ -9,40 +9,30 @@
# 427 F811 redefinition
# 356 E305 expected 2 blank lines
# Nice-to-haves ignored for now
# 221 E128 continuation line under-indented for visual indent
# 44 E127 continuation line over-indented for visual indent
[flake8]
ignore = F401, F811, E301, E302, E305, E501, E701, E704
ignore = F401, F811, E127, E128, E301, E302, E305, E501, E701, E704
# Errors that we need to fix before enabling flake8 by default:
# 921 F821 undefined name
# 221 E128 continuation line under-indented for visual indent
# 213 E231 missing whitespace after , or :
# 85 E266 too many leading ### in a block comment
# 59 E265 block comment should start with #
# 52 E402 module-level import not at top of file
# 48 E225 missing whitespace around operator
# 44 E127 continuation line over-indented for visual indent
# 37 E126 continuation line over-indented for hanging indent
# 30 E124 closing bracket does not match visual indentation
# 28 E116 unexpected indentation (comment)
# 26 F403 from * import used
# 20 E101 mixed spaces and tabs
# 14 E251 unexpected spaces around keyword argument '='
# 14 E203 whitespace before
# 8 B006 mutable argument defaults
# 7 E999 invalid syntax
# 7 E111 indentation is not a multiple of four
# 5 F405 name undefined or from * imports
# 5 E123 closing bracket does not match indentation of opening bracket
# 4 E262 inline comment should start with #
# 4 E121 continuation line under-indented for hanging indent
# 4 E114 indentation is not a multiple of four
# 3 E303 too many blank lines
# 3 E125 continuation line with same indent as next logical line
# 2 E241 multiple spaces after ,
# 2 E131 continuation line unaligned for hanging indent
# 2 B303 __metaclass__ use on Python 3
# 1 E401 multiple imports on one line
# 1 E202 whitespace before )
#
# Those error codes are disabled by default in pycodestyle:
# E121, E123, E126, E241

View File

@@ -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

View File

@@ -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: ...

View File

@@ -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]

View File

@@ -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:

View File

@@ -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 = ...,

View File

@@ -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(

View File

@@ -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: ...

View File

@@ -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]): ...

View File

@@ -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

View File

@@ -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):

View File

@@ -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

View File

@@ -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]]: ...

View File

@@ -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: ...

View File

@@ -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]: ...

View File

@@ -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: ...

View File

@@ -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

View File

@@ -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):

View File

@@ -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: ...

View File

@@ -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: ...

View File

@@ -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:

View File

@@ -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

View File

@@ -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: ...

View File

@@ -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]):

View File

@@ -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,

View File

@@ -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]: ...

View File

@@ -43,7 +43,7 @@ from .sql import (
union,
union_all,
update,
)
)
from .types import (
BIGINT,
@@ -87,7 +87,7 @@ from .types import (
UnicodeText,
VARBINARY,
VARCHAR,
)
)
from .schema import (
CheckConstraint,

View File

@@ -208,8 +208,8 @@ class LONGBLOB(object,
class _EnumeratedValues(_StringType): ...
class ENUM( # sqltypes.Enum,
_EnumeratedValues
):
_EnumeratedValues
):
__visit_name__ = ... # type: Any
strict = ... # type: Any
def __init__(self, *enums, **kw) -> None: ...

View File

@@ -4,25 +4,28 @@ from typing import Any, AnyStr, IO, Optional
__version__ = ... # type: str
def encode(obj: Any,
def encode(
obj: Any,
ensure_ascii: bool = ...,
double_precision: bool = ...,
encode_html_chars: bool = ...,
escape_forward_slashes: bool = ...,
sort_keys: bool = ...,
indent: int = ...,
) -> str: ...
) -> str: ...
def dumps(obj: Any,
def dumps(
obj: Any,
ensure_ascii: bool = ...,
double_precision: bool = ...,
encode_html_chars: bool = ...,
escape_forward_slashes: bool = ...,
sort_keys: bool = ...,
indent: int = ...,
) -> str: ...
) -> str: ...
def dump(obj: Any,
def dump(
obj: Any,
fp: IO[str],
ensure_ascii: bool = ...,
double_precision: bool = ...,
@@ -30,16 +33,19 @@ def dump(obj: Any,
escape_forward_slashes: bool = ...,
sort_keys: bool = ...,
indent: int = ...,
) -> None: ...
) -> None: ...
def decode(s: AnyStr,
def decode(
s: AnyStr,
precise_float: bool = ...,
) -> Any: ...
) -> Any: ...
def loads(s: AnyStr,
def loads(
s: AnyStr,
precise_float: bool = ...,
) -> Any: ...
) -> Any: ...
def load(fp: IO[AnyStr],
def load(
fp: IO[AnyStr],
precise_float: bool = ...,
) -> Any: ...
) -> Any: ...

View File

@@ -16,33 +16,33 @@
# Core classes
from .core import Context, BaseCommand, Command, MultiCommand, Group, \
CommandCollection, Parameter, Option, Argument
CommandCollection, Parameter, Option, Argument
# Globals
from .globals import get_current_context
# Decorators
from .decorators import pass_context, pass_obj, make_pass_decorator, \
command, group, argument, option, confirmation_option, \
password_option, version_option, help_option
command, group, argument, option, confirmation_option, \
password_option, version_option, help_option
# Types
from .types import ParamType, File, Path, Choice, IntRange, Tuple, \
STRING, INT, FLOAT, BOOL, UUID, UNPROCESSED
STRING, INT, FLOAT, BOOL, UUID, UNPROCESSED
# Utilities
from .utils import echo, get_binary_stream, get_text_stream, open_file, \
format_filename, get_app_dir, get_os_args
format_filename, get_app_dir, get_os_args
# Terminal functions
from .termui import prompt, confirm, get_terminal_size, echo_via_pager, \
progressbar, clear, style, unstyle, secho, edit, launch, getchar, \
pause
progressbar, clear, style, unstyle, secho, edit, launch, getchar, \
pause
# Exceptions
from .exceptions import ClickException, UsageError, BadParameter, \
FileError, Abort, NoSuchOption, BadOptionUsage, BadArgumentUsage, \
MissingParameter
FileError, Abort, NoSuchOption, BadOptionUsage, BadArgumentUsage, \
MissingParameter
# Formatting
from .formatting import HelpFormatter, wrap_text

View File

@@ -36,7 +36,7 @@ class parser(object):
default: Optional[datetime],
ignoretz: bool=...,
tzinfos =...,
) -> datetime: ...
) -> datetime: ...
DEFAULTPARSER = ... # type: parser

View File

@@ -117,8 +117,8 @@ class Serializer:
class TimedSerializer(Serializer):
default_signer = ... # type: Callable[..., TimestampSigner]
def loads(self, s: can_become_bytes, salt: Optional[can_become_bytes]=None, max_age: Optional[int]=None, return_timestamp=False) -> Any: ...
def loads_unsafe(self, s: can_become_bytes, salt: Optional[can_become_bytes]=None, max_age: Optional[int]=None) -> Tuple[bool, Any]: ...
def loads(self, s: can_become_bytes, salt: Optional[can_become_bytes]=None, max_age: Optional[int]=None, return_timestamp=False) -> Any: ...
def loads_unsafe(self, s: can_become_bytes, salt: Optional[can_become_bytes]=None, max_age: Optional[int]=None) -> Tuple[bool, Any]: ...
class JSONWebSignatureSerializer(Serializer):
jws_algorithms = ... # type: MutableMapping[str, SigningAlgorithm]

View File

@@ -50,13 +50,16 @@ class WorkingSet:
working_set = ... # type: WorkingSet
def require(*requirements: Union[str, Sequence[str]]) \
-> Sequence[Distribution]: ...
def require(
*requirements: Union[str, Sequence[str]]
) -> Sequence[Distribution]: ...
def run_script(requires: str, script_name: str) -> None: ...
def iter_entry_points(group: str, name: Optional[str] = ...) \
-> Generator[EntryPoint, None, None]: ...
def add_activation_listener(callback: Callable[[Distribution], None]) \
-> None: ...
def iter_entry_points(
group: str, name: Optional[str] = ...
) -> Generator[EntryPoint, None, None]: ...
def add_activation_listener(
callback: Callable[[Distribution], None]
) -> None: ...
class Environment:
@@ -133,8 +136,9 @@ class EntryPoint:
installer: Optional[_InstallerType] = ...) -> None: ...
def find_distributions(path_item: str, only: bool = ...) \
-> Generator[Distribution, None, None]: ...
def find_distributions(
path_item: str, only: bool = ...
) -> Generator[Distribution, None, None]: ...
def get_distribution(dist: Union[Requirement, str, Distribution]) -> Distribution: ...
class Distribution(IResourceProvider, IMetadataProvider):
@@ -251,11 +255,11 @@ else:
class _Importer(importlib.abc.InspectLoader): ...
def register_finder(importer_type: type,
distribution_finder: _DistFinderType) -> None : ...
def register_loader_type(loader_type: type,
provider_factory: Callable[[types.ModuleType],
IResourceProvider]) \
-> None: ...
distribution_finder: _DistFinderType) -> None: ...
def register_loader_type(
loader_type: type,
provider_factory: Callable[[types.ModuleType], IResourceProvider]
) -> None: ...
def register_namespace_handler(importer_type: type,
namespace_handler: _NSHandlerType) -> None: ...
@@ -287,8 +291,9 @@ class FileMetadata(EmptyProvider, IResourceProvider):
def parse_version(v: str) -> Tuple[str, ...]: ...
def yield_lines(strs: _NestedStr) -> Generator[str, None, None]: ...
def split_sections(strs: _NestedStr) \
-> Generator[Tuple[Optional[str], str], None, None]: ...
def split_sections(
strs: _NestedStr
) -> Generator[Tuple[Optional[str], str], None, None]: ...
def safe_name(name: str) -> str: ...
def safe_version(version: str) -> str: ...
def safe_extra(extra: str) -> str: ...