python-utility-scripts 1.0.25__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.
- {python_utility_scripts-1.0.25 → python_utility_scripts-2.0.5}/PKG-INFO +5 -5
- {python_utility_scripts-1.0.25 → python_utility_scripts-2.0.5}/apps/unused_code/unused_code.py +41 -1
- python_utility_scripts-2.0.5/pyproject.toml +91 -0
- python_utility_scripts-1.0.25/pyproject.toml +0 -91
- {python_utility_scripts-1.0.25 → python_utility_scripts-2.0.5}/.gitignore +0 -0
- {python_utility_scripts-1.0.25 → python_utility_scripts-2.0.5}/LICENSE +0 -0
- {python_utility_scripts-1.0.25 → python_utility_scripts-2.0.5}/README.md +0 -0
- {python_utility_scripts-1.0.25 → python_utility_scripts-2.0.5}/apps/__init__.py +0 -0
- {python_utility_scripts-1.0.25 → python_utility_scripts-2.0.5}/apps/jira_utils/README.md +0 -0
- {python_utility_scripts-1.0.25 → python_utility_scripts-2.0.5}/apps/jira_utils/__init__.py +0 -0
- {python_utility_scripts-1.0.25 → python_utility_scripts-2.0.5}/apps/jira_utils/jira_information.py +0 -0
- {python_utility_scripts-1.0.25 → python_utility_scripts-2.0.5}/apps/polarion/README.md +0 -0
- {python_utility_scripts-1.0.25 → python_utility_scripts-2.0.5}/apps/polarion/__init__.py +0 -0
- {python_utility_scripts-1.0.25 → python_utility_scripts-2.0.5}/apps/polarion/polarion_set_automated.py +0 -0
- {python_utility_scripts-1.0.25 → python_utility_scripts-2.0.5}/apps/polarion/polarion_utils.py +0 -0
- {python_utility_scripts-1.0.25 → python_utility_scripts-2.0.5}/apps/polarion/polarion_verify_tc_requirements.py +0 -0
- {python_utility_scripts-1.0.25 → python_utility_scripts-2.0.5}/apps/unused_code/README.md +0 -0
- {python_utility_scripts-1.0.25 → python_utility_scripts-2.0.5}/apps/unused_code/__init__.py +0 -0
- {python_utility_scripts-1.0.25 → 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:
|
|
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
|
|
@@ -10,14 +10,14 @@ License-Expression: Apache-2.0
|
|
|
10
10
|
License-File: LICENSE
|
|
11
11
|
Classifier: Operating System :: OS Independent
|
|
12
12
|
Classifier: Programming Language :: Python :: 3
|
|
13
|
-
Requires-Python: >=3.
|
|
13
|
+
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
|
|
18
|
-
Requires-Dist: pylero<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.
|
|
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
|
{python_utility_scripts-1.0.25 → python_utility_scripts-2.0.5}/apps/unused_code/unused_code.py
RENAMED
|
@@ -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]] = [
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "python-utility-scripts"
|
|
3
|
+
version = "2.0.5"
|
|
4
|
+
description = "Python utility scripts"
|
|
5
|
+
requires-python = ">=3.10"
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
license = "Apache-2.0"
|
|
8
|
+
classifiers = [
|
|
9
|
+
"Programming Language :: Python :: 3",
|
|
10
|
+
"Operating System :: OS Independent",
|
|
11
|
+
]
|
|
12
|
+
dependencies = [
|
|
13
|
+
"pylero>=0.2,<0.3",
|
|
14
|
+
"pytest-mock>=3.14.0,<4",
|
|
15
|
+
"pyyaml>=6.0.1,<7",
|
|
16
|
+
"jira>=3.6.0,<4",
|
|
17
|
+
"tenacity>=9.0.0,<10",
|
|
18
|
+
"python-simple-logger>=2.0.4,<3",
|
|
19
|
+
"pyhelper-utils>=2,<3",
|
|
20
|
+
"ast-comments>=1.2.2",
|
|
21
|
+
"click (>=8.1.7)",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[[project.authors]]
|
|
25
|
+
name = "dbasunag"
|
|
26
|
+
email = "dbasunag@redhat.com"
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
Homepage = "https://github.com/RedHatQE/python-utility-scripts"
|
|
30
|
+
Repository = "https://github.com/RedHatQE/python-utility-scripts"
|
|
31
|
+
Documentation = "https://github.com/RedHatQE/python-utility-scripts/blob/main/README.md"
|
|
32
|
+
|
|
33
|
+
[project.scripts]
|
|
34
|
+
pyutils-unusedcode = "apps.unused_code.unused_code:get_unused_functions"
|
|
35
|
+
pyutils-polarion-verify-tc-requirements = "apps.polarion.polarion_verify_tc_requirements:has_verify"
|
|
36
|
+
pyutils-polarion-set-automated = "apps.polarion.polarion_set_automated:polarion_approve_automate"
|
|
37
|
+
pyutils-jira = "apps.jira_utils.jira_information:get_jira_mismatch"
|
|
38
|
+
|
|
39
|
+
[tool.coverage.run]
|
|
40
|
+
omit = ["tests/*"]
|
|
41
|
+
|
|
42
|
+
[tool.coverage.report]
|
|
43
|
+
fail_under = 70
|
|
44
|
+
skip_empty = true
|
|
45
|
+
|
|
46
|
+
[tool.coverage.html]
|
|
47
|
+
directory = ".tests_coverage"
|
|
48
|
+
show_contexts = false
|
|
49
|
+
|
|
50
|
+
[tool.uv]
|
|
51
|
+
default-groups = ["dev", "test"]
|
|
52
|
+
|
|
53
|
+
[tool.hatch.build.targets.sdist]
|
|
54
|
+
include = ["apps"]
|
|
55
|
+
|
|
56
|
+
[tool.hatch.build.targets.wheel]
|
|
57
|
+
include = ["apps"]
|
|
58
|
+
|
|
59
|
+
[tool.mypy]
|
|
60
|
+
show_error_codes = true
|
|
61
|
+
warn_unused_ignores = true
|
|
62
|
+
check_untyped_defs = true
|
|
63
|
+
disallow_any_generics = false
|
|
64
|
+
disallow_incomplete_defs = true
|
|
65
|
+
disallow_untyped_defs = true
|
|
66
|
+
no_implicit_optional = true
|
|
67
|
+
|
|
68
|
+
[tool.ruff]
|
|
69
|
+
preview = true
|
|
70
|
+
line-length = 120
|
|
71
|
+
fix = true
|
|
72
|
+
output-format = "grouped"
|
|
73
|
+
|
|
74
|
+
[tool.ruff.lint]
|
|
75
|
+
extend-select = ["I"]
|
|
76
|
+
|
|
77
|
+
[tool.ruff.format]
|
|
78
|
+
exclude = [".git", ".venv", ".mypy_cache", ".tox", "__pycache__"]
|
|
79
|
+
|
|
80
|
+
[dependency-groups]
|
|
81
|
+
dev = ["ipdb>=0.13.13,<0.14", "ipython"]
|
|
82
|
+
test = [
|
|
83
|
+
"ipdb>=0.13.13",
|
|
84
|
+
"ipython>=8.18.1",
|
|
85
|
+
"pytest>=9.0.0,<10",
|
|
86
|
+
"pytest-cov>=7.0.0,<8",
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
[build-system]
|
|
90
|
+
requires = ["hatchling"]
|
|
91
|
+
build-backend = "hatchling.build"
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
[project]
|
|
2
|
-
name = "python-utility-scripts"
|
|
3
|
-
version = "1.0.25"
|
|
4
|
-
description = "Python utility scripts"
|
|
5
|
-
requires-python = ">=3.9"
|
|
6
|
-
readme = "README.md"
|
|
7
|
-
license = "Apache-2.0"
|
|
8
|
-
classifiers = [
|
|
9
|
-
"Programming Language :: Python :: 3",
|
|
10
|
-
"Operating System :: OS Independent"
|
|
11
|
-
]
|
|
12
|
-
dependencies = [
|
|
13
|
-
"pylero>=0.1.0,<0.2",
|
|
14
|
-
"pytest-mock>=3.14.0,<4",
|
|
15
|
-
"pyyaml>=6.0.1,<7",
|
|
16
|
-
"jira>=3.6.0,<4",
|
|
17
|
-
"tenacity>=9.0.0,<10",
|
|
18
|
-
"python-simple-logger>=2.0.0,<3",
|
|
19
|
-
"pyhelper-utils>=1.0.1,<2",
|
|
20
|
-
"ast-comments>=1.2.2",
|
|
21
|
-
"click (>=8.1.7)"
|
|
22
|
-
]
|
|
23
|
-
|
|
24
|
-
[[project.authors]]
|
|
25
|
-
name = "dbasunag"
|
|
26
|
-
email = "dbasunag@redhat.com"
|
|
27
|
-
|
|
28
|
-
[project.urls]
|
|
29
|
-
Homepage = "https://github.com/RedHatQE/python-utility-scripts"
|
|
30
|
-
Repository = "https://github.com/RedHatQE/python-utility-scripts"
|
|
31
|
-
Documentation = "https://github.com/RedHatQE/python-utility-scripts/blob/main/README.md"
|
|
32
|
-
|
|
33
|
-
[project.scripts]
|
|
34
|
-
pyutils-unusedcode = "apps.unused_code.unused_code:get_unused_functions"
|
|
35
|
-
pyutils-polarion-verify-tc-requirements = "apps.polarion.polarion_verify_tc_requirements:has_verify"
|
|
36
|
-
pyutils-polarion-set-automated = "apps.polarion.polarion_set_automated:polarion_approve_automate"
|
|
37
|
-
pyutils-jira = "apps.jira_utils.jira_information:get_jira_mismatch"
|
|
38
|
-
|
|
39
|
-
[tool.coverage.run]
|
|
40
|
-
omit = [ "tests/*" ]
|
|
41
|
-
|
|
42
|
-
[tool.coverage.report]
|
|
43
|
-
fail_under = 68
|
|
44
|
-
skip_empty = true
|
|
45
|
-
|
|
46
|
-
[tool.coverage.html]
|
|
47
|
-
directory = ".tests_coverage"
|
|
48
|
-
show_contexts = false
|
|
49
|
-
|
|
50
|
-
[tool.uv]
|
|
51
|
-
default-groups = [ "dev", "test" ]
|
|
52
|
-
|
|
53
|
-
[tool.hatch.build.targets.sdist]
|
|
54
|
-
include = [ "apps" ]
|
|
55
|
-
|
|
56
|
-
[tool.hatch.build.targets.wheel]
|
|
57
|
-
include = [ "apps" ]
|
|
58
|
-
|
|
59
|
-
[tool.mypy]
|
|
60
|
-
show_error_codes = true
|
|
61
|
-
warn_unused_ignores = true
|
|
62
|
-
check_untyped_defs = true
|
|
63
|
-
disallow_any_generics = false
|
|
64
|
-
disallow_incomplete_defs = true
|
|
65
|
-
disallow_untyped_defs = true
|
|
66
|
-
no_implicit_optional = true
|
|
67
|
-
|
|
68
|
-
[tool.ruff]
|
|
69
|
-
preview = true
|
|
70
|
-
line-length = 120
|
|
71
|
-
fix = true
|
|
72
|
-
output-format = "grouped"
|
|
73
|
-
|
|
74
|
-
[tool.ruff.lint]
|
|
75
|
-
extend-select = [ "I" ]
|
|
76
|
-
|
|
77
|
-
[tool.ruff.format]
|
|
78
|
-
exclude = [ ".git", ".venv", ".mypy_cache", ".tox", "__pycache__" ]
|
|
79
|
-
|
|
80
|
-
[dependency-groups]
|
|
81
|
-
dev = [ "ipdb>=0.13.13,<0.14", "ipython" ]
|
|
82
|
-
test = [
|
|
83
|
-
"ipdb>=0.13.13",
|
|
84
|
-
"ipython>=8.18.1",
|
|
85
|
-
"pytest>=8.0.0,<9",
|
|
86
|
-
"pytest-cov>=6.0.0,<7"
|
|
87
|
-
]
|
|
88
|
-
|
|
89
|
-
[build-system]
|
|
90
|
-
requires = [ "hatchling" ]
|
|
91
|
-
build-backend = "hatchling.build"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_utility_scripts-1.0.25 → python_utility_scripts-2.0.5}/apps/jira_utils/jira_information.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_utility_scripts-1.0.25 → python_utility_scripts-2.0.5}/apps/polarion/polarion_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|