Flake8 fixes (#2549)

* Fix over-indented continuation lines

* Fix under-indented continuation lines

* Fix whitespace around default operator problems

* Limit line lengths

* Fix inconsistent files
This commit is contained in:
Sebastian Rittau
2018-10-24 16:20:53 +02:00
committed by Jelle Zijlstra
parent f362cf47fa
commit 006a79220f
83 changed files with 567 additions and 547 deletions

View File

@@ -13,11 +13,13 @@ TYPE_DSA = ... # type: int
class Error(Exception): ...
_Key = Union[rsa.RSAPublicKey, rsa.RSAPrivateKey, dsa.DSAPublicKey, dsa.DSAPrivateKey]
class PKey:
def __init__(self) -> None: ...
def to_cryptography_key(self) -> Union[rsa.RSAPublicKey, rsa.RSAPrivateKey, dsa.DSAPublicKey, dsa.DSAPrivateKey]: ...
def to_cryptography_key(self) -> _Key: ...
@classmethod
def from_cryptography_key(cls, crypto_key: Union[rsa.RSAPublicKey, rsa.RSAPrivateKey, dsa.DSAPublicKey, dsa.DSAPrivateKey]): ...
def from_cryptography_key(cls, crypto_key: _Key): ...
def generate_key(self, type: int, bits: int) -> None: ...
def check(self) -> bool: ...
def type(self) -> int: ...
@@ -49,7 +51,8 @@ class X509Name:
def get_components(self) -> List[Tuple[str, str]]: ...
class X509Extension:
def __init__(self, type_name: bytes, critical: bool, value: bytes, subject: Optional[X509] = ..., issuer: Optional[X509] = ...) -> None: ...
def __init__(self, type_name: bytes, critical: bool, value: bytes, subject: Optional[X509] = ...,
issuer: Optional[X509] = ...) -> None: ...
def get_critical(self) -> bool: ...
def get_short_name(self) -> str: ...
def get_data(self) -> str: ...
@@ -125,7 +128,8 @@ class X509StoreContext:
def load_certificate(type: int, buffer: Union[str, unicode]) -> X509: ...
def dump_certificate(type: int, cert: X509) -> bytes: ...
def dump_publickey(type: int, pkey: PKey) -> bytes: ...
def dump_privatekey(type: int, pkey: PKey, cipher: Optional[str] = ..., passphrase: Optional[Union[str, Callable[[int], int]]] = ...) -> bytes: ...
def dump_privatekey(type: int, pkey: PKey, cipher: Optional[str] = ...,
passphrase: Optional[Union[str, Callable[[int], int]]] = ...) -> bytes: ...
class Revoked:
def __init__(self) -> None: ...

View File

@@ -42,7 +42,8 @@ class Future(Generic[_T]):
class Executor:
def submit(self, fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ...
if sys.version_info >= (3, 5):
def map(self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ..., chunksize: int = ...) -> Iterator[_T]: ...
def map(self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ...,
chunksize: int = ...) -> Iterator[_T]: ...
else:
def map(self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ...,) -> Iterator[_T]: ...
def shutdown(self, wait: bool = ...) -> None: ...
@@ -51,4 +52,5 @@ class Executor:
def as_completed(fs: Iterable[Future[_T]], timeout: Optional[float] = ...) -> Iterator[Future[_T]]: ...
def wait(fs: Iterable[Future[_T]], timeout: Optional[float] = ..., return_when: str = ...) -> Tuple[Set[Future[_T]], Set[Future[_T]]]: ...
def wait(fs: Iterable[Future[_T]], timeout: Optional[float] = ..., return_when: str = ...) -> Tuple[Set[Future[_T]],
Set[Future[_T]]]: ...

View File

@@ -11,7 +11,8 @@ class RSAPrivateKey:
class RSAPrivateKeyWithSerialization(RSAPrivateKey):
def private_numbers(self) -> RSAPrivateNumbers: ...
def private_bytes(self, encoding: Encoding, format: PrivateFormat, encryption_algorithm: KeySerializationEncryption) -> bytes: ...
def private_bytes(self, encoding: Encoding, format: PrivateFormat,
encryption_algorithm: KeySerializationEncryption) -> bytes: ...
class RSAPublicKey:
def verifier(self, signature: bytes, padding, algorithm): ...

View File

@@ -102,8 +102,8 @@ class Flag:
allow_override = False
def __init__(self, parser: ArgumentParser, serializer: ArgumentSerializer, name: str,
default: Optional[str], help_string: str, short_name: str = ..., boolean: bool = ...,
allow_override: bool = ...) -> None: ...
default: Optional[str], help_string: str, short_name: str = ..., boolean: bool = ...,
allow_override: bool = ...) -> None: ...
def Parse(self, argument: Any) -> Any: ...
def Unparse(self) -> None: ...
def Serialize(self) -> str: ...
@@ -199,7 +199,7 @@ class EnumParser(ArgumentParser):
class EnumFlag(Flag):
def __init__(self, name: str, default: Optional[str], help: str, enum_values: List[str],
short_name: str, **args: Any) -> None: ...
short_name: str, **args: Any) -> None: ...
def DEFINE_enum(name: str, default: Optional[str], enum_values: List[str], help: str,
flag_values: FlagValues = ..., **args: Any) -> None: ...
@@ -217,7 +217,8 @@ class WhitespaceSeparatedListParser(BaseListParser):
def WriteCustomInfoInXMLFormat(self, outfile: IO[str], indent: str): ...
def DEFINE_list(name: str, default: Optional[List[str]], help: str, flag_values: FlagValues = ..., **args: Any) -> None: ...
def DEFINE_spaceseplist(name: str, default: Optional[List[str]], help: str, flag_values: FlagValues = ..., **args: Any) -> None: ...
def DEFINE_spaceseplist(name: str, default: Optional[List[str]], help: str, flag_values: FlagValues = ...,
**args: Any) -> None: ...
class MultiFlag(Flag):
def __init__(self, *args: Any, **kwargs: Any) -> None: ...

