File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import typing
44
55from community_of_python_flake8_plugin .constants import VERB_PREFIXES
6+ from community_of_python_flake8_plugin .violation_codes import ViolationCodes
67from community_of_python_flake8_plugin .violations import Violation
78
8- from community_of_python_flake8_plugin . violation_codes import ViolationCodes
9+
910def check_is_verb_name (identifier : str ) -> bool :
1011 return any (identifier == verb or identifier .startswith (f"{ verb } _" ) for verb in VERB_PREFIXES )
1112
Original file line number Diff line number Diff line change 33import typing
44
55from community_of_python_flake8_plugin .constants import FINAL_CLASS_EXCLUDED_BASES
6- from community_of_python_flake8_plugin .violations import Violation
76from community_of_python_flake8_plugin .violation_codes import ViolationCodes
7+ from community_of_python_flake8_plugin .violations import Violation
8+
89
910def is_dataclass_decorator (decorator : ast .expr ) -> bool :
1011 """Check if the decorator is a dataclass decorator."""
Original file line number Diff line number Diff line change 22import ast
33import typing
44
5+ from community_of_python_flake8_plugin .violation_codes import ViolationCodes
56from community_of_python_flake8_plugin .violations import Violation
67
7- from community_of_python_flake8_plugin . violation_codes import ViolationCodes
8+
89def contains_final_decorator (class_node : ast .ClassDef ) -> bool :
910 for decorator in class_node .decorator_list :
1011 target_name = decorator .func if isinstance (decorator , ast .Call ) else decorator
Original file line number Diff line number Diff line change 44
55from community_of_python_flake8_plugin .constants import FINAL_CLASS_EXCLUDED_BASES , VERB_PREFIXES
66from community_of_python_flake8_plugin .utils import find_parent_class_definition
7- from community_of_python_flake8_plugin .violations import Violation
87from community_of_python_flake8_plugin .violation_codes import ViolationCodes
8+ from community_of_python_flake8_plugin .violations import Violation
9+
910
1011def check_is_ignored_name (identifier : str ) -> bool :
1112 if identifier == "_" :
Original file line number Diff line number Diff line change 33import typing
44
55from community_of_python_flake8_plugin .constants import MAPPING_PROXY_TYPES
6+ from community_of_python_flake8_plugin .violation_codes import ViolationCodes
67from community_of_python_flake8_plugin .violations import Violation
78
8- from community_of_python_flake8_plugin . violation_codes import ViolationCodes
9+
910def is_mapping_proxy_type (annotation : ast .expr | None ) -> bool :
1011 if annotation is None :
1112 return False
Original file line number Diff line number Diff line change 44
55from community_of_python_flake8_plugin .constants import FINAL_CLASS_EXCLUDED_BASES , MIN_NAME_LENGTH
66from community_of_python_flake8_plugin .utils import find_parent_class_definition
7- from community_of_python_flake8_plugin .violations import Violation
87from community_of_python_flake8_plugin .violation_codes import ViolationCodes
8+ from community_of_python_flake8_plugin .violations import Violation
9+
910
1011def check_is_ignored_name (identifier : str ) -> bool :
1112 if identifier == "_" :
Original file line number Diff line number Diff line change 44
55from community_of_python_flake8_plugin .constants import SCALAR_ANNOTATIONS
66from community_of_python_flake8_plugin .utils import find_parent_class_definition , find_parent_function
7- from community_of_python_flake8_plugin .violations import Violation
87from community_of_python_flake8_plugin .violation_codes import ViolationCodes
8+ from community_of_python_flake8_plugin .violations import Violation
9+
910
1011def check_is_literal_value (node_value : ast .AST ) -> bool :
1112 if isinstance (node_value , ast .Constant ):
@@ -37,7 +38,7 @@ def check_is_scalar_annotation(annotation_node: ast.AST) -> bool:
3738
3839@typing .final
3940class ScalarAnnotationCheck (ast .NodeVisitor ):
40- def __init__ (self , tree : ast .AST ) -> None :
41+ def __init__ (self , tree : ast .AST ) -> None : # noqa: COP004G
4142 self .violations : list [Violation ] = []
4243 self .syntax_tree : typing .Final [ast .AST ] = tree
4344
Original file line number Diff line number Diff line change 33import typing
44from collections import defaultdict
55
6- from community_of_python_flake8_plugin .violations import Violation
76from community_of_python_flake8_plugin .violation_codes import ViolationCodes
7+ from community_of_python_flake8_plugin .violations import Violation
8+
89
910def collect_variable_usage (function_node : ast .AST ) -> dict [str , list [ast .Name ]]:
1011 variable_usage : typing .Final [defaultdict [str , list [ast .Name ]]] = defaultdict (list )
You can’t perform that action at this time.
0 commit comments