flake8: Enable F811 (#4158)

This commit is contained in:
Sebastian Rittau
2020-06-02 23:08:54 +02:00
committed by GitHub
parent 43cf0ec870
commit a913af9523
15 changed files with 19 additions and 20 deletions

View File

@@ -7,7 +7,6 @@
# F401 imported but unused
# F403 import *' used; unable to detect undefined names
# F405 defined from star imports
# F811 redefinition (should be fixed in pyflakes 2.1.2)
# F822 undefined name in __all__
# Nice-to-haves ignored for now
@@ -15,7 +14,10 @@
[flake8]
per-file-ignores =
*.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F811, F822
*.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F822
# Since typing.pyi defines "overload" this is not recognized by flake8 as typing.overload.
# Unfortunately, flake8 does not allow to "noqa" just a specific error inside the file itself.
typing.pyi: E301, E302, E305, E501, E701, E741, F401, F403, F405, F811, F822
# We are checking with Python 3 but many of the stubs are Python 2 stubs.
builtins = StandardError,apply,basestring,buffer,cmp,coerce,execfile,file,intern,long,raw_input,reduce,reload,unichr,unicode,xrange

View File

@@ -1,7 +1,7 @@
git+https://github.com/python/mypy.git@master
typed-ast>=1.0.4
black==19.3b0
flake8==3.8.1
flake8==3.8.2
flake8-bugbear==20.1.4
flake8-pyi==20.5.0
isort==4.3.21

View File

@@ -52,7 +52,7 @@ class object:
@property
def __class__(self: _T) -> Type[_T]: ...
@__class__.setter
def __class__(self, __type: Type[object]) -> None: ...
def __class__(self, __type: Type[object]) -> None: ... # noqa: F811
def __init__(self) -> None: ...
def __new__(cls) -> Any: ...
def __setattr__(self, name: str, value: Any) -> None: ...
@@ -1503,7 +1503,7 @@ else:
def pow(__base: _SupportsPow3[_E, _M, _T_co], __exp: _E, __mod: _M) -> _T_co: ...
def quit(code: object = ...) -> NoReturn: ...
if sys.version_info < (3,):
def range(__x: int, __y: int = ..., __step: int = ...) -> List[int]: ...
def range(__x: int, __y: int = ..., __step: int = ...) -> List[int]: ... # noqa: F811
def raw_input(__prompt: Any = ...) -> str: ...
@overload
def reduce(__function: Callable[[_T, _S], _T], __iterable: Iterable[_S], __initializer: _T) -> _T: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, List, Tuple, Dict, Generic, Tuple
from typing import Any, Dict, Generic, List, Tuple
def encode_basestring_ascii(*args, **kwargs) -> str: ...
def scanstring(a, b, *args, **kwargs) -> Tuple[Any, ...]: ...

View File

@@ -52,7 +52,7 @@ class object:
@property
def __class__(self: _T) -> Type[_T]: ...
@__class__.setter
def __class__(self, __type: Type[object]) -> None: ...
def __class__(self, __type: Type[object]) -> None: ... # noqa: F811
def __init__(self) -> None: ...
def __new__(cls) -> Any: ...
def __setattr__(self, name: str, value: Any) -> None: ...
@@ -1503,7 +1503,7 @@ else:
def pow(__base: _SupportsPow3[_E, _M, _T_co], __exp: _E, __mod: _M) -> _T_co: ...
def quit(code: object = ...) -> NoReturn: ...
if sys.version_info < (3,):
def range(__x: int, __y: int = ..., __step: int = ...) -> List[int]: ...
def range(__x: int, __y: int = ..., __step: int = ...) -> List[int]: ... # noqa: F811
def raw_input(__prompt: Any = ...) -> str: ...
@overload
def reduce(__function: Callable[[_T, _S], _T], __iterable: Iterable[_S], __initializer: _T) -> _T: ...

View File

@@ -1,7 +1,7 @@
# Stubs for distutils.dist
from distutils.cmd import Command
from typing import Any, Dict, Mapping, Optional, Dict, Tuple, Iterable, Text, Type
from typing import Any, Dict, Iterable, Mapping, Optional, Text, Tuple, Type
class Distribution:

View File

@@ -1,6 +1,6 @@
# Stubs for hmac
from typing import Any, Callable, Optional, Union, overload, AnyStr, overload
from typing import Any, AnyStr, Callable, Optional, Union, overload
from types import ModuleType
import sys

View File

@@ -103,5 +103,5 @@ if sys.version_info >= (3, 8):
class SharedMemoryServer(Server): ...
class SharedMemoryManager(BaseManager):
def get_server(self) -> SharedMemoryServer: ...
def SharedMemory(self, size: int) -> SharedMemory: ...
def ShareableList(self, sequence: Optional[Iterable[_SLT]]) -> ShareableList[_SLT]: ...
def SharedMemory(self, size: int) -> SharedMemory: ... # noqa: F811
def ShareableList(self, sequence: Optional[Iterable[_SLT]]) -> ShareableList[_SLT]: ... # noqa: F811

View File

@@ -6,7 +6,6 @@ from typing import (
IO,
List,
Optional,
Text,
overload,
Text,
Tuple,

View File

@@ -5,7 +5,6 @@
from .blueprints import Blueprint
from .config import Config, ConfigAttribute
from .ctx import AppContext, RequestContext, _AppCtxGlobals
from .globals import _request_ctx_stack, g, request, session
from .helpers import _PackageBoundObject, find_package, get_debug_flag, get_env, get_flashed_messages, get_load_dotenv, locked_cached_property, url_for
from .logging import create_logger
from .sessions import SecureCookieSessionInterface

View File

@@ -21,7 +21,7 @@ class Markup(text_type):
def unescape(self) -> Text: ...
def striptags(self) -> Text: ...
@classmethod
def escape(cls, s: text_type) -> Markup: ...
def escape(cls, s: text_type) -> Markup: ... # noqa: F811
def partition(self, sep: text_type) -> Tuple[Markup, Markup, Markup]: ...
def rpartition(self, sep: text_type) -> Tuple[Markup, Markup, Markup]: ...
def format(self, *args, **kwargs) -> Markup: ...
@@ -46,7 +46,7 @@ class Markup(text_type):
class EscapeFormatter(string.Formatter):
escape: Callable[[text_type], Markup]
def __init__(self, escape: Callable[[text_type], Markup]) -> None: ...
def __init__(self, escape: Callable[[text_type], Markup]) -> None: ... # noqa: F811
def format_field(self, value: text_type, format_spec: text_type) -> Markup: ...
if sys.version_info >= (3,):

View File

@@ -12,7 +12,7 @@ from typing import overload as overload
from typing import Text as Text
from typing import Type as Type
from typing import TYPE_CHECKING as TYPE_CHECKING
from typing import TypeVar, Any, Mapping, ItemsView, KeysView, Optional, ValuesView, Dict, Type
from typing import TypeVar, Any, Mapping, ItemsView, KeysView, Optional, ValuesView, Dict
_T = TypeVar('_T')
_F = TypeVar('_F', bound=Callable[..., Any])

View File

@@ -1,4 +1,4 @@
from .utilities import BadRequest, logger, undquote
from .utilities import BadRequest
from collections import namedtuple
from logging import Logger
from typing import Any, Callable, Mapping, Sequence, Optional, Set

View File

@@ -2,7 +2,6 @@ from . import wasyncore
from .proxy_headers import proxy_headers_middleware
from socket import SocketType
from typing import Any, Sequence, Optional, Tuple, Union
from waitress import trigger
from waitress.adjustments import Adjustments
from waitress.channel import HTTPChannel
from waitress.compat import IPPROTO_IPV6, IPV6_V6ONLY

View File

@@ -1,7 +1,7 @@
from .buffers import ReadOnlyFileBasedBuffer
from .channel import HTTPChannel
from .compat import reraise, tobytes
from .utilities import Error, build_http_date, logger, queue_logger
from .utilities import Error
from logging import Logger
from threading import Condition, Lock
from typing import Any, Deque, Mapping, Sequence, Optional, Set, Tuple