Skip to content

Flake8 fixes #2549

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,13 @@
# 4 E741 ambiguous variable name

# Nice-to-haves ignored for now
# 159 E128 continuation line under-indented for visual indent
# 34 E127 continuation line over-indented for visual indent
# E252 missing whitespace around parameter equals
# 2307 E501 line too long

# Other ignored warnings
# W504 line break after binary operator

[flake8]
ignore = F401, F403, F405, F811, E127, E128, E252, E301, E302, E305, E501, E701, E704, E741, B303, W504
ignore = F401, F403, F405, F811, E301, E302, E305, E501, E701, E704, E741, B303, W504
# We are checking with Python 3 but many of the stubs are Python 2 stubs.
# A nice future improvement would be to provide separate .flake8
# configurations for Python 2 and Python 3 files.
Expand Down
13 changes: 5 additions & 8 deletions stdlib/2/__builtin__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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, ...]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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],
Expand Down
2 changes: 1 addition & 1 deletion stdlib/2/_socket.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down
13 changes: 5 additions & 8 deletions stdlib/2/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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, ...]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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],
Expand Down
11 changes: 3 additions & 8 deletions stdlib/2/getopt.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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]]: ...
10 changes: 5 additions & 5 deletions stdlib/2/httplib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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): ...
Expand Down Expand Up @@ -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):
Expand All @@ -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): ...
Expand Down
8 changes: 4 additions & 4 deletions stdlib/2/inspect.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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]: ...

Expand Down
6 changes: 3 additions & 3 deletions stdlib/2/io.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions stdlib/2/itertools.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
116 changes: 56 additions & 60 deletions stdlib/2/json.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: ...

Expand Down
8 changes: 4 additions & 4 deletions stdlib/2/multiprocessing/pool.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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] = ...,
Expand Down
3 changes: 1 addition & 2 deletions stdlib/2/random.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down
Loading