deadcode 2.4.1__tar.gz → 2.5.0__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.
- {deadcode-2.4.1 → deadcode-2.5.0}/PKG-INFO +32 -6
- {deadcode-2.4.1 → deadcode-2.5.0}/README.md +25 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/cli.py +0 -1
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/visitor/utils.py +1 -1
- {deadcode-2.4.1 → deadcode-2.5.0}/pyproject.toml +7 -5
- {deadcode-2.4.1 → deadcode-2.5.0}/.gitignore +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/LICENSE +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/__init__.py +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/actions/__init__.py +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/actions/find_python_filenames.py +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/actions/find_unused_names.py +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/actions/fix_or_show_unused_code.py +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/actions/get_unused_names_error_message.py +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/actions/merge_overlaping_file_parts.py +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/actions/parse_abstract_syntax_tree.py +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/actions/parse_arguments.py +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/actions/remove_file_parts_from_content.py +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/constants.py +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/data_types.py +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/utils/__init__.py +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/utils/add_colors_to_diff.py +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/utils/base_test_case.py +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/utils/fix_indent.py +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/utils/flatten_lists.py +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/utils/nested_scopes.py +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/utils/print_ast.py +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/visitor/__init__.py +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/visitor/code_item.py +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/visitor/dead_code_visitor.py +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/visitor/ignore.py +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/visitor/lines.py +0 -0
- {deadcode-2.4.1 → deadcode-2.5.0}/deadcode/visitor/noqa.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: deadcode
|
|
3
|
-
Version: 2.
|
|
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:
|
|
24
|
-
Requires-Dist: pytest-cov; extra == 'test'
|
|
25
|
-
Requires-Dist:
|
|
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
|
[](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 | 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.
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
<a href="https://pypi.org/project/deadcode/"><img alt="PyPI" src="https://img.shields.io/pypi/v/deadcode"></a>
|
|
8
8
|
<a href="https://pepy.tech/project/deadcode"><img alt="Downloads" src="https://static.pepy.tech/badge/deadcode"></a>
|
|
9
9
|
<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>
|
|
10
|
+
<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>
|
|
10
11
|
</p>
|
|
11
12
|
|
|
12
13
|
|
|
@@ -49,6 +50,28 @@ ignore-names = ["BaseTestCase", "*Mixin"]
|
|
|
49
50
|
ignore-names-in-files = ["migrations"]
|
|
50
51
|
```
|
|
51
52
|
|
|
53
|
+
## Pre-commit hook
|
|
54
|
+
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:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
# See https://pre-commit.com for more information
|
|
58
|
+
# See https://pre-commit.com/hooks.html for more hooks
|
|
59
|
+
repos:
|
|
60
|
+
- repo: https://github.com/albertas/deadcode
|
|
61
|
+
rev: 2.5.0
|
|
62
|
+
hooks:
|
|
63
|
+
- id: deadcode
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The `rev` is the release tag, so it matches the version published on PyPI. To
|
|
67
|
+
run the same hook while developing deadcode itself, use `make pre-commit`.
|
|
68
|
+
|
|
69
|
+
## Contributing
|
|
70
|
+
|
|
71
|
+
Create a feature branch from `main`, open a pull request targeting `main`, and
|
|
72
|
+
wait for review. Do not commit feature changes directly to `main`; release
|
|
73
|
+
commits are made by the maintainer on `main`.
|
|
74
|
+
|
|
52
75
|
## Command line options
|
|
53
76
|
|
|
54
77
|
| Option | Type | Meaning |
|
|
@@ -174,6 +197,8 @@ code base is implemented in.
|
|
|
174
197
|
- [ ] Investigate ways of extracting and backporting Python3.10+ `ast` implementation to lower Python versions.
|
|
175
198
|
|
|
176
199
|
## Release notes
|
|
200
|
+
- v2.5.0:
|
|
201
|
+
- Fix a crash when a decorator has no `id` attribute.
|
|
177
202
|
- v2.4.1:
|
|
178
203
|
- Add `--version` option to show `deadcode` version.
|
|
179
204
|
- Use stdout for `deadcode` output.
|
|
@@ -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
|
|
|
@@ -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
|
-
|
|
61
|
+
parts.append(str(id(decorator)))
|
|
62
62
|
return '@' + '.'.join(reversed(parts))
|
|
63
63
|
|
|
64
64
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "deadcode"
|
|
3
|
-
version = "2.
|
|
3
|
+
version = "2.5.0"
|
|
4
4
|
authors = [
|
|
5
5
|
{name = "Albertas Gimbutas", email = "albertasgim@gmail.com"},
|
|
6
6
|
]
|
|
@@ -24,12 +24,13 @@ dependencies = [
|
|
|
24
24
|
[project.optional-dependencies]
|
|
25
25
|
test = [
|
|
26
26
|
"hatch",
|
|
27
|
-
"ruff",
|
|
28
|
-
"mypy",
|
|
27
|
+
"ruff==0.5.1",
|
|
28
|
+
"mypy==1.10.1",
|
|
29
29
|
"pip-audit",
|
|
30
30
|
"deadcode",
|
|
31
|
-
"
|
|
32
|
-
"pytest
|
|
31
|
+
"pre-commit",
|
|
32
|
+
"pytest==9.0.3",
|
|
33
|
+
"pytest-cov==5.0.0",
|
|
33
34
|
]
|
|
34
35
|
|
|
35
36
|
[project.scripts]
|
|
@@ -149,6 +150,7 @@ ignore = [
|
|
|
149
150
|
"tests/*" = [
|
|
150
151
|
"S101", # allow assert and no docs in tests
|
|
151
152
|
"PT009",
|
|
153
|
+
"PT027",
|
|
152
154
|
"ANN201",
|
|
153
155
|
"D",
|
|
154
156
|
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|