python-utility-scripts 2.0.1__tar.gz → 2.0.6__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.6}/PKG-INFO +4 -4
  2. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.6}/apps/jira_utils/jira_information.py +37 -5
  3. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.6}/apps/unused_code/unused_code.py +166 -120
  4. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.6}/apps/utils.py +3 -2
  5. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.6}/pyproject.toml +5 -5
  6. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.6}/.gitignore +0 -0
  7. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.6}/LICENSE +0 -0
  8. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.6}/README.md +0 -0
  9. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.6}/apps/__init__.py +0 -0
  10. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.6}/apps/jira_utils/README.md +0 -0
  11. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.6}/apps/jira_utils/__init__.py +0 -0
  12. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.6}/apps/polarion/README.md +0 -0
  13. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.6}/apps/polarion/__init__.py +0 -0
  14. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.6}/apps/polarion/polarion_set_automated.py +0 -0
  15. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.6}/apps/polarion/polarion_utils.py +0 -0
  16. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.6}/apps/polarion/polarion_verify_tc_requirements.py +0 -0
  17. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.6}/apps/unused_code/README.md +0 -0
  18. {python_utility_scripts-2.0.1 → python_utility_scripts-2.0.6}/apps/unused_code/__init__.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.6
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
@@ -122,7 +122,7 @@ def get_jira_information(
122
122
  jira_fix_versions = ",".join([jira_fix_version.name for jira_fix_version in jira_fix_versions])
123
123
  current_target_versions = re.findall(re_compile, jira_fix_versions)
124
124
 
125
- if any([version in jira_target_versions for version in current_target_versions]):
125
+ if any(version in jira_target_versions for version in current_target_versions):
126
126
  return file_name, jira_error_string
127
127
 
128
128
  else:
@@ -146,16 +146,24 @@ def process_jira_command_line_config_file(
146
146
  version_string_not_targeted_jiras: str,
147
147
  target_versions: list[str],
148
148
  skip_projects: list[str],
149
+ user: str,
150
+ cloud: bool | None,
149
151
  ) -> dict[str, Any]:
150
152
  # Process all the arguments passed from command line or config file or environment variable
151
153
  config_dict = get_util_config(util_name="pyutils-jira", config_file_path=config_file_path)
152
154
  url = url or config_dict.get("url", "")
153
155
  token = token or config_dict.get("token", "")
156
+ user = user or config_dict.get("user", "")
157
+ cloud = cloud if cloud is not None else config_dict.get("cloud", False)
154
158
 
155
159
  if not (url and token):
156
160
  LOGGER.error("Jira url and token are required.")
157
161
  sys.exit(1)
158
162
 
163
+ if cloud and not user:
164
+ LOGGER.error("Jira user is required for cloud Jira.")
165
+ sys.exit(1)
166
+
159
167
  return {
160
168
  "url": url,
161
169
  "token": token,
@@ -166,6 +174,8 @@ def process_jira_command_line_config_file(
166
174
  ),
167
175
  "target_versions": target_versions or config_dict.get("target_versions", []),
168
176
  "skip_project_ids": skip_projects or config_dict.get("skip_project_ids", []),
177
+ "user": user,
178
+ "cloud": cloud,
169
179
  }
170
180
 
171
181
 
@@ -197,6 +207,12 @@ def process_jira_command_line_config_file(
197
207
  type=click.STRING,
198
208
  default=os.getenv("JIRA_TOKEN"),
199
209
  )
210
+ @click.option(
211
+ "--user",
212
+ help="Provide the Jira user email (required for cloud Jira).",
213
+ type=click.STRING,
214
+ default=os.getenv("JIRA_USER"),
215
+ )
200
216
  @click.option(
201
217
  "--issue-pattern",
202
218
  help="Provide the regex for Jira ids",
@@ -219,16 +235,24 @@ def process_jira_command_line_config_file(
219
235
  default="vfuture",
220
236
  )
221
237
  @click.option("--verbose", default=False, is_flag=True)
238
+ @click.option(
239
+ "--cloud",
240
+ help="Use cloud Jira authentication (basic_auth with user email and API token).",
241
+ is_flag=True,
242
+ default=None,
243
+ )
222
244
  def get_jira_mismatch(
223
245
  config_file_path: str,
224
246
  target_versions: list[str],
225
247
  url: str,
226
248
  token: str,
249
+ user: str,
227
250
  skip_projects: list[str],
228
251
  resolved_statuses: list[str],
229
252
  issue_pattern: str,
230
253
  version_string_not_targeted_jiras: str,
231
254
  verbose: bool,
255
+ cloud: bool | None,
232
256
  ) -> None:
233
257
  LOGGER.setLevel(logging.DEBUG if verbose else logging.INFO)
234
258
  if not (config_file_path or (token and url)):
@@ -245,12 +269,20 @@ def get_jira_mismatch(
245
269
  skip_projects=skip_projects,
246
270
  version_string_not_targeted_jiras=version_string_not_targeted_jiras,
247
271
  target_versions=target_versions,
272
+ user=user,
273
+ cloud=cloud,
248
274
  )
249
275
 
250
- jira_obj = JIRA(
251
- token_auth=jira_config_dict["token"],
252
- options={"server": jira_config_dict["url"]},
253
- )
276
+ if jira_config_dict["cloud"]:
277
+ jira_obj = JIRA(
278
+ server=jira_config_dict["url"],
279
+ basic_auth=(jira_config_dict["user"], jira_config_dict["token"]),
280
+ )
281
+ else:
282
+ jira_obj = JIRA(
283
+ token_auth=jira_config_dict["token"],
284
+ options={"server": jira_config_dict["url"]},
285
+ )
254
286
  jira_error: dict[str, str] = {}
255
287
 
256
288
  if jira_id_dict := get_jiras_from_python_files(
@@ -6,10 +6,11 @@ import os
6
6
  import re
7
7
  import subprocess
8
8
  import sys
9
+ from collections.abc import Callable, Iterable
9
10
  from concurrent.futures import Future, ThreadPoolExecutor, as_completed
10
11
  from functools import lru_cache
11
12
  from pathlib import Path
12
- from typing import Any, Callable, Iterable
13
+ from typing import Any
13
14
 
14
15
  import click
15
16
  from ast_comments import parse
@@ -46,9 +47,9 @@ def _detect_supported_grep_flag() -> str:
46
47
  result = subprocess.run(probe_cmd, check=False, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
47
48
  if result.returncode in (0, 1):
48
49
  return flag
49
- except Exception:
50
+ except (OSError, subprocess.SubprocessError):
50
51
  # Try next candidate
51
- pass
52
+ LOGGER.debug(f"git grep flag {flag!r} probe failed, trying next candidate")
52
53
 
53
54
  raise RuntimeError(
54
55
  "git grep does not support '-P' (PCRE) or '-G' (basic regex) on this platform. "
@@ -62,11 +63,15 @@ def is_fixture_autouse(func: ast.FunctionDef) -> bool:
62
63
  if not hasattr(deco, "func"):
63
64
  continue
64
65
 
65
- if getattr(deco.func, "attr", None) and getattr(deco.func, "value", None):
66
- if deco.func.attr == "fixture" and deco.func.value.id == "pytest":
67
- for _key in deco.keywords:
68
- if _key.arg == "autouse":
69
- return True
66
+ if (
67
+ getattr(deco.func, "attr", None)
68
+ and getattr(deco.func, "value", None)
69
+ and deco.func.attr == "fixture"
70
+ and deco.func.value.id == "pytest"
71
+ ):
72
+ for _key in deco.keywords:
73
+ if _key.arg == "autouse":
74
+ return True
70
75
  return False
71
76
 
72
77
 
@@ -80,18 +85,25 @@ def is_pytest_fixture(func: ast.FunctionDef) -> bool:
80
85
  # Case 1: @pytest.fixture(...)
81
86
  if hasattr(decorator, "func"):
82
87
  # e.g. @pytest.fixture(...)
83
- if getattr(decorator.func, "attr", None) and getattr(decorator.func, "value", None):
84
- if decorator.func.attr == "fixture" and getattr(decorator.func.value, "id", None) == "pytest":
85
- return True
88
+ if (
89
+ getattr(decorator.func, "attr", None)
90
+ and getattr(decorator.func, "value", None)
91
+ and decorator.func.attr == "fixture"
92
+ and getattr(decorator.func.value, "id", None) == "pytest"
93
+ ):
94
+ return True
86
95
  # e.g. from pytest import fixture; @fixture(...)
87
96
  if isinstance(decorator.func, ast.Name) and decorator.func.id == "fixture":
88
97
  return True
89
98
  # Case 2: @pytest.fixture (no parentheses)
90
99
  else:
91
100
  # e.g. @pytest.fixture
92
- if getattr(decorator, "attr", None) == "fixture" and getattr(decorator, "value", None):
93
- if getattr(decorator.value, "id", None) == "pytest":
94
- return True
101
+ if (
102
+ getattr(decorator, "attr", None) == "fixture"
103
+ and getattr(decorator, "value", None)
104
+ and getattr(decorator.value, "id", None) == "pytest"
105
+ ):
106
+ return True
95
107
  # e.g. from pytest import fixture; @fixture
96
108
  if isinstance(decorator, ast.Name) and decorator.id == "fixture":
97
109
  return True
@@ -131,19 +143,32 @@ def _build_fixture_param_pattern(function_name: str) -> str:
131
143
  return rf"\<{function_name}\>[[:space:]]*[,:]"
132
144
 
133
145
 
146
+ def _build_keyword_unpacking_pattern(function_name: str) -> str:
147
+ r"""Build a portable regex to find keyword unpacking usage (**function_name()).
148
+
149
+ This pattern is designed to match patterns like **func_name() in function calls or dictionaries.
150
+ Uses word boundary semantics based on the detected grep engine.
151
+ - PCRE (-P): \*\*function_name\s*\(
152
+ - Basic (-G): \*\*function_name[[:space:]]*\(
153
+ """
154
+ flag = _detect_supported_grep_flag()
155
+ if flag == "-P":
156
+ # Match ** followed by function name followed by optional whitespace and opening parenthesis
157
+ return rf"\*\*{function_name}\s*\("
158
+ # For -G (basic regex), escape the asterisks and use POSIX classes
159
+ return rf"\*\*{function_name}[[:space:]]*\("
160
+
161
+
134
162
  def _is_pytest_mark_usefixtures_call(call_node: ast.Call) -> bool:
135
163
  """Check if an AST Call node represents pytest.mark.usefixtures(...)."""
136
- if isinstance(call_node.func, ast.Attribute):
137
- # Handle pytest.mark.usefixtures
138
- if (
139
- call_node.func.attr == "usefixtures"
140
- and isinstance(call_node.func.value, ast.Attribute)
141
- and call_node.func.value.attr == "mark"
142
- and isinstance(call_node.func.value.value, ast.Name)
143
- and call_node.func.value.value.id == "pytest"
144
- ):
145
- return True
146
- return False
164
+ return (
165
+ isinstance(call_node.func, ast.Attribute)
166
+ and call_node.func.attr == "usefixtures"
167
+ and isinstance(call_node.func.value, ast.Attribute)
168
+ and call_node.func.value.attr == "mark"
169
+ and isinstance(call_node.func.value.value, ast.Name)
170
+ and call_node.func.value.value.id == "pytest"
171
+ )
147
172
 
148
173
 
149
174
  def _check_fixturenames_insert_pattern(fixture_name: str, file_path: str) -> bool:
@@ -157,27 +182,27 @@ def _check_fixturenames_insert_pattern(fixture_name: str, file_path: str) -> boo
157
182
  content = f.read()
158
183
 
159
184
  tree = parse(source=content)
160
-
161
- # Look for method calls like item.fixturenames.insert(...)
162
- for node in ast.walk(tree):
163
- if isinstance(node, ast.Call):
164
- # Check for attribute calls like item.fixturenames.insert
165
- if (
166
- isinstance(node.func, ast.Attribute)
167
- and node.func.attr == "insert"
168
- and isinstance(node.func.value, ast.Attribute)
169
- and node.func.value.attr == "fixturenames"
170
- ):
171
- # Check the arguments for our fixture name
172
- for arg in node.args:
173
- if isinstance(arg, ast.Constant) and isinstance(arg.value, str):
174
- if arg.value == fixture_name:
175
- return True
176
-
177
- return False
178
185
  except (FileNotFoundError, SyntaxError, ValueError):
179
186
  return False
180
187
 
188
+ # Look for method calls like item.fixturenames.insert(...)
189
+ for node in ast.walk(tree):
190
+ if not isinstance(node, ast.Call):
191
+ continue
192
+ # Check for attribute calls like item.fixturenames.insert
193
+ if (
194
+ isinstance(node.func, ast.Attribute)
195
+ and node.func.attr == "insert"
196
+ and isinstance(node.func.value, ast.Attribute)
197
+ and node.func.value.attr == "fixturenames"
198
+ ):
199
+ # Check the arguments for our fixture name
200
+ for arg in node.args:
201
+ if isinstance(arg, ast.Constant) and isinstance(arg.value, str) and arg.value == fixture_name:
202
+ return True
203
+
204
+ return False
205
+
181
206
 
182
207
  def _check_getfixturevalue_pattern(fixture_name: str, file_path: str) -> bool:
183
208
  """Check if a fixture is used in request.getfixturevalue() pattern.
@@ -191,31 +216,31 @@ def _check_getfixturevalue_pattern(fixture_name: str, file_path: str) -> bool:
191
216
  content = f.read()
192
217
 
193
218
  tree = parse(source=content)
219
+ except (FileNotFoundError, SyntaxError, ValueError):
220
+ return False
194
221
 
195
- # Look for method calls like request.getfixturevalue(...)
196
- for node in ast.walk(tree):
197
- if isinstance(node, ast.Call):
198
- # Check for attribute calls like request.getfixturevalue
199
- if isinstance(node.func, ast.Attribute) and node.func.attr == "getfixturevalue":
200
- # Check positional arguments
201
- for arg in node.args:
202
- if isinstance(arg, ast.Constant) and isinstance(arg.value, str):
203
- if arg.value == fixture_name:
204
- return True
222
+ # Look for method calls like request.getfixturevalue(...)
223
+ for node in ast.walk(tree):
224
+ if not isinstance(node, ast.Call):
225
+ continue
226
+ # Check for attribute calls like request.getfixturevalue
227
+ if isinstance(node.func, ast.Attribute) and node.func.attr == "getfixturevalue":
228
+ # Check positional arguments
229
+ for arg in node.args:
230
+ if isinstance(arg, ast.Constant) and isinstance(arg.value, str) and arg.value == fixture_name:
231
+ return True
205
232
 
206
- # Check keyword arguments (argname="fixture_name")
207
- for keyword in node.keywords:
208
- if keyword.arg == "argname":
209
- if (
210
- isinstance(keyword.value, ast.Constant)
211
- and isinstance(keyword.value.value, str)
212
- and keyword.value.value == fixture_name
213
- ):
214
- return True
233
+ # Check keyword arguments (argname="fixture_name")
234
+ for keyword in node.keywords:
235
+ if (
236
+ keyword.arg == "argname"
237
+ and isinstance(keyword.value, ast.Constant)
238
+ and isinstance(keyword.value.value, str)
239
+ and keyword.value.value == fixture_name
240
+ ):
241
+ return True
215
242
 
216
- return False
217
- except (FileNotFoundError, SyntaxError, ValueError):
218
- return False
243
+ return False
219
244
 
220
245
 
221
246
  def _is_usefixtures_context(file_path: str, line_number: str, fixture_name: str) -> bool:
@@ -230,55 +255,59 @@ def _is_usefixtures_context(file_path: str, line_number: str, fixture_name: str)
230
255
  # Parse the AST of the file
231
256
  tree = parse(source=content)
232
257
  target_line = int(line_number)
258
+ except (FileNotFoundError, SyntaxError, ValueError):
259
+ return False
233
260
 
234
- # Look for pytest.mark.usefixtures calls that span the target line
235
- for node in ast.walk(tree):
236
- if isinstance(node, ast.Assign):
237
- # Check if the value is a call to pytest.mark.usefixtures
238
- if isinstance(node.value, ast.Call):
239
- if _is_pytest_mark_usefixtures_call(node.value):
261
+ # Look for pytest.mark.usefixtures calls that span the target line
262
+ for node in ast.walk(tree):
263
+ if isinstance(node, ast.Assign):
264
+ # Check if the value is a call to pytest.mark.usefixtures
265
+ if isinstance(node.value, ast.Call) and _is_pytest_mark_usefixtures_call(node.value):
266
+ # Check if the target line is within this call's range
267
+ call_start = node.value.lineno
268
+ call_end = node.value.end_lineno or call_start
269
+
270
+ if call_start <= target_line <= call_end:
271
+ # Check if any of the arguments contain our fixture name
272
+ for arg in node.value.args:
273
+ if isinstance(arg, ast.Constant) and isinstance(arg.value, str) and arg.value == fixture_name:
274
+ return True
275
+
276
+ # Also check if the value is a list containing pytest.mark.usefixtures calls
277
+ elif isinstance(node.value, ast.List):
278
+ for element in node.value.elts:
279
+ if isinstance(element, ast.Call) and _is_pytest_mark_usefixtures_call(element):
240
280
  # Check if the target line is within this call's range
241
- call_start = node.value.lineno
242
- call_end = node.value.end_lineno or call_start
281
+ call_start = element.lineno
282
+ call_end = element.end_lineno or call_start
243
283
 
244
284
  if call_start <= target_line <= call_end:
245
285
  # Check if any of the arguments contain our fixture name
246
- for arg in node.value.args:
247
- if isinstance(arg, ast.Constant) and isinstance(arg.value, str):
248
- if arg.value == fixture_name:
249
- return True
250
-
251
- # Also check if the value is a list containing pytest.mark.usefixtures calls
252
- elif isinstance(node.value, ast.List):
253
- for element in node.value.elts:
254
- if isinstance(element, ast.Call) and _is_pytest_mark_usefixtures_call(element):
255
- # Check if the target line is within this call's range
256
- call_start = element.lineno
257
- call_end = element.end_lineno or call_start
258
-
259
- if call_start <= target_line <= call_end:
260
- # Check if any of the arguments contain our fixture name
261
- for arg in element.args:
262
- if isinstance(arg, ast.Constant) and isinstance(arg.value, str):
263
- if arg.value == fixture_name:
264
- return True
265
-
266
- # Also check decorators
267
- elif isinstance(node, (ast.FunctionDef, ast.ClassDef)):
268
- for decorator in node.decorator_list:
269
- if isinstance(decorator, ast.Call) and _is_pytest_mark_usefixtures_call(decorator):
270
- call_start = decorator.lineno
271
- call_end = decorator.end_lineno or call_start
272
-
273
- if call_start <= target_line <= call_end:
274
- for arg in decorator.args:
275
- if isinstance(arg, ast.Constant) and isinstance(arg.value, str):
276
- if arg.value == fixture_name:
277
- return True
286
+ for arg in element.args:
287
+ if (
288
+ isinstance(arg, ast.Constant)
289
+ and isinstance(arg.value, str)
290
+ and arg.value == fixture_name
291
+ ):
292
+ return True
293
+
294
+ # Also check decorators
295
+ elif isinstance(node, (ast.FunctionDef, ast.ClassDef)):
296
+ for decorator in node.decorator_list:
297
+ if isinstance(decorator, ast.Call) and _is_pytest_mark_usefixtures_call(decorator):
298
+ call_start = decorator.lineno
299
+ call_end = decorator.end_lineno or call_start
300
+
301
+ if call_start <= target_line <= call_end:
302
+ for arg in decorator.args:
303
+ if (
304
+ isinstance(arg, ast.Constant)
305
+ and isinstance(arg.value, str)
306
+ and arg.value == fixture_name
307
+ ):
308
+ return True
278
309
 
279
- return False
280
- except (FileNotFoundError, SyntaxError, ValueError):
281
- return False
310
+ return False
282
311
 
283
312
 
284
313
  def _is_documentation_pattern(line: str, function_name: str) -> bool:
@@ -334,12 +363,8 @@ def _is_documentation_pattern(line: str, function_name: str) -> bool:
334
363
 
335
364
  # Pattern 4: Check for common docstring patterns
336
365
  # Lines that start with common documentation patterns
337
- doc_starters = ['"""', "'''", "# ", "## ", "### ", "*", "-", "•"]
338
- if any(stripped_line.startswith(starter) for starter in doc_starters):
339
- if f"{function_name}(" in stripped_line:
340
- return True
341
-
342
- return False
366
+ doc_starters = ['"""', "'''", "# ", "## ", "### ", "-", "•"]
367
+ return any(stripped_line.startswith(starter) for starter in doc_starters) and f"{function_name}(" in stripped_line
343
368
 
344
369
 
345
370
  def _find_git_root(file_path: str) -> str:
@@ -420,10 +445,7 @@ def is_ignore_function_list(ignore_prefix_list: list[str], function: ast.Functio
420
445
  ignore_function_lists = [
421
446
  function.name for ignore_prefix in ignore_prefix_list if function.name.startswith(ignore_prefix)
422
447
  ]
423
- if ignore_function_lists:
424
- return True
425
-
426
- return False
448
+ return bool(ignore_function_lists)
427
449
 
428
450
 
429
451
  def _resolve_absolute_path(git_grep_path: str, reference_file: str) -> str:
@@ -477,7 +499,7 @@ def process_file(py_file: str, func_ignore_prefix: list[str], file_ignore_list:
477
499
 
478
500
  # Ignore commented lines (full line or inline)
479
501
  code_part = _line.split("#", 1)[0]
480
- if code_part.startswith("import") or code_part.startswith("from"):
502
+ if code_part.startswith(("import", "from")):
481
503
  continue
482
504
 
483
505
  if func.name not in code_part:
@@ -487,6 +509,30 @@ def process_file(py_file: str, func_ignore_prefix: list[str], file_ignore_list:
487
509
  used = True
488
510
  break
489
511
 
512
+ # If not found with general pattern, check for keyword unpacking usage (**func_name())
513
+ if not used:
514
+ for entry in _git_grep(
515
+ pattern=_build_keyword_unpacking_pattern(function_name=func.name), file_path=py_file
516
+ ):
517
+ LOGGER.debug(f"Checking {entry} function: {func.name}")
518
+ parts = entry.split(":", 2)
519
+ if len(parts) != 3:
520
+ continue
521
+ _, _, _line = parts
522
+
523
+ # Filter out documentation patterns that aren't actual function calls
524
+ if _is_documentation_pattern(line=_line, function_name=func.name):
525
+ LOGGER.debug(f"Skipping doc pattern {entry} function: {func.name}")
526
+ continue
527
+
528
+ # Ignore commented lines (full line or inline)
529
+ if _line.strip().startswith("#"):
530
+ continue
531
+
532
+ # If we find keyword unpacking usage, mark as used
533
+ used = True
534
+ break
535
+
490
536
  # If not found and it's a pytest fixture, check all fixture usage patterns
491
537
  if not used and is_pytest_fixture(func=func):
492
538
  patterns: list[tuple[str, Callable[..., bool] | None]] = [
@@ -623,7 +669,7 @@ def get_unused_functions(
623
669
  try:
624
670
  if unused_func := future.result():
625
671
  unused_functions.append(unused_func)
626
- except Exception as exc:
672
+ except Exception as exc: # noqa: BLE001
627
673
  processing_errors.append(f"{jobs[future]}: {exc}")
628
674
 
629
675
  if processing_errors:
@@ -2,7 +2,8 @@ from __future__ import annotations
2
2
 
3
3
  import json
4
4
  import os
5
- from typing import Any, Dict, Iterable, Optional
5
+ from collections.abc import Iterable
6
+ from typing import Any
6
7
 
7
8
  import click
8
9
  import yaml
@@ -11,7 +12,7 @@ from simple_logger.logger import get_logger
11
12
  LOGGER = get_logger(name=__name__)
12
13
 
13
14
 
14
- def get_util_config(util_name: str, config_file_path: Optional[str] = None) -> Dict[str, Any]:
15
+ def get_util_config(util_name: str, config_file_path: str | None = None) -> dict[str, Any]:
15
16
  if config_file_path and os.path.exists(config_file_path):
16
17
  with open(config_file_path) as _file:
17
18
  return yaml.safe_load(_file).get(util_name, {})
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "python-utility-scripts"
3
- version = "2.0.1"
3
+ version = "2.0.6"
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]