Use lowercase type everywhere (#6853)

This commit is contained in:
Alex Waygood
2022-01-08 15:09:29 +00:00
committed by GitHub
parent f8501d33c7
commit a40d79a4e6
172 changed files with 728 additions and 761 deletions

View File

@@ -1,8 +1,8 @@
import argparse
import ast
from typing import Any, Generic, Iterable, Iterator, Type, TypeVar
from typing import Any, Generic, Iterable, Iterator, TypeVar
FLAKE8_ERROR = tuple[int, int, str, Type[Any]]
FLAKE8_ERROR = tuple[int, int, str, type[Any]]
TConfig = TypeVar("TConfig") # noqa: Y001
class Error:
@@ -19,12 +19,12 @@ class Visitor(ast.NodeVisitor, Generic[TConfig]):
def __init__(self, config: TConfig | None = ...) -> None: ...
@property
def config(self) -> TConfig: ...
def error_from_node(self, error: Type[Error], node: ast.AST, **kwargs: Any) -> None: ...
def error_from_node(self, error: type[Error], node: ast.AST, **kwargs: Any) -> None: ...
class Plugin(Generic[TConfig]):
name: str
version: str
visitors: list[Type[Visitor[TConfig]]]
visitors: list[type[Visitor[TConfig]]]
config: TConfig
def __init__(self, tree: ast.AST) -> None: ...
def run(self) -> Iterable[FLAKE8_ERROR]: ...

View File

@@ -1,8 +1,8 @@
from typing import Any, Type
from typing import Any
from ..plugin import Error as Error, TConfig as TConfig, Visitor as Visitor
def assert_error(
visitor_cls: Type[Visitor[TConfig]], src: str, expected: Type[Error], config: TConfig | None = ..., **kwargs: Any
visitor_cls: type[Visitor[TConfig]], src: str, expected: type[Error], config: TConfig | None = ..., **kwargs: Any
) -> None: ...
def assert_not_error(visitor_cls: Type[Visitor[TConfig]], src: str, config: TConfig | None = ...) -> None: ...
def assert_not_error(visitor_cls: type[Visitor[TConfig]], src: str, config: TConfig | None = ...) -> None: ...