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

@@ -55,14 +55,14 @@ class staticmethod(object): # Special, only valid as a decorator.
def __init__(self, f: function) -> None: ...
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
def __get__(self, obj: _T, type: Optional[Type[_T]]=...) -> function: ...
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> function: ...
class classmethod(object): # Special, only valid as a decorator.
__func__ = ... # type: function
def __init__(self, f: function) -> None: ...
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
def __get__(self, obj: _T, type: Optional[Type[_T]]=...) -> function: ...
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> function: ...
class type(object):
__bases__ = ... # type: Tuple[type, ...]
@@ -871,8 +871,7 @@ def open(file: unicode, mode: unicode = ..., buffering: int = ...) -> BinaryIO:
def open(file: int, mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
def ord(c: unicode) -> int: ...
# This is only available after from __future__ import print_function.
def print(*values: Any, sep: unicode = ..., end: unicode = ...,
file: IO[Any] = ...) -> None: ...
def print(*values: Any, sep: unicode = ..., end: unicode = ..., file: IO[Any] = ...) -> None: ...
@overload
def pow(x: int, y: int) -> Any: ... # The return type can be int or float, depending on y.
@overload
@@ -925,12 +924,10 @@ def zip(iter1: Iterable[_T1], iter2: Iterable[_T2],
iter3: Iterable[_T3]) -> List[Tuple[_T1, _T2, _T3]]: ...
@overload
def zip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
iter4: Iterable[_T4]) -> List[Tuple[_T1, _T2,
_T3, _T4]]: ...
iter4: Iterable[_T4]) -> List[Tuple[_T1, _T2, _T3, _T4]]: ...
@overload
def zip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
iter4: Iterable[_T4], iter5: Iterable[_T5]) -> List[Tuple[_T1, _T2,
_T3, _T4, _T5]]: ...
iter4: Iterable[_T4], iter5: Iterable[_T5]) -> List[Tuple[_T1, _T2, _T3, _T4, _T5]]: ...
@overload
def zip(iter1: Iterable[Any], iter2: Iterable[Any], iter3: Iterable[Any],
iter4: Iterable[Any], iter5: Iterable[Any], iter6: Iterable[Any],

View File

@@ -275,7 +275,7 @@ class SocketType(object):
raise error
def recvfrom_into(self, buffer: bytearray, nbytes: int = ...,
flags: int = ...) -> int: ...
def send(self, data: str, 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) -> int: ...

View File

@@ -55,14 +55,14 @@ class staticmethod(object): # Special, only valid as a decorator.
def __init__(self, f: function) -> None: ...
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
def __get__(self, obj: _T, type: Optional[Type[_T]]=...) -> function: ...
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> function: ...
class classmethod(object): # Special, only valid as a decorator.
__func__ = ... # type: function
def __init__(self, f: function) -> None: ...
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
def __get__(self, obj: _T, type: Optional[Type[_T]]=...) -> function: ...
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> function: ...
class type(object):
__bases__ = ... # type: Tuple[type, ...]
@@ -871,8 +871,7 @@ def open(file: unicode, mode: unicode = ..., buffering: int = ...) -> BinaryIO:
def open(file: int, mode: unicode = ..., buffering: int = ...) -> BinaryIO: ...
def ord(c: unicode) -> int: ...
# This is only available after from __future__ import print_function.
def print(*values: Any, sep: unicode = ..., end: unicode = ...,
file: IO[Any] = ...) -> None: ...
def print(*values: Any, sep: unicode = ..., end: unicode = ..., file: IO[Any] = ...) -> None: ...
@overload
def pow(x: int, y: int) -> Any: ... # The return type can be int or float, depending on y.
@overload
@@ -925,12 +924,10 @@ def zip(iter1: Iterable[_T1], iter2: Iterable[_T2],
iter3: Iterable[_T3]) -> List[Tuple[_T1, _T2, _T3]]: ...
@overload
def zip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
iter4: Iterable[_T4]) -> List[Tuple[_T1, _T2,
_T3, _T4]]: ...
iter4: Iterable[_T4]) -> List[Tuple[_T1, _T2, _T3, _T4]]: ...
@overload
def zip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
iter4: Iterable[_T4], iter5: Iterable[_T5]) -> List[Tuple[_T1, _T2,
_T3, _T4, _T5]]: ...
iter4: Iterable[_T4], iter5: Iterable[_T5]) -> List[Tuple[_T1, _T2, _T3, _T4, _T5]]: ...
@overload
def zip(iter1: Iterable[Any], iter2: Iterable[Any], iter3: Iterable[Any],
iter4: Iterable[Any], iter5: Iterable[Any], iter6: Iterable[Any],

View File

@@ -3,15 +3,10 @@ from typing import List, Tuple
class GetoptError(Exception):
opt = ... # type: str
msg = ... # type: str
def __init__(self, msg: str, opt: str=...) -> None: ...
def __init__(self, msg: str, opt: str = ...) -> None: ...
def __str__(self) -> str: ...
error = GetoptError
def getopt(args: List[str], shortopts: str,
longopts: List[str]=...) -> Tuple[List[Tuple[str, str]],
List[str]]: ...
def gnu_getopt(args: List[str], shortopts: str,
longopts: List[str]=...) -> Tuple[List[Tuple[str, str]],
List[str]]: ...
def getopt(args: List[str], shortopts: str, longopts: List[str] = ...) -> Tuple[List[Tuple[str, str]], List[str]]: ...
def gnu_getopt(args: List[str], shortopts: str, longopts: List[str] = ...) -> Tuple[List[Tuple[str, str]], List[str]]: ...

View File

@@ -28,7 +28,7 @@ class HTTPResponse:
chunk_left = ... # type: Any
length = ... # type: Any
will_close = ... # type: Any
def __init__(self, sock, debuglevel=0, strict=0, method=None, buffering: bool=...) -> None: ...
def __init__(self, sock, debuglevel=0, strict=0, method=None, buffering: bool = ...) -> None: ...
def begin(self): ...
def close(self): ...
def isclosed(self): ...
@@ -56,16 +56,16 @@ class HTTPConnection:
def putheader(self, header, *values): ...
def endheaders(self, message_body=None): ...
def request(self, method, url, body=None, headers=...): ...
def getresponse(self, buffering: bool=...): ...
def getresponse(self, buffering: bool = ...): ...
class HTTP:
debuglevel = ... # type: Any
def __init__(self, host: str=..., port=None, strict=None) -> None: ...
def __init__(self, host: str = ..., port=None, strict=None) -> None: ...
def connect(self, host=None, port=None): ...
def getfile(self): ...
file = ... # type: Any
headers = ... # type: Any
def getreply(self, buffering: bool=...): ...
def getreply(self, buffering: bool = ...): ...
def close(self): ...
class HTTPSConnection(HTTPConnection):
@@ -79,7 +79,7 @@ class HTTPSConnection(HTTPConnection):
class HTTPS(HTTP):
key_file = ... # type: Any
cert_file = ... # type: Any
def __init__(self, host: str=..., port=None, key_file=None, cert_file=None, strict=None, context=None) -> None: ...
def __init__(self, host: str = ..., port=None, key_file=None, cert_file=None, strict=None, context=None) -> None: ...
class HTTPException(Exception): ...
class NotConnected(HTTPException): ...

View File

@@ -94,11 +94,11 @@ def getargs(co: CodeType) -> Arguments: ...
def getargspec(func: object) -> ArgSpec: ...
def getargvalues(frame: FrameType) -> ArgInfo: ...
def formatargspec(args, varargs=..., varkw=..., defaults=...,
formatarg=..., formatvarargs=..., formatvarkw=..., formatvalue=...,
join=...) -> str: ...
formatarg=..., formatvarargs=..., formatvarkw=..., formatvalue=...,
join=...) -> str: ...
def formatargvalues(args, varargs=..., varkw=..., defaults=...,
formatarg=..., formatvarargs=..., formatvarkw=..., formatvalue=...,
join=...) -> str: ...
formatarg=..., formatvarargs=..., formatvarkw=..., formatvalue=...,
join=...) -> str: ...
def getmro(cls: type) -> Tuple[type, ...]: ...
def getcallargs(func, *args, **kwds) -> Dict[str, Any]: ...