View File

@@ -98,7 +98,8 @@ class Serializer:
is_text_serializer = ... # type: bool
signer = ... # type: Signer
signer_kwargs = ... # type: MutableMapping
def __init__(self, secret_key: bytes_like, salt: Optional[bytes_like] = ..., serializer: Optional[_serializer] = ..., signer: Optional[Callable[..., Signer]] = ..., signer_kwargs: Optional[MutableMapping] = ...) -> None: ...
def __init__(self, secret_key: bytes_like, salt: Optional[bytes_like] = ..., serializer: Optional[_serializer] = ...,
signer: Optional[Callable[..., Signer]] = ..., signer_kwargs: Optional[MutableMapping] = ...) -> None: ...
def load_payload(self, payload: Any, serializer: Optional[_serializer] = ...) -> Any: ...
def dump_payload(self, *args, **kwargs) -> str: ...
def make_signer(self, salt: Optional[bytes_like] = ...) -> Signer: ...
@@ -111,7 +112,8 @@ class Serializer:
class TimedSerializer(Serializer):
default_signer = ... # type: Callable[..., TimestampSigner]
def loads(self, s: str, salt: Optional[bytes_like] = ..., max_age: Optional[int] = ..., return_timestamp: bool = ...) -> Any: ...
def loads(self, s: str, salt: Optional[bytes_like] = ..., max_age: Optional[int] = ...,
return_timestamp: bool = ...) -> Any: ...
def loads_unsafe(self, s: str, salt: Optional[bytes_like] = ..., max_age: Optional[int] = ...) -> Tuple[bool, Any]: ...
class JSONWebSignatureSerializer(Serializer):
@@ -120,7 +122,9 @@ class JSONWebSignatureSerializer(Serializer):
default_serializer = ... # type: Any
algorithm_name = ... # type: str
algorithm = ... # type: Any
def __init__(self, secret_key: bytes_like, salt: Optional[bytes_like] = ..., serializer: Optional[_serializer] = ..., signer: Optional[Callable[..., Signer]] = ..., signer_kwargs: Optional[MutableMapping] = ..., algorithm_name: Optional[str] = ...) -> None: ...
def __init__(self, secret_key: bytes_like, salt: Optional[bytes_like] = ..., serializer: Optional[_serializer] = ...,
signer: Optional[Callable[..., Signer]] = ..., signer_kwargs: Optional[MutableMapping] = ...,
algorithm_name: Optional[str] = ...) -> None: ...
def load_payload(self, payload: Any, serializer: Optional[_serializer] = ..., return_header: bool = ...) -> Any: ...
def dump_payload(self, *args, **kwargs) -> bytes: ...
def make_algorithm(self, algorithm_name: str) -> SigningAlgorithm: ...
@@ -140,7 +144,8 @@ class TimedJSONWebSignatureSerializer(JSONWebSignatureSerializer):
def now(self) -> int: ...
class URLSafeSerializerMixin:
def load_payload(self, payload: Any, serializer=None, return_header=False, **kwargs) -> Any: ... # FIXME: This is invalid but works around https://github.com/pallets/itsdangerous/issues/74
def load_payload(self, payload: Any, serializer=None, return_header=False, **kwargs) \
-> Any: ... # FIXME: This is invalid but works around https://github.com/pallets/itsdangerous/issues/74
def dump_payload(self, *args, **kwargs) -> str: ...
class URLSafeSerializer(URLSafeSerializerMixin, Serializer):

