deadcode 2.4.1__py3-none-any.whl → 2.5.0__py3-none-any.whl

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.
deadcode/cli.py CHANGED
@@ -14,7 +14,6 @@ from deadcode.actions.get_unused_names_error_message import (
14
14
  def main(
15
15
  command_line_args: Optional[List[str]] = None,
16
16
  ) -> Optional[str]:
17
-
18
17
  if command_line_args and '--version' in command_line_args or '--version' in sys.argv:
19
18
  return __version__
20
19
 
deadcode/visitor/utils.py CHANGED
@@ -58,7 +58,7 @@ def get_decorator_name(decorator: Union[ast.Call, ast.Attribute]) -> str:
58
58
  while isinstance(decorator, ast.Attribute):
59
59
  parts.append(decorator.attr)
60
60
  decorator = decorator.value # type: ignore
61
- parts.append(decorator.id) # type: ignore
61
+ parts.append(str(id(decorator)))
62
62
  return '@' + '.'.join(reversed(parts))
63
63
 
64
64
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.5
2
2
  Name: deadcode
3
- Version: 2.4.1
3
+ Version: 2.5.0
4
4
  Summary: Find and remove dead code.
5
5
  Project-URL: homepage, https://github.com/albertas/deadcode
6
6
  Project-URL: documentation, https://deadcode.readthedocs.io/
@@ -18,11 +18,12 @@ Requires-Python: >=3.10
18
18
  Requires-Dist: tomli>=2.0.1
19
19
  Provides-Extra: test
20
20
  Requires-Dist: hatch; extra == 'test'
21
- Requires-Dist: mypy; extra == 'test'
21
+ Requires-Dist: mypy==1.10.1; extra == 'test'
22
22
  Requires-Dist: pip-audit; extra == 'test'
23
- Requires-Dist: pytest; extra == 'test'
24
- Requires-Dist: pytest-cov; extra == 'test'
25
- Requires-Dist: ruff; extra == 'test'
23
+ Requires-Dist: pre-commit; extra == 'test'
24
+ Requires-Dist: pytest-cov==5.0.0; extra == 'test'
25
+ Requires-Dist: pytest==9.0.3; extra == 'test'
26
+ Requires-Dist: ruff==0.5.1; extra == 'test'
26
27
  Description-Content-Type: text/markdown
27
28
 
28
29
  [![Deadcode Logo](https://raw.githubusercontent.com/albertas/deadcode/main/docs/_static/deadcode-logo-readme.png)](https://deadcode.readthedocs.io/en/stable/)
@@ -34,6 +35,7 @@ Description-Content-Type: text/markdown
34
35
  <a href="https://pypi.org/project/deadcode/"><img alt="PyPI" src="https://img.shields.io/pypi/v/deadcode"></a>
35
36
  <a href="https://pepy.tech/project/deadcode"><img alt="Downloads" src="https://static.pepy.tech/badge/deadcode"></a>
36
37
  <a href="https://github.com/albertas/deadcode/blob/main/LICENSE"><img alt="License: AGPLv3" src="https://raw.githubusercontent.com/albertas/deadcode/main/docs/_static/AGPLv3-license.svg"></a>
38
+ <br/><a href='https://ko-fi.com/V7V21681GD' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://storage.ko-fi.com/cdn/kofi3.png?v=6' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
37
39
  </p>
38
40
 
39
41
 
@@ -76,6 +78,28 @@ ignore-names = ["BaseTestCase", "*Mixin"]
76
78
  ignore-names-in-files = ["migrations"]
77
79
  ```
78
80
 
81
+ ## Pre-commit hook
82
+ Create a `.pre-commit-config.yaml` file in the root of your project directory, if it doesn't exist, and add the following to the file:
83
+
84
+ ```
85
+ # See https://pre-commit.com for more information
86
+ # See https://pre-commit.com/hooks.html for more hooks
87
+ repos:
88
+ - repo: https://github.com/albertas/deadcode
89
+ rev: 2.5.0
90
+ hooks:
91
+ - id: deadcode
92
+ ```
93
+
94
+ The `rev` is the release tag, so it matches the version published on PyPI. To
95
+ run the same hook while developing deadcode itself, use `make pre-commit`.
96
+
97
+ ## Contributing
98
+
99
+ Create a feature branch from `main`, open a pull request targeting `main`, and
100
+ wait for review. Do not commit feature changes directly to `main`; release
101
+ commits are made by the maintainer on `main`.
102
+
79
103
  ## Command line options
80
104
 
81
105
  | Option&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Type | Meaning |
@@ -201,6 +225,8 @@ code base is implemented in.
201
225
  - [ ] Investigate ways of extracting and backporting Python3.10+ `ast` implementation to lower Python versions.
202
226
 
203
227
  ## Release notes
228
+ - v2.5.0:
229
+ - Fix a crash when a decorator has no `id` attribute.
204
230
  - v2.4.1:
205
231
  - Add `--version` option to show `deadcode` version.
206
232
  - Use stdout for `deadcode` output.
@@ -1,5 +1,5 @@
1
1
  deadcode/__init__.py,sha256=-nvSi7hjcp572lXD-ercQdCJg2qJKYeBC7rLYPanSUs,227
2
- deadcode/cli.py,sha256=yh-uAN8e16mf-BebfLtT9jWBr8kdYi8ZGUCYpNLdWHw,1419
2
+ deadcode/cli.py,sha256=hwzIUEzaaKQ8HWZ8TfuQQbxmAOmnBU9g7ym448Ld6UI,1418
3
3
  deadcode/constants.py,sha256=ya_JsIQGtWAgrEZWc2NpKtuhwkn_05tlGBQpAm3f3Hc,838
4
4
  deadcode/data_types.py,sha256=3BzU0LxTi00XtbIM8fh4RkdAoAeZsrbCyvyaSuNe5UA,1363
5
5
  deadcode/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -24,9 +24,9 @@ deadcode/visitor/dead_code_visitor.py,sha256=JndoN9fpQcJ6g4IDoZq5xlrV2jJI195R6jU
24
24
  deadcode/visitor/ignore.py,sha256=m8qB8uKYB65D-53JOB5LKz32TF9c1y623EyZ1uFFc9A,3191
25
25
  deadcode/visitor/lines.py,sha256=0NCrWAqYua7k93VYy7yLby7olhT2Pe4VU_Z5ImNKkjE,3241
26
26
  deadcode/visitor/noqa.py,sha256=0zRA9q0MzEzKe-N285JafP1DSJ3QqGL4GTb9m0QwCiY,2088
27
- deadcode/visitor/utils.py,sha256=55WcdKJPRrQiFrc0tIkcGO7dUkTnfvZ3qSzsLsTR4MI,2765
28
- deadcode-2.4.1.dist-info/METADATA,sha256=CBnXRajVuYC5JBURud_5lruOBh9UJF9hODRYKijHimk,11999
29
- deadcode-2.4.1.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
30
- deadcode-2.4.1.dist-info/entry_points.txt,sha256=efJLd6DwsjycmpPFhvnql1ziW6xGx6VtAvZXNlREQxg,53
31
- deadcode-2.4.1.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
32
- deadcode-2.4.1.dist-info/RECORD,,
27
+ deadcode/visitor/utils.py,sha256=0DELSP23ora0AjZdEpjiAEE9VlXkOhq6W63ZmgmtwGA,2759
28
+ deadcode-2.5.0.dist-info/METADATA,sha256=8fWn41I1ILdlA-6CdQ0OwohkaOoGeMZSrbpnGBHwV00,13093
29
+ deadcode-2.5.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
30
+ deadcode-2.5.0.dist-info/entry_points.txt,sha256=efJLd6DwsjycmpPFhvnql1ziW6xGx6VtAvZXNlREQxg,53
31
+ deadcode-2.5.0.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
32
+ deadcode-2.5.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.25.0
2
+ Generator: hatchling 1.33.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any