community-of-python-flake8-plugin 0.5.0__tar.gz → 0.5.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/PKG-INFO +1 -1
- {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/pyproject.toml +1 -1
- {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/src/community_of_python_flake8_plugin/checks/function_keyword_only_args.py +21 -1
- {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/src/community_of_python_flake8_plugin/constants.py +2 -0
- {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/README.md +0 -0
- {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/src/community_of_python_flake8_plugin/__init__.py +0 -0
- {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/src/community_of_python_flake8_plugin/checks/__init__.py +0 -0
- {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/src/community_of_python_flake8_plugin/checks/async_get_prefix.py +0 -0
- {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/src/community_of_python_flake8_plugin/checks/dataclass_config.py +0 -0
- {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/src/community_of_python_flake8_plugin/checks/disabled/__init__.py +0 -0
- {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/src/community_of_python_flake8_plugin/checks/disabled/module_import_many_names.py +0 -0
- {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/src/community_of_python_flake8_plugin/checks/final_class.py +0 -0
- {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/src/community_of_python_flake8_plugin/checks/for_loop_one_prefix.py +0 -0
- {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/src/community_of_python_flake8_plugin/checks/function_verb.py +0 -0
- {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/src/community_of_python_flake8_plugin/checks/mapping_proxy.py +0 -0
- {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/src/community_of_python_flake8_plugin/checks/module_import_stdlib.py +0 -0
- {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/src/community_of_python_flake8_plugin/checks/name_length.py +0 -0
- {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/src/community_of_python_flake8_plugin/checks/scalar_annotation.py +0 -0
- {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/src/community_of_python_flake8_plugin/checks/temp_var.py +0 -0
- {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/src/community_of_python_flake8_plugin/plugin.py +0 -0
- {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/src/community_of_python_flake8_plugin/py.typed +0 -0
- {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/src/community_of_python_flake8_plugin/utils.py +0 -0
- {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/src/community_of_python_flake8_plugin/violation_codes.py +0 -0
- {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/src/community_of_python_flake8_plugin/violations.py +0 -0
|
@@ -14,6 +14,26 @@ def check_is_dunder_name(identifier: str) -> bool:
|
|
|
14
14
|
return bool(identifier.startswith("__") and identifier.endswith("__"))
|
|
15
15
|
|
|
16
16
|
|
|
17
|
+
def check_is_pytest_fixture_decorator(decorator: ast.expr) -> bool:
|
|
18
|
+
if isinstance(decorator, ast.Attribute):
|
|
19
|
+
return decorator.attr == "fixture" and isinstance(decorator.value, ast.Name) and decorator.value.id == "pytest"
|
|
20
|
+
if isinstance(decorator, ast.Call) and isinstance(decorator.func, ast.Attribute):
|
|
21
|
+
return (
|
|
22
|
+
decorator.func.attr == "fixture"
|
|
23
|
+
and isinstance(decorator.func.value, ast.Name)
|
|
24
|
+
and decorator.func.value.id == "pytest"
|
|
25
|
+
)
|
|
26
|
+
return False
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def check_is_ignored_function_definition(ast_node: ast.FunctionDef | ast.AsyncFunctionDef) -> bool:
|
|
30
|
+
return (
|
|
31
|
+
check_is_dunder_name(ast_node.name)
|
|
32
|
+
or ast_node.name.startswith("test_")
|
|
33
|
+
or any(check_is_pytest_fixture_decorator(one_decorator) for one_decorator in ast_node.decorator_list) # noqa: COP011
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
17
37
|
def get_positional_arguments(arguments_node: ast.arguments) -> list[ast.arg]:
|
|
18
38
|
positional_arguments: typing.Final = [*arguments_node.posonlyargs, *arguments_node.args]
|
|
19
39
|
if positional_arguments and positional_arguments[0].arg in IGNORED_BOUND_ARGUMENT_NAMES:
|
|
@@ -44,7 +64,7 @@ class COP016FunctionKeywordOnlyArgsCheck(ast.NodeVisitor):
|
|
|
44
64
|
self.generic_visit(ast_node)
|
|
45
65
|
|
|
46
66
|
def validate_function_definition(self, ast_node: ast.FunctionDef | ast.AsyncFunctionDef) -> None:
|
|
47
|
-
if
|
|
67
|
+
if check_is_ignored_function_definition(ast_node):
|
|
48
68
|
return
|
|
49
69
|
self.validate_arguments(ast_node.args, ast_node)
|
|
50
70
|
|
{community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/README.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|