View File

@@ -34,7 +34,8 @@ class KazooClient:
SetPartitioner = ... # type: Any
Semaphore = ... # type: Any
ShallowParty = ... # type: Any
def __init__(self, hosts=..., timeout=..., client_id=..., handler=..., default_acl=..., auth_data=..., read_only=..., randomize_hosts=..., connection_retry=..., command_retry=..., logger=..., **kwargs) -> None: ...
def __init__(self, hosts=..., timeout=..., client_id=..., handler=..., default_acl=..., auth_data=..., read_only=...,
randomize_hosts=..., connection_retry=..., command_retry=..., logger=..., **kwargs) -> None: ...
@property
def client_state(self): ...
@property

View File

@@ -37,7 +37,10 @@ class StrictRedis:
def from_url(cls, url, db=..., **kwargs): ...
connection_pool = ... # type: Any
response_callbacks = ... # type: Any
def __init__(self, host=..., port=..., db=..., password=..., socket_timeout=..., socket_connect_timeout=..., socket_keepalive=..., socket_keepalive_options=..., connection_pool=..., unix_socket_path=..., encoding=..., encoding_errors=..., charset=..., errors=..., decode_responses=..., retry_on_timeout=..., ssl=..., ssl_keyfile=..., ssl_certfile=..., ssl_cert_reqs=..., ssl_ca_certs=...) -> None: ...
def __init__(self, host=..., port=..., db=..., password=..., socket_timeout=..., socket_connect_timeout=...,
socket_keepalive=..., socket_keepalive_options=..., connection_pool=..., unix_socket_path=..., encoding=...,
encoding_errors=..., charset=..., errors=..., decode_responses=..., retry_on_timeout=..., ssl=...,
ssl_keyfile=..., ssl_certfile=..., ssl_cert_reqs=..., ssl_ca_certs=...) -> None: ...
def set_response_callback(self, command, callback): ...
def pipeline(self, transaction=..., shard_hint=...): ...
def transaction(self, func, *watches, **kwargs): ...

View File

@@ -68,7 +68,9 @@ class Connection:
encoding = ... # type: Any
encoding_errors = ... # type: Any
decode_responses = ... # type: Any
def __init__(self, host=..., port=..., db=..., password=..., socket_timeout=..., socket_connect_timeout=..., socket_keepalive=..., socket_keepalive_options=..., retry_on_timeout=..., encoding=..., encoding_errors=..., decode_responses=..., parser_class=..., socket_read_size=...) -> None: ...
def __init__(self, host=..., port=..., db=..., password=..., socket_timeout=..., socket_connect_timeout=...,
socket_keepalive=..., socket_keepalive_options=..., retry_on_timeout=..., encoding=..., encoding_errors=...,
decode_responses=..., parser_class=..., socket_read_size=...) -> None: ...
def __del__(self): ...
def register_connect_callback(self, callback): ...
def clear_connect_callbacks(self): ...
@@ -102,7 +104,8 @@ class UnixDomainSocketConnection(Connection):
encoding = ... # type: Any
encoding_errors = ... # type: Any
decode_responses = ... # type: Any
def __init__(self, path=..., db=..., password=..., socket_timeout=..., encoding=..., encoding_errors=..., decode_responses=..., retry_on_timeout=..., parser_class=..., socket_read_size=...) -> None: ...
def __init__(self, path=..., db=..., password=..., socket_timeout=..., encoding=..., encoding_errors=...,
decode_responses=..., retry_on_timeout=..., parser_class=..., socket_read_size=...) -> None: ...
class ConnectionPool:
@classmethod

View File

@@ -7,7 +7,8 @@ def strip_slashes(name): ...
class SubMapperParent:
def submapper(self, **kargs): ...
def collection(self, collection_name, resource_name, path_prefix=..., member_prefix=..., controller=..., collection_actions=..., member_actions=..., member_options=..., **kwargs): ...
def collection(self, collection_name, resource_name, path_prefix=..., member_prefix=..., controller=...,
collection_actions=..., member_actions=..., member_options=..., **kwargs): ...
class SubMapper(SubMapperParent):
kwargs = ... # type: Any

View File

