From 68a49c2c2ea16c6fceea381f67a82e3afea0a268 Mon Sep 17 00:00:00 2001 From: Lukasz Langa Date: Tue, 20 Dec 2016 01:39:18 -0800 Subject: [PATCH] Fixing flake8 E111, E114, E116, E203, E225, E262 errors --- .flake8 | 4 ---- stdlib/2/_weakref.pyi | 4 ++-- stdlib/2/random.pyi | 4 ++-- stdlib/2/urllib2.pyi | 4 ++-- stdlib/3.4/asyncio/events.pyi | 18 ------------------ stdlib/3/importlib/abc.pyi | 3 ++- stdlib/3/os/__init__.pyi | 8 +++----- stdlib/3/shutil.pyi | 2 +- stdlib/3/stat.pyi | 4 ++-- stdlib/3/sys.pyi | 4 +--- stdlib/3/urllib/parse.pyi | 2 +- third_party/2/gflags.pyi | 4 ++-- 12 files changed, 18 insertions(+), 43 deletions(-) diff --git a/.flake8 b/.flake8 index b9cedd7a3..f6293b51e 100644 --- a/.flake8 +++ b/.flake8 @@ -18,11 +18,7 @@ ignore = F401, F811, E127, E128, E301, E302, E305, E501, E701, E704, B303 # Errors that we need to fix before enabling flake8 by default: # 921 F821 undefined name -# 28 E116 unexpected indentation (comment) # 26 F403 from * import used # 14 E251 unexpected spaces around keyword argument '=' # 7 E999 invalid syntax -# 7 E111 indentation is not a multiple of four # 5 F405 name undefined or from * imports -# 4 E262 inline comment should start with # -# 4 E114 indentation is not a multiple of four diff --git a/stdlib/2/_weakref.pyi b/stdlib/2/_weakref.pyi index 9ed024ede..a7bb9ea06 100644 --- a/stdlib/2/_weakref.pyi +++ b/stdlib/2/_weakref.pyi @@ -3,10 +3,10 @@ from typing import Any, Callable, Generic, Optional, TypeVar _T = TypeVar('_T') class CallableProxyType(object): # "weakcallableproxy" - pass + pass class ProxyType(object): # "weakproxy" - pass + pass class ReferenceType(Generic[_T]): # TODO rest of members diff --git a/stdlib/2/random.pyi b/stdlib/2/random.pyi index e8800c8e5..9aa2ddbac 100644 --- a/stdlib/2/random.pyi +++ b/stdlib/2/random.pyi @@ -19,7 +19,7 @@ class Random(_random.Random): def seed(self, x: object = ...) -> None: ... def getstate(self) -> _random._State: ... def setstate(self, state: _random._State) -> None: ... - def jumpahead(self, n : int) -> None: ... + def jumpahead(self, n: int) -> None: ... def getrandbits(self, k: int) -> int: ... @overload def randrange(self, stop: int) -> int: ... @@ -51,7 +51,7 @@ class SystemRandom(Random): def seed(x: object = ...) -> None: ... def getstate() -> object: ... def setstate(state: object) -> None: ... -def jumpahead(n : int) -> None: ... +def jumpahead(n: int) -> None: ... def getrandbits(k: int) -> int: ... @overload def randrange(stop: int) -> int: ... diff --git a/stdlib/2/urllib2.pyi b/stdlib/2/urllib2.pyi index fa92080b3..027267265 100644 --- a/stdlib/2/urllib2.pyi +++ b/stdlib/2/urllib2.pyi @@ -30,7 +30,7 @@ class Request(object): def get_type(self): ... def get_host(self) -> str: ... def get_selector(self): ... - def set_proxy(self, host, type)-> None: ... + def set_proxy(self, host, type) -> None: ... def has_proxy(self) -> bool: ... def get_origin_req_host(self) -> str: ... def is_unverifiable(self) -> bool: ... @@ -156,5 +156,5 @@ class CacheFTPHandler(FTPHandler): def check_cache(self): ... def clear_cache(self): ... -def parse_http_list(s: AnyStr) -> List[AnyStr] : ... +def parse_http_list(s: AnyStr) -> List[AnyStr]: ... def parse_keqv_list(l: List[AnyStr]) -> Dict[AnyStr, AnyStr]: ... diff --git a/stdlib/3.4/asyncio/events.pyi b/stdlib/3.4/asyncio/events.pyi index 3d833d99f..46628a0b0 100644 --- a/stdlib/3.4/asyncio/events.pyi +++ b/stdlib/3.4/asyncio/events.pyi @@ -71,52 +71,34 @@ class AbstractEventLoop(metaclass=ABCMeta): def create_connection(self, protocol_factory: Any, host: str = ..., port: int = ..., *, ssl: Any = ..., family: int = ..., proto: int = ..., flags: int = ..., sock: Any = ..., local_addr: str = ..., server_hostname: str = ...) -> tuple: ... - # ?? check Any - # return (Transport, Protocol) @abstractmethod def create_server(self, protocol_factory: Any, host: str = ..., port: int = ..., *, family: int = ..., flags: int = ..., sock: Any = ..., backlog: int = ..., ssl: Any = ..., reuse_address: Any = ...) -> Any: ... - # ?? check Any - # return Server @abstractmethod def create_unix_connection(self, protocol_factory: Any, path: str, *, ssl: Any = ..., sock: Any = ..., server_hostname: str = ...) -> tuple: ... - # ?? check Any - # return tuple(Transport, Protocol) @abstractmethod def create_unix_server(self, protocol_factory: Any, path: str, *, sock: Any = ..., backlog: int = ..., ssl: Any = ...) -> Any: ... - # ?? check Any - # return Server @abstractmethod def create_datagram_endpoint(self, protocol_factory: Any, local_addr: str = ..., remote_addr: str = ..., *, family: int = ..., proto: int = ..., flags: int = ...) -> tuple: ... - # ?? check Any - # return (Transport, Protocol) # Pipes and subprocesses. @abstractmethod def connect_read_pipe(self, protocol_factory: Any, pipe: Any) -> tuple: ... - # ?? check Any - # return (Transport, Protocol) @abstractmethod def connect_write_pipe(self, protocol_factory: Any, pipe: Any) -> tuple: ... - # ?? check Any - # return (Transport, Protocol) @abstractmethod def subprocess_shell(self, protocol_factory: Any, cmd: Union[bytes, str], *, stdin: Any = ..., stdout: Any = ..., stderr: Any = ..., **kwargs: Any) -> tuple: ... - # ?? check Any - # return (Transport, Protocol) @abstractmethod def subprocess_exec(self, protocol_factory: Any, *args: List[Any], stdin: Any = ..., stdout: Any = ..., stderr: Any = ..., **kwargs: Any) -> tuple: ... - # ?? check Any - # return (Transport, Protocol) @abstractmethod def add_reader(self, fd: int, callback: Callable[[], Any], *args: List[Any]) -> None: ... @abstractmethod diff --git a/stdlib/3/importlib/abc.pyi b/stdlib/3/importlib/abc.pyi index 61f9472a6..6ae74d6f7 100644 --- a/stdlib/3/importlib/abc.pyi +++ b/stdlib/3/importlib/abc.pyi @@ -12,7 +12,8 @@ if sys.version_info >= (3, 4): _Path = Union[bytes, str] -class Finder(metaclass=ABCMeta): ... +class Finder(metaclass=ABCMeta): + ... # Technically this class defines the following method, but its subclasses # in this module violate its signature. Since this class is deprecated, it's # easier to simply ignore that this method exists. diff --git a/stdlib/3/os/__init__.pyi b/stdlib/3/os/__init__.pyi index 30e72954e..054d62c84 100644 --- a/stdlib/3/os/__init__.pyi +++ b/stdlib/3/os/__init__.pyi @@ -141,14 +141,12 @@ class stat_result: st_size = 0 # size of file, in bytes, st_atime = 0.0 # time of most recent access, st_mtime = 0.0 # time of most recent content modification, - st_ctime = 0.0 # platform dependent (time of most recent metadata change - # on Unix, or the time of creation on Windows) + st_ctime = 0.0 # platform dependent (time of most recent metadata change on Unix, or the time of creation on Windows) if sys.version_info >= (3, 3): st_atime_ns = 0 # time of most recent access, in nanoseconds st_mtime_ns = 0 # time of most recent content modification in nanoseconds - st_ctime_ns = 0 # platform dependent (time of most recent metadata change - # on Unix, or the time of creation on Windows) in nanoseconds + st_ctime_ns = 0 # platform dependent (time of most recent metadata change on Unix, or the time of creation on Windows) in nanoseconds # not documented def __init__(self, tuple: Tuple[int, ...]) -> None: ... @@ -185,7 +183,7 @@ class statvfs_result: # Unix only # ----- os function stubs ----- def fsencode(filename: str) -> bytes: ... def fsdecode(filename: bytes) -> str: ... -def get_exec_path(env: Optional[Mapping[str, str]] = ...) -> List[str] : ... +def get_exec_path(env: Optional[Mapping[str, str]] = ...) -> List[str]: ... # NOTE: get_exec_path(): returns List[bytes] when env not None def ctermid() -> str: ... # Unix only def getegid() -> int: ... # Unix only diff --git a/stdlib/3/shutil.pyi b/stdlib/3/shutil.pyi index d266bbee5..1b917e6d1 100644 --- a/stdlib/3/shutil.pyi +++ b/stdlib/3/shutil.pyi @@ -29,7 +29,7 @@ def move(src: str, dst: str) -> None: ... class Error(Exception): ... if sys.version_info >= (3, 4): - class SameFileError(Error): ... + class SameFileError(Error): ... def make_archive(base_name: str, format: str, root_dir: str = ..., base_dir: str = ..., verbose: bool = ..., diff --git a/stdlib/3/stat.pyi b/stdlib/3/stat.pyi index 84d290a93..92e640fce 100644 --- a/stdlib/3/stat.pyi +++ b/stdlib/3/stat.pyi @@ -64,8 +64,8 @@ UF_APPEND = 0 UF_OPAQUE = 0 UF_NOUNLINK = 0 if sys.platform == 'darwin': - UF_COMPRESSED = 0 # OS X 10.6+ only - UF_HIDDEN = 0 # OX X 10.5+ only + UF_COMPRESSED = 0 # OS X 10.6+ only + UF_HIDDEN = 0 # OX X 10.5+ only SF_ARCHIVED = 0 SF_IMMUTABLE = 0 SF_APPEND = 0 diff --git a/stdlib/3/sys.pyi b/stdlib/3/sys.pyi index 37c7e7af8..0492f5292 100644 --- a/stdlib/3/sys.pyi +++ b/stdlib/3/sys.pyi @@ -96,9 +96,7 @@ class _hash_info: int_info = ... # type: _int_info class _int_info: - bits_per_digit = 0 # number of bits held in each digit. Python integers - # are stored internally in - # base 2**int_info.bits_per_digit + bits_per_digit = 0 # number of bits held in each digit. Python integers are stored internally in base 2**int_info.bits_per_digit sizeof_digit = 0 # size in bytes of C type used to represent a digit class _version_info(Tuple[int, int, int, str, int]): diff --git a/stdlib/3/urllib/parse.pyi b/stdlib/3/urllib/parse.pyi index 88ea910a1..02aa6dea1 100644 --- a/stdlib/3/urllib/parse.pyi +++ b/stdlib/3/urllib/parse.pyi @@ -84,7 +84,7 @@ class SplitResultBytes(_SplitResultBase[bytes], _NetlocResultMixinBytes): ... class ParseResultBytes(_ParseResultBase[bytes], _NetlocResultMixinBytes): ... -def parse_qs(qs: str, keep_blank_values : bool = ..., strict_parsing : bool = ..., encoding : str = ..., errors: str = ...) -> Dict[str, List[str]]: ... +def parse_qs(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ..., encoding: str = ..., errors: str = ...) -> Dict[str, List[str]]: ... def parse_qsl(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ..., encoding: str = ..., errors: str = ...) -> List[Tuple[str, str]]: ... diff --git a/third_party/2/gflags.pyi b/third_party/2/gflags.pyi index 9948115e9..cdec93a95 100644 --- a/third_party/2/gflags.pyi +++ b/third_party/2/gflags.pyi @@ -10,7 +10,7 @@ class CantOpenFlagFileError(FlagsError): ... class DuplicateFlagCannotPropagateNoneToSwig(DuplicateFlag): ... class DuplicateFlagError(DuplicateFlag): - def __init__(self, flagname: str, flag_values: FlagValues, other_flag_values: FlagValues = ...) -> None: ... + def __init__(self, flagname: str, flag_values: FlagValues, other_flag_values: FlagValues = ...) -> None: ... class IllegalFlagValue(FlagsError): ... @@ -61,7 +61,7 @@ class FlagValues: def FlagsIntoString(self) -> str: ... def AppendFlagsIntoFile(self, filename: str) -> None: ... def WriteHelpInXMLFormat(self, outfile: IO[str] = ...) -> None: ... - # TODO validator: gflags_validators.Validator +# TODO validator: gflags_validators.Validator def AddValidator(self, validator: Any) -> None: ... FLAGS = ... # type: FlagValues