Fixing flake8 E265 errors

This commit is contained in:
Lukasz Langa
2016-12-20 00:16:44 -08:00
parent 5b6a9937b2
commit 147772950f
24 changed files with 70 additions and 71 deletions

View File

@@ -18,7 +18,6 @@ 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
# 59 E265 block comment should start with #
# 52 E402 module-level import not at top of file
# 48 E225 missing whitespace around operator
# 28 E116 unexpected indentation (comment)

View File

@@ -5,6 +5,6 @@
# import message
# TODO
#class MIMEBase(message.Message):
# class MIMEBase(message.Message):
class MIMEBase:
def __init__(self, _maintype, _subtype, **_params) -> None: ...

View File

@@ -272,8 +272,8 @@ O_LARGEFILE = 0 # Gnu extension if in C library
P_NOWAIT = 0
P_NOWAITO = 0
P_WAIT = 0
#P_DETACH = 0 # Windows only
#P_OVERLAY = 0 # Windows only
# P_DETACH = 0 # Windows only
# P_OVERLAY = 0 # Windows only
# wait()/waitpid() options
WNOHANG = 0 # Unix only

View File

@@ -52,7 +52,7 @@ def relpath(path: AnyStr, start: AnyStr = ...) -> AnyStr: ...
def samefile(path1: unicode, path2: unicode) -> bool: ...
def sameopenfile(fp1: int, fp2: int) -> bool: ...
# TODO
#def samestat(stat1: stat_result,
# def samestat(stat1: stat_result,
# stat2: stat_result) -> bool: ... # Unix only
def split(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ...

View File

@@ -4,14 +4,14 @@ from typing import Any, Sequence, TypeVar
_T = TypeVar('_T')
# TODO uncomment when mypy#2035 is fixed
#def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
#def bisect_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
#def bisect(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
# TODO uncomment when mypy# 2035 is fixed
# def bisect_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
# def bisect_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
# def bisect(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
#
#def insort_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
#def insort_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
#def insort(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
# def insort_left(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
# def insort_right(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
# def insort(a: Sequence[_T], x: _T, lo: int = ..., hi: int = ...) -> int: ...
def bisect_left(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...
def bisect_right(a: Sequence, x: Any, lo: int = ..., hi: int = ...) -> int: ...

View File

@@ -3,7 +3,7 @@
from typing import Any, Callable, Dict, Optional, IO, Union
import sys
if sys.version_info >= (3,):
#from configparser import RawConfigParser
# from configparser import RawConfigParser
# TODO add RawConfigParser to configparser stubs
RawConfigParser = Any
else:

View File

@@ -30,7 +30,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
@abstractmethod
def run_forever(self) -> None: ...
# Can't use a union, see mypy issue #1873.
# Can't use a union, see mypy issue # 1873.
@overload
@abstractmethod
def run_until_complete(self, future: Generator[Any, Any, _T]) -> _T: ...
@@ -94,28 +94,28 @@ class AbstractEventLoop(metaclass=ABCMeta):
def create_datagram_endpoint(self, protocol_factory: Any,
local_addr: str = ..., remote_addr: str = ..., *,
family: int = ..., proto: int = ..., flags: int = ...) -> tuple: ...
#?? check Any
# ?? check Any
# return (Transport, Protocol)
# Pipes and subprocesses.
@abstractmethod
def connect_read_pipe(self, protocol_factory: Any, pipe: Any) -> tuple: ...
#?? check Any
# ?? check Any
# return (Transport, Protocol)
@abstractmethod
def connect_write_pipe(self, protocol_factory: Any, pipe: Any) -> tuple: ...
#?? check Any
# ?? 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
# ?? 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
# ?? check Any
# return (Transport, Protocol)
@abstractmethod
def add_reader(self, fd: int, callback: Callable[[], Any], *args: List[Any]) -> None: ...
@@ -127,11 +127,11 @@ class AbstractEventLoop(metaclass=ABCMeta):
def remove_writer(self, fd: int) -> None: ...
# Completion based I/O methods returning Futures.
@abstractmethod
def sock_recv(self, sock: Any, nbytes: int) -> Any: ... #TODO
def sock_recv(self, sock: Any, nbytes: int) -> Any: ... # TODO
@abstractmethod
def sock_sendall(self, sock: Any, data: bytes) -> None: ... #TODO
def sock_sendall(self, sock: Any, data: bytes) -> None: ... # TODO
@abstractmethod
def sock_connect(self, sock: Any, address: str) -> Any: ... #TODO
def sock_connect(self, sock: Any, address: str) -> Any: ... # TODO
@abstractmethod
def sock_accept(self, sock: Any) -> Any: ...
# Signal handling.

View File

@@ -4,7 +4,7 @@
from _curses import *
# Stubgen imports a python version of has_key only if it's not present
#in _curses (which it is in this stub)
# in _curses (which it is in this stub)
# from .has_key import has_key as has_key
def initscr(): ...

View File

@@ -15,9 +15,9 @@ 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.
#@abstractmethod
#def find_module(self, fullname: str,
# path: Sequence[_Path] = None) -> Optional[Loader]: ...
# @abstractmethod
# def find_module(self, fullname: str,
# path: Sequence[_Path] = None) -> Optional[Loader]: ...
class ResourceLoader(Loader):
@abstractmethod

View File

@@ -18,13 +18,13 @@ open = builtins.open
# FIXME when mypy handle condtional, we can uncomment the next block and remove
# the temporary fix
#if sys.version_info >= (3, 3):
# BlockingIOError = BlockingIOError
# class UnsupportedOperation(OSError, ValueError): ...
#else:
# class BlockingIOError(IOError):
# characters_written = ... # type: int
# class UnsupportedOperation(IOError, ValueError): ...
# if sys.version_info >= (3, 3):
# BlockingIOError = BlockingIOError
# class UnsupportedOperation(OSError, ValueError): ...
# else:
# class BlockingIOError(IOError):
# characters_written = ... # type: int
# class UnsupportedOperation(IOError, ValueError): ...
class BlockingIOError(OSError):
characters_written = ... # type: int
class UnsupportedOperation(OSError, ValueError): ...
@@ -190,12 +190,12 @@ class TextIOBase(IOBase):
class TextIOWrapper(TextIO):
line_buffering = ... # type: bool
# TODO uncomment after fixing mypy about using write_through
#if sys.version_info >= (3, 3):
# if sys.version_info >= (3, 3):
# def __init__(self, buffer: IO[bytes], encoding: str = ...,
# errors: Optional[str] = ..., newline: Optional[str] = ...,
# line_buffering: bool = ..., write_through: bool = ...) \
# -> None: ...
#else:
# else:
# def __init__(self, buffer: IO[bytes],
# encoding: str = ..., errors: Optional[str] = ...,
# newline: Optional[str] = ..., line_buffering: bool = ...) \

View File

@@ -94,13 +94,13 @@ EX_NOTFOUND = 0 # Unix only
P_NOWAIT = 0
P_NOWAITO = 0
P_WAIT = 0
#P_DETACH = 0 # Windows only
#P_OVERLAY = 0 # Windows only
# P_DETACH = 0 # Windows only
# P_OVERLAY = 0 # Windows only
# wait()/waitpid() options
WNOHANG = 0 # Unix only
#WCONTINUED = 0 # some Unix systems
#WUNTRACED = 0 # Unix only
# WCONTINUED = 0 # some Unix systems
# WUNTRACED = 0 # Unix only
TMP_MAX = 0 # Undocumented, but used by tempfile

View File

@@ -55,11 +55,11 @@ def relpath(path: AnyStr, start: AnyStr = ...) -> AnyStr: ...
def samefile(path1: AnyStr, path2: AnyStr) -> bool: ...
def sameopenfile(fp1: int, fp2: int) -> bool: ...
#def samestat(stat1: stat_result,
# def samestat(stat1: stat_result,
# stat2: stat_result) -> bool: ... # Unix only
def split(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
def splitdrive(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
def splitext(path: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
#def splitunc(path: str) -> Tuple[str, str]: ... # Windows only, deprecated
# def splitunc(path: str) -> Tuple[str, str]: ... # Windows only, deprecated

View File

@@ -38,9 +38,9 @@ def samefile(path1: str, path2: str) -> bool: ...
def sameopenfile(fp1: IO[Any], fp2: IO[Any]) -> bool: ...
#def samestat(stat1: stat_result, stat2: stat_result) -> bool:
# def samestat(stat1: stat_result, stat2: stat_result) -> bool:
# ... # Unix only
def split(path: str) -> Tuple[str, str]: ...
def splitdrive(path: str) -> Tuple[str, str]: ...
def splitext(path: str) -> Tuple[str, str]: ...
#def splitunc(path: str) -> Tuple[str, str] : ... # Windows only, deprecated
# def splitunc(path: str) -> Tuple[str, str] : ... # Windows only, deprecated

View File

@@ -17,7 +17,7 @@ argv = ... # type: List[str]
byteorder = ... # type: str
builtin_module_names = ... # type: Sequence[str] # actually a tuple of strings
copyright = ... # type: str
#dllhandle = 0 # Windows only
# dllhandle = 0 # Windows only
dont_write_bytecode = False
__displayhook__ = ... # type: Any # contains the original value of displayhook
__excepthook__ = ... # type: Any # contains the original value of excepthook
@@ -53,7 +53,7 @@ api_version = 0
warnoptions = ... # type: Any
# Each entry is a tuple of the form (action, message, category, module,
# lineno)
#winver = '' # Windows only
# winver = '' # Windows only
_xoptions = ... # type: Dict[Any, Any]
flags = ... # type: _flags

View File

@@ -4,11 +4,11 @@
from typing import Any
from . import packages
#from .packages import six
# from .packages import six
from . import fields
#six = packages.six
#b = six.b
# six = packages.six
# b = six.b
RequestField = fields.RequestField
writer = ... # type: Any

View File

@@ -6,7 +6,7 @@ from typing import Any, IO
import io
from . import _collections
from . import exceptions
#from .packages import six
# from .packages import six
from . import connection
from .util import response

View File

@@ -3,9 +3,9 @@
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
#from ..packages import six
# from ..packages import six
#b = six.b
# b = six.b
ACCEPT_ENCODING = ... # type: Any

View File

@@ -29,8 +29,8 @@ binary_type = str
MAXSIZE = ... # type: int
#def add_move
#def remove_move
# def add_move
# def remove_move
def advance_iterator(it: typing.Iterator[_T]) -> _T: ...
next = advance_iterator
@@ -54,7 +54,7 @@ def get_function_globals(fun: types.FunctionType) -> Dict[str, Any]: ...
def iterkeys(d: Mapping[_K, _V]) -> typing.Iterator[_K]: ...
def itervalues(d: Mapping[_K, _V]) -> typing.Iterator[_V]: ...
def iteritems(d: Mapping[_K, _V]) -> typing.Iterator[Tuple[_K, _V]]: ...
#def iterlists
# def iterlists
def viewkeys(d: Mapping[_K, _V]) -> KeysView[_K]: ...
def viewvalues(d: Mapping[_K, _V]) -> ValuesView[_V]: ...

View File

@@ -3,12 +3,12 @@
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
#from yaml.error import *
#from yaml.tokens import *
#from yaml.events import *
#from yaml.nodes import *
#from yaml.loader import *
#from yaml.dumper import *
# from yaml.error import *
# from yaml.tokens import *
# from yaml.events import *
# from yaml.nodes import *
# from yaml.loader import *
# from yaml.dumper import *
# TODO: stubs for cyaml?
# from cyaml import *

View File

@@ -1,12 +1,12 @@
# Stubs for requests.cookies (Python 3)
from typing import Any, MutableMapping
#import cookielib
# import cookielib
from http import cookiejar as cookielib
import collections
from . import compat
#cookielib = compat.cookielib
# cookielib = compat.cookielib
class MockRequest:
type = ... # type: Any

View File

@@ -4,11 +4,11 @@
from typing import Any
from . import packages
#from .packages import six
# from .packages import six
from . import fields
#six = packages.six
#b = six.b
# six = packages.six
# b = six.b
RequestField = fields.RequestField
writer = ... # type: Any

View File

@@ -6,7 +6,7 @@ from typing import Any
import io
from . import _collections
from . import exceptions
#from .packages import six
# from .packages import six
from .connection import HTTPException as HTTPException, BaseSSLError as BaseSSLError
from .util import response

View File

@@ -3,9 +3,9 @@
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any
#from ..packages import six
# from ..packages import six
#b = six.b
# b = six.b
ACCEPT_ENCODING = ... # type: Any

View File

@@ -42,8 +42,8 @@ binary_type = bytes
MAXSIZE = ... # type: int
#def add_move
#def remove_move
# def add_move
# def remove_move
from builtins import next as advance_iterator
next = advance_iterator
@@ -66,7 +66,7 @@ def get_function_globals(fun: types.FunctionType) -> Dict[str, Any]: ...
def iterkeys(d: Mapping[_K, _V]) -> typing.Iterator[_K]: ...
def itervalues(d: Mapping[_K, _V]) -> typing.Iterator[_V]: ...
def iteritems(d: Mapping[_K, _V]) -> typing.Iterator[Tuple[_K, _V]]: ...
#def iterlists
# def iterlists
def viewkeys(d: Mapping[_K, _V]) -> KeysView[_K]: ...
def viewvalues(d: Mapping[_K, _V]) -> ValuesView[_V]: ...