View File

@@ -22,9 +22,9 @@ from _io import UnsupportedOperation as UnsupportedOperation
from _io import open as open
def _OpenWrapper(file: Union[str, unicode, int],
mode: unicode = ..., buffering: int = ..., encoding: unicode = ...,
errors: unicode = ..., newline: unicode = ...,
closefd: bool = ...) -> IO[Any]: ...
mode: unicode = ..., buffering: int = ..., encoding: unicode = ...,
errors: unicode = ..., newline: unicode = ...,
closefd: bool = ...) -> IO[Any]: ...
SEEK_SET = ... # type: int
SEEK_CUR = ... # type: int

View File

@@ -54,8 +54,8 @@ _T6 = TypeVar('_T6')
def imap(func: Callable[[_T1], _S], iter1: Iterable[_T1]) -> Iterator[_S]: ...
@overload
def imap(func: Callable[[_T1, _T2], _S],
iter1: Iterable[_T1],
iter2: Iterable[_T2]) -> Iterator[_S]: ...
iter1: Iterable[_T1],
iter2: Iterable[_T2]) -> Iterator[_S]: ...
@overload
def imap(func: Callable[[_T1, _T2, _T3], _S],
iter1: Iterable[_T1], iter2: Iterable[_T2],

View File

@@ -7,67 +7,63 @@ class JSONDecodeError(ValueError):
def load(self, fp: IO[str]) -> Any: ...
def dumps(obj: Any,
skipkeys: bool = ...,
ensure_ascii: bool = ...,
check_circular: bool = ...,
allow_nan: bool = ...,
cls: Any = ...,
indent: Optional[int] = ...,
separators: Optional[Tuple[str, str]] = ...,
encoding: str = ...,
default: Optional[Callable[[Any], Any]] = ...,
sort_keys: bool = ...,
**kwds: Any) -> str: ...
skipkeys: bool = ...,
ensure_ascii: bool = ...,
check_circular: bool = ...,
allow_nan: bool = ...,
cls: Any = ...,
indent: Optional[int] = ...,
separators: Optional[Tuple[str, str]] = ...,
encoding: str = ...,
default: Optional[Callable[[Any], Any]] = ...,
sort_keys: bool = ...,
**kwds: Any) -> str: ...
def dump(obj: Any,
fp: Union[IO[str], IO[Text]],
skipkeys: bool = ...,
ensure_ascii: bool = ...,
check_circular: bool = ...,
allow_nan: bool = ...,
cls: Any = ...,
indent: Optional[int] = ...,
separators: Optional[Tuple[str, str]] = ...,
encoding: str = ...,
default: Optional[Callable[[Any], Any]] = ...,
sort_keys: bool = ...,
**kwds: Any) -> None: ...
fp: Union[IO[str], IO[Text]],
skipkeys: bool = ...,
ensure_ascii: bool = ...,
check_circular: bool = ...,
allow_nan: bool = ...,
cls: Any = ...,
indent: Optional[int] = ...,
separators: Optional[Tuple[str, str]] = ...,
encoding: str = ...,
default: Optional[Callable[[Any], Any]] = ...,
sort_keys: bool = ...,
**kwds: Any) -> None: ...
def loads(s: Union[Text, bytes],
encoding: 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]] = ...,
object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ...,
**kwds: Any) -> Any: ...
encoding: 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]] = ...,
object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ...,
**kwds: Any) -> Any: ...
def load(fp: IO[str],
encoding: Optional[str] = ...,
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]] = ...,
object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ...,
**kwds: Any) -> Any: ...
encoding: Optional[str] = ...,
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]] = ...,
object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ...,
**kwds: Any) -> Any: ...
class JSONDecoder(object):
def __init__(self,
encoding: Union[Text, bytes] = ...,
object_hook: Callable[..., Any] = ...,
parse_float: Callable[[str], float] = ...,
parse_int: Callable[[str], int] = ...,
parse_constant: Callable[[str], Any] = ...,
strict: bool = ...,
object_pairs_hook: Callable[..., Any] = ...) -> None: ...
encoding: Union[Text, bytes] = ...,
object_hook: Callable[..., Any] = ...,
parse_float: Callable[[str], float] = ...,
parse_int: Callable[[str], int] = ...,
parse_constant: Callable[[str], Any] = ...,
strict: bool = ...,
object_pairs_hook: Callable[..., Any] = ...) -> None: ...
def decode(self, s: Union[Text, bytes], _w: Any = ...) -> Any: ...
def raw_decode(self,
s: Union[Text, bytes],
idx: int = ...) -> Tuple[Any, Any]: ...
def raw_decode(self, s: Union[Text, bytes], idx: int = ...) -> Tuple[Any, Any]: ...
class JSONEncoder(object):
item_separator = ... # type: str
@@ -80,15 +76,15 @@ class JSONEncoder(object):
indent = ... # type: int
def __init__(self,
skipkeys: bool = ...,
ensure_ascii: bool = ...,
check_circular: bool = ...,
allow_nan: bool = ...,
sort_keys: bool = ...,
indent: int = ...,
separators: Tuple[Union[Text, bytes], Union[Text, bytes]] = ...,
encoding: Union[Text, bytes] = ...,
default: Callable[..., Any] = ...) -> None: ...
skipkeys: bool = ...,
ensure_ascii: bool = ...,
check_circular: bool = ...,
allow_nan: bool = ...,
sort_keys: bool = ...,
indent: int = ...,
separators: Tuple[Union[Text, bytes], Union[Text, bytes]] = ...,
encoding: Union[Text, bytes] = ...,
default: Callable[..., Any] = ...) -> None: ...
def default(self, o: Any) -> Any: ...

