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.
Files changed (24) hide show
  1. {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/PKG-INFO +1 -1
  2. {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/pyproject.toml +1 -1
  3. {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
  4. {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
  5. {community_of_python_flake8_plugin-0.5.0 → community_of_python_flake8_plugin-0.5.2}/README.md +0 -0
  6. {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
  7. {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
  8. {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
  9. {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
  10. {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
  11. {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
  12. {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
  13. {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
  14. {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
  15. {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
  16. {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
  17. {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
  18. {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
  19. {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
  20. {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
  21. {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
  22. {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
  23. {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
  24. {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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: community-of-python-flake8-plugin
3
- Version: 0.5.0
3
+ Version: 0.5.2
4
4
  Summary: Community of Python flake8 plugin
5
5
  Author: Lev Vereshchagin
6
6
  Author-email: Lev Vereshchagin <mail@vrslev.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "community-of-python-flake8-plugin"
3
- version = "0.5.0"
3
+ version = "0.5.2"
4
4
  description = "Community of Python flake8 plugin"
5
5
  readme = "README.md"
6
6
  authors = [{ name = "Lev Vereshchagin", email = "mail@vrslev.com" }]
@@ -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 check_is_dunder_name(ast_node.name):
67
+ if check_is_ignored_function_definition(ast_node):
48
68
  return
49
69
  self.validate_arguments(ast_node.args, ast_node)
50
70
 
@@ -128,6 +128,8 @@ VERB_PREFIXES: typing.Final = {
128
128
  "fix",
129
129
  "classify",
130
130
  "try",
131
+ "download",
132
+ "post",
131
133
  }
132
134
 
133
135
  SCALAR_ANNOTATIONS: typing.Final = {"int", "str", "float", "bool", "bytes", "complex"}