python-utility-scripts 0.0.4__tar.gz → 0.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-utility-scripts
3
- Version: 0.0.4
3
+ Version: 0.0.6
4
4
  Summary: Python utility scripts
5
5
  Home-page: https://github.com/RedHatQE/python-utility-scripts
6
6
  License: Apache-2.0
@@ -15,10 +15,12 @@ def is_fixture_autouse(func):
15
15
  for deco in func.decorator_list:
16
16
  if not hasattr(deco, "func"):
17
17
  continue
18
- if deco.func.attr == "fixture" and deco.func.value.id == "pytest":
19
- for _key in deco.keywords:
20
- if _key.arg == "autouse":
21
- return _key.value.s
18
+
19
+ if getattr(deco.func, "attr", None) and getattr(deco.func, "value", None):
20
+ if deco.func.attr == "fixture" and deco.func.value.id == "pytest":
21
+ for _key in deco.keywords:
22
+ if _key.arg == "autouse":
23
+ return _key.value.s
22
24
 
23
25
 
24
26
  def _iter_functions(tree):
@@ -52,7 +54,7 @@ def is_ignore_function_list(ignore_prefix_list, function):
52
54
  function.name for ignore_prefix in ignore_prefix_list if function.name.startswith(ignore_prefix)
53
55
  ]
54
56
  if ignore_function_lists:
55
- LOGGER.warning(f"Following functions are getting skipped {ignore_prefix_list}: {ignore_function_lists}")
57
+ LOGGER.info(f"Following functions are getting skipped: {ignore_function_lists}")
56
58
  return True
57
59
 
58
60
 
@@ -64,7 +66,9 @@ def is_ignore_function_list(ignore_prefix_list, function):
64
66
  default=os.path.expanduser("~/.config/python-utility-scripts/config.yaml"),
65
67
  )
66
68
  @click.option(
67
- "--exclude-files", help="Provide a comma-separated string or list of files to exclude", type=ListParamType()
69
+ "--exclude-files",
70
+ help="Provide a comma-separated string or list of files to exclude",
71
+ type=ListParamType(),
68
72
  )
69
73
  @click.option(
70
74
  "--exclude-function-prefixes",
@@ -79,9 +83,7 @@ def get_unused_functions(config_file_path, exclude_files, exclude_function_prefi
79
83
  file_ignore_list = exclude_files or unused_code_config.get("exclude_files", [])
80
84
  for py_file in all_python_files():
81
85
  if os.path.basename(py_file) in file_ignore_list:
82
- LOGGER.warning(f"File {py_file} is being skipped.")
83
86
  continue
84
- LOGGER.info(f"Checking file: {py_file}")
85
87
  with open(py_file) as fd:
86
88
  tree = ast.parse(source=fd.read())
87
89
 
@@ -9,7 +9,7 @@ exclude = [".git", ".venv", ".mypy_cache", ".tox", "__pycache__"]
9
9
 
10
10
  [tool.poetry]
11
11
  name = "python-utility-scripts"
12
- version = "0.0.4"
12
+ version = "0.0.6"
13
13
  description = "Python utility scripts"
14
14
  authors = ["dbasunag <dbasunag@redhat.com>"]
15
15
  license = "Apache License 2.0"