@@ -78,9 +78,11 @@ def assertCountEqual(self: unittest.TestCase, first: Iterable[_T], second: Itera
def assertRaisesRegex(self: unittest.TestCase, msg: str = ...) -> Any: ...
@overload
def assertRaisesRegex(self: unittest.TestCase, callable_obj: Callable[..., Any], *args: Any, **kwargs: Any) -> Any: ...
def assertRegex(self: unittest.TestCase, text: AnyStr, expected_regex: Union[AnyStr, Pattern[AnyStr]], msg: str = ...) -> None: ...
def assertRegex(self: unittest.TestCase, text: AnyStr, expected_regex: Union[AnyStr, Pattern[AnyStr]],
msg: str = ...) -> None: ...
def reraise(tp: Optional[Type[BaseException]], value: Optional[BaseException], tb: Optional[types.TracebackType] = ...) -> NoReturn: ...
def reraise(tp: Optional[Type[BaseException]], value: Optional[BaseException],
tb: Optional[types.TracebackType] = ...) -> NoReturn: ...
def exec_(_code_: Union[unicode, types.CodeType], _globs_: Dict[str, Any] = ..., _locs_: Dict[str, Any] = ...): ...
def raise_from(value: BaseException, from_value: Optional[BaseException]) -> NoReturn: ...

View File

@@ -52,7 +52,12 @@ class HTTPRequest:
ssl_options = ... # type: Any
expect_100_continue = ... # type: Any
start_time = ... # type: Any
def __init__(self, url, method=..., headers=..., body=..., auth_username=..., auth_password=..., auth_mode=..., connect_timeout=..., request_timeout=..., if_modified_since=..., follow_redirects=..., max_redirects=..., user_agent=..., use_gzip=..., network_interface=..., streaming_callback=..., header_callback=..., prepare_curl_callback=..., proxy_host=..., proxy_port=..., proxy_username=..., proxy_password=..., allow_nonstandard_methods=..., validate_cert=..., ca_certs=..., allow_ipv6=..., client_key=..., client_cert=..., body_producer=..., expect_100_continue=..., decompress_response=..., ssl_options=...) -> None: ...
def __init__(self, url, method=..., headers=..., body=..., auth_username=..., auth_password=..., auth_mode=...,
connect_timeout=..., request_timeout=..., if_modified_since=..., follow_redirects=..., max_redirects=...,
user_agent=..., use_gzip=..., network_interface=..., streaming_callback=..., header_callback=...,
prepare_curl_callback=..., proxy_host=..., proxy_port=..., proxy_username=..., proxy_password=...,
allow_nonstandard_methods=..., validate_cert=..., ca_certs=..., allow_ipv6=..., client_key=..., client_cert=...,
body_producer=..., expect_100_continue=..., decompress_response=..., ssl_options=...) -> None: ...
@property
def headers(self): ...
@headers.setter
@@ -72,7 +77,8 @@ class HTTPResponse:
error = ... # type: Any
request_time = ... # type: Any
time_info = ... # type: Any
def __init__(self, request, code, headers=..., buffer=..., effective_url=..., error=..., request_time=..., time_info=..., reason=...) -> None: ...
def __init__(self, request, code, headers=..., buffer=..., effective_url=..., error=..., request_time=..., time_info=...,
reason=...) -> None: ...
body = ... # type: Any
def rethrow(self): ...

View File

@@ -10,7 +10,9 @@ class HTTPServer(TCPServer, Configurable, httputil.HTTPServerConnectionDelegate)
xheaders = ... # type: Any
protocol = ... # type: Any
conn_params = ... # type: Any
def initialize(self, request_callback, no_keep_alive=..., io_loop=..., xheaders=..., ssl_options=..., protocol=..., decompress_request=..., chunk_size=..., max_header_size=..., idle_connection_timeout=..., body_timeout=..., max_body_size=..., max_buffer_size=...): ...
def initialize(self, request_callback, no_keep_alive=..., io_loop=..., xheaders=..., ssl_options=..., protocol=...,
decompress_request=..., chunk_size=..., max_header_size=..., idle_connection_timeout=..., body_timeout=...,
max_body_size=..., max_buffer_size=...): ...
@classmethod
def configurable_base(cls): ...
@classmethod

View File

@@ -42,7 +42,8 @@ class HTTPServerRequest:
arguments = ... # type: Any
query_arguments = ... # type: Any
body_arguments = ... # type: Any
def __init__(self, method=..., uri=..., version=..., headers=..., body=..., host=..., files=..., connection=..., start_line=...) -> None: ...
def __init__(self, method=..., uri=..., version=..., headers=..., body=..., host=..., files=..., connection=...,
start_line=...) -> None: ...
def supports_http_1_1(self): ...
@property
def cookies(self): ...