View File

@@ -25,10 +25,10 @@ class Pool(ContextManager[Pool]):
args: Iterable[Any] = ...,
kwds: Dict[str, Any] = ...) -> Any: ...
def apply_async(self,
func: Callable[..., Any],
args: Iterable[Any] = ...,
kwds: Dict[str, Any] = ...,
callback: Optional[Callable[..., None]] = ...) -> AsyncResult: ...
func: Callable[..., Any],
args: Iterable[Any] = ...,
kwds: Dict[str, Any] = ...,
callback: Optional[Callable[..., None]] = ...) -> AsyncResult: ...
def map(self,
func: Callable[..., Any],
iterable: Iterable[Any] = ...,

View File

@@ -31,8 +31,7 @@ class Random(_random.Random):
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: ...
def triangular(self, low: float = ..., high: float = ..., mode: float = ...) -> float: ...
def betavariate(self, alpha: float, beta: float) -> float: ...
def expovariate(self, lambd: float) -> float: ...
def gammavariate(self, alpha: float, beta: float) -> float: ...

View File

@@ -36,30 +36,26 @@ class TextWrapper(object):
def wrap(self, text: AnyStr) -> List[AnyStr]: ...
def fill(self, text: AnyStr) -> AnyStr: ...
def wrap(
text: AnyStr,
width: int = ...,
initial_indent: AnyStr = ...,
subsequent_indent: AnyStr = ...,
expand_tabs: bool = ...,
replace_whitespace: bool = ...,
fix_sentence_endings: bool = ...,
break_long_words: bool = ...,
drop_whitespace: bool = ...,
break_on_hyphens: bool = ...) -> List[AnyStr]:
...
def wrap(text: AnyStr,
width: int = ...,
initial_indent: AnyStr = ...,
subsequent_indent: AnyStr = ...,
expand_tabs: bool = ...,
replace_whitespace: bool = ...,
fix_sentence_endings: bool = ...,
break_long_words: bool = ...,
drop_whitespace: bool = ...,
break_on_hyphens: bool = ...) -> List[AnyStr]: ...
def fill(
text: AnyStr,
width: int =...,
initial_indent: AnyStr = ...,
subsequent_indent: AnyStr = ...,
expand_tabs: bool = ...,
replace_whitespace: bool = ...,
fix_sentence_endings: bool = ...,
break_long_words: bool = ...,
drop_whitespace: bool = ...,
break_on_hyphens: bool = ...) -> AnyStr:
...
def fill(text: AnyStr,
width: int = ...,
initial_indent: AnyStr = ...,
subsequent_indent: AnyStr = ...,
expand_tabs: bool = ...,
replace_whitespace: bool = ...,
fix_sentence_endings: bool = ...,
break_long_words: bool = ...,
drop_whitespace: bool = ...,
break_on_hyphens: bool = ...) -> AnyStr: ...
def dedent(text: AnyStr) -> AnyStr: ...

View File

@@ -41,10 +41,8 @@ class TestResult:
def stopTest(self, test: Testable) -> None: ...
def startTestRun(self) -> None: ...
def stopTestRun(self) -> None: ...
def addError(self, test: Testable,
err: Tuple[type, Any, Any]) -> None: ... # TODO
def addFailure(self, test: Testable,
err: Tuple[type, Any, Any]) -> None: ... # TODO
def addError(self, test: Testable, err: Tuple[type, Any, Any]) -> None: ... # TODO
def addFailure(self, test: Testable, err: Tuple[type, Any, Any]) -> None: ... # TODO
def addSuccess(self, test: Testable) -> None: ...
def addSkip(self, test: Testable, reason: str) -> None: ...
def addExpectedFailure(self, test: Testable, err: str) -> None: ...
@@ -201,7 +199,7 @@ class TestLoader:
def loadTestsFromName(self, name: str = ...,
module: Optional[types.ModuleType] = ...) -> TestSuite: ...
def loadTestsFromNames(self, names: List[str] = ...,
module: Optional[types.ModuleType] = ...) -> TestSuite: ...
module: Optional[types.ModuleType] = ...) -> TestSuite: ...
def discover(self, start_dir: str, pattern: str = ...,
top_level_dir: Optional[str] = ...) -> TestSuite: ...
def getTestCaseNames(self, testCaseClass: Type[TestCase] = ...) -> List[str]: ...