python-utility-scripts 2.0.1__tar.gz → 2.0.5__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 (18) hide show
  1. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.5}/PKG-INFO +4 -4
  2. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.5}/apps/unused_code/unused_code.py +41 -1
  3. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.5}/pyproject.toml +5 -5
  4. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.5}/.gitignore +0 -0
  5. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.5}/LICENSE +0 -0
  6. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.5}/README.md +0 -0
  7. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.5}/apps/__init__.py +0 -0
  8. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.5}/apps/jira_utils/README.md +0 -0
  9. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.5}/apps/jira_utils/__init__.py +0 -0
  10. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.5}/apps/jira_utils/jira_information.py +0 -0
  11. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.5}/apps/polarion/README.md +0 -0
  12. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.5}/apps/polarion/__init__.py +0 -0
  13. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.5}/apps/polarion/polarion_set_automated.py +0 -0
  14. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.5}/apps/polarion/polarion_utils.py +0 -0
  15. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.5}/apps/polarion/polarion_verify_tc_requirements.py +0 -0
  16. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.5}/apps/unused_code/README.md +0 -0
  17. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.5}/apps/unused_code/__init__.py +0 -0
  18. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.5}/apps/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-utility-scripts
3
- Version: 2.0.1
3
+ Version: 2.0.5
4
4
  Summary: Python utility scripts
5
5
  Project-URL: Homepage, https://github.com/RedHatQE/python-utility-scripts
6
6
  Project-URL: Repository, https://github.com/RedHatQE/python-utility-scripts
@@ -14,10 +14,10 @@ Requires-Python: >=3.10
14
14
  Requires-Dist: ast-comments>=1.2.2
15
15
  Requires-Dist: click>=8.1.7
16
16
  Requires-Dist: jira<4,>=3.6.0
17
- Requires-Dist: pyhelper-utils<2,>=1.0.1
18
- Requires-Dist: pylero<0.2,>=0.1.0
17
+ Requires-Dist: pyhelper-utils<3,>=2
18
+ Requires-Dist: pylero<0.3,>=0.2
19
19
  Requires-Dist: pytest-mock<4,>=3.14.0
20
- Requires-Dist: python-simple-logger<3,>=2.0.3
20
+ Requires-Dist: python-simple-logger<3,>=2.0.4
21
21
  Requires-Dist: pyyaml<7,>=6.0.1
22
22
  Requires-Dist: tenacity<10,>=9.0.0
23
23
  Description-Content-Type: text/markdown
@@ -131,6 +131,22 @@ def _build_fixture_param_pattern(function_name: str) -> str:
131
131
  return rf"\<{function_name}\>[[:space:]]*[,:]"
132
132
 
133
133
 
134
+ def _build_keyword_unpacking_pattern(function_name: str) -> str:
135
+ r"""Build a portable regex to find keyword unpacking usage (**function_name()).
136
+
137
+ This pattern is designed to match patterns like **func_name() in function calls or dictionaries.
138
+ Uses word boundary semantics based on the detected grep engine.
139
+ - PCRE (-P): \*\*function_name\s*\(
140
+ - Basic (-G): \*\*function_name[[:space:]]*\(
141
+ """
142
+ flag = _detect_supported_grep_flag()
143
+ if flag == "-P":
144
+ # Match ** followed by function name followed by optional whitespace and opening parenthesis
145
+ return rf"\*\*{function_name}\s*\("
146
+ # For -G (basic regex), escape the asterisks and use POSIX classes
147
+ return rf"\*\*{function_name}[[:space:]]*\("
148
+
149
+
134
150
  def _is_pytest_mark_usefixtures_call(call_node: ast.Call) -> bool:
135
151
  """Check if an AST Call node represents pytest.mark.usefixtures(...)."""
136
152
  if isinstance(call_node.func, ast.Attribute):
@@ -334,7 +350,7 @@ def _is_documentation_pattern(line: str, function_name: str) -> bool:
334
350
 
335
351
  # Pattern 4: Check for common docstring patterns
336
352
  # Lines that start with common documentation patterns
337
- doc_starters = ['"""', "'''", "# ", "## ", "### ", "*", "-", "•"]
353
+ doc_starters = ['"""', "'''", "# ", "## ", "### ", "-", "•"]
338
354
  if any(stripped_line.startswith(starter) for starter in doc_starters):
339
355
  if f"{function_name}(" in stripped_line:
340
356
  return True
@@ -487,6 +503,30 @@ def process_file(py_file: str, func_ignore_prefix: list[str], file_ignore_list:
487
503
  used = True
488
504
  break
489
505
 
506
+ # If not found with general pattern, check for keyword unpacking usage (**func_name())
507
+ if not used:
508
+ for entry in _git_grep(
509
+ pattern=_build_keyword_unpacking_pattern(function_name=func.name), file_path=py_file
510
+ ):
511
+ LOGGER.debug(f"Checking {entry} function: {func.name}")
512
+ parts = entry.split(":", 2)
513
+ if len(parts) != 3:
514
+ continue
515
+ _, _, _line = parts
516
+
517
+ # Filter out documentation patterns that aren't actual function calls
518
+ if _is_documentation_pattern(line=_line, function_name=func.name):
519
+ LOGGER.debug(f"Skipping doc pattern {entry} function: {func.name}")
520
+ continue
521
+
522
+ # Ignore commented lines (full line or inline)
523
+ if _line.strip().startswith("#"):
524
+ continue
525
+
526
+ # If we find keyword unpacking usage, mark as used
527
+ used = True
528
+ break
529
+
490
530
  # If not found and it's a pytest fixture, check all fixture usage patterns
491
531
  if not used and is_pytest_fixture(func=func):
492
532
  patterns: list[tuple[str, Callable[..., bool] | None]] = [
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "python-utility-scripts"
3
- version = "2.0.1"
3
+ version = "2.0.5"
4
4
  description = "Python utility scripts"
5
5
  requires-python = ">=3.10"
6
6
  readme = "README.md"
@@ -10,13 +10,13 @@ classifiers = [
10
10
  "Operating System :: OS Independent",
11
11
  ]
12
12
  dependencies = [
13
- "pylero>=0.1.0,<0.2",
13
+ "pylero>=0.2,<0.3",
14
14
  "pytest-mock>=3.14.0,<4",
15
15
  "pyyaml>=6.0.1,<7",
16
16
  "jira>=3.6.0,<4",
17
17
  "tenacity>=9.0.0,<10",
18
- "python-simple-logger>=2.0.3,<3",
19
- "pyhelper-utils>=1.0.1,<2",
18
+ "python-simple-logger>=2.0.4,<3",
19
+ "pyhelper-utils>=2,<3",
20
20
  "ast-comments>=1.2.2",
21
21
  "click (>=8.1.7)",
22
22
  ]
@@ -40,7 +40,7 @@ pyutils-jira = "apps.jira_utils.jira_information:get_jira_mismatch"
40
40
  omit = ["tests/*"]
41
41
 
42
42
  [tool.coverage.report]
43
- fail_under = 60
43
+ fail_under = 70
44
44
  skip_empty = true
45
45
 
46
46
  [tool.coverage.html]