deadcode 2.3.1__tar.gz → 2.3.2__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 (32) hide show
  1. {deadcode-2.3.1 → deadcode-2.3.2}/PKG-INFO +10 -8
  2. {deadcode-2.3.1 → deadcode-2.3.2}/README.md +8 -4
  3. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/actions/fix_or_show_unused_code.py +7 -2
  4. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/utils/fix_indent.py +1 -0
  5. {deadcode-2.3.1 → deadcode-2.3.2}/pyproject.toml +3 -19
  6. {deadcode-2.3.1 → deadcode-2.3.2}/.gitignore +0 -0
  7. {deadcode-2.3.1 → deadcode-2.3.2}/LICENSE +0 -0
  8. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/__init__.py +0 -0
  9. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/actions/__init__.py +0 -0
  10. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/actions/find_python_filenames.py +0 -0
  11. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/actions/find_unused_names.py +0 -0
  12. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/actions/get_unused_names_error_message.py +0 -0
  13. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/actions/merge_overlaping_file_parts.py +0 -0
  14. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/actions/parse_abstract_syntax_tree.py +0 -0
  15. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/actions/parse_arguments.py +0 -0
  16. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/actions/remove_file_parts_from_content.py +0 -0
  17. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/cli.py +0 -0
  18. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/constants.py +0 -0
  19. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/data_types.py +0 -0
  20. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/utils/__init__.py +0 -0
  21. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/utils/add_colors_to_diff.py +0 -0
  22. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/utils/base_test_case.py +0 -0
  23. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/utils/flatten_lists.py +0 -0
  24. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/utils/nested_scopes.py +0 -0
  25. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/utils/print_ast.py +0 -0
  26. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/visitor/__init__.py +0 -0
  27. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/visitor/code_item.py +0 -0
  28. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/visitor/dead_code_visitor.py +0 -0
  29. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/visitor/ignore.py +0 -0
  30. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/visitor/lines.py +0 -0
  31. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/visitor/noqa.py +0 -0
  32. {deadcode-2.3.1 → deadcode-2.3.2}/deadcode/visitor/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: deadcode
3
- Version: 2.3.1
3
+ Version: 2.3.2
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/
@@ -11,12 +11,10 @@ Classifier: License :: OSI Approved :: GNU Affero General Public License v3
11
11
  Classifier: Natural Language :: English
12
12
  Classifier: Operating System :: OS Independent
13
13
  Classifier: Programming Language :: Python
14
- Classifier: Programming Language :: Python :: 3.8
15
- Classifier: Programming Language :: Python :: 3.9
16
14
  Classifier: Programming Language :: Python :: 3.10
17
15
  Classifier: Programming Language :: Python :: 3.11
18
16
  Classifier: Programming Language :: Python :: 3.12
19
- Requires-Python: >=3.8
17
+ Requires-Python: >=3.10
20
18
  Requires-Dist: tomli>=2.0.1
21
19
  Provides-Extra: test
22
20
  Requires-Dist: hatch; extra == 'test'
@@ -32,9 +30,10 @@ Description-Content-Type: text/markdown
32
30
  <h2 align="center">Find and Fix Unused Python Code</h2>
33
31
 
34
32
  <p align="center">
35
- <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>
33
+ <a href="https://github.com/pre-commit/pre-commit"><img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit" alt="pre-commit" style="max-width:100%;"></a>
36
34
  <a href="https://pypi.org/project/deadcode/"><img alt="PyPI" src="https://img.shields.io/pypi/v/deadcode"></a>
37
35
  <a href="https://pepy.tech/project/deadcode"><img alt="Downloads" src="https://static.pepy.tech/badge/deadcode"></a>
36
+ <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
37
  </p>
39
38
 
40
39
 
@@ -100,9 +99,9 @@ ignore-names-in-files = ["migrations"]
100
99
 
101
100
 
102
101
  ##### Glossory
103
- name - variable, function or class name.
104
- body - code block which follows after `:` in function or class definition.
105
- definition - whole class or function definition expression including its name and body.
102
+ - `name` - variable, function or class name.
103
+ - `body` - code block which follows after `:` in function or class definition.
104
+ - `definition` - whole class or function definition expression including its name and body.
106
105
 
107
106
 
108
107
  ## Rules
@@ -202,6 +201,9 @@ code base is implemented in.
202
201
  - [ ] Check if file is still valid/parsable after automatic fixing, if not: halt the change and report error.
203
202
 
204
203
  ## Release notes
204
+ - v2.3.2:
205
+ - Add `pre-commit` hook support.
206
+ - Drop support for Python 3.8 and 3.9 versions, since their ast implementation is lacking features.
205
207
  - v2.3.1:
206
208
  - Started analysing files in bytes instead of trying to convert them into UTF-8 encoded strings.
207
209
  - Improved automatic removal of unused imports.
@@ -3,9 +3,10 @@
3
3
  <h2 align="center">Find and Fix Unused Python Code</h2>
4
4
 
5
5
  <p align="center">
6
- <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>
6
+ <a href="https://github.com/pre-commit/pre-commit"><img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit" alt="pre-commit" style="max-width:100%;"></a>
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
+ <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>
9
10
  </p>
10
11
 
11
12
 
@@ -71,9 +72,9 @@ ignore-names-in-files = ["migrations"]
71
72
 
72
73
 
73
74
  ##### Glossory
74
- name - variable, function or class name.
75
- body - code block which follows after `:` in function or class definition.
76
- definition - whole class or function definition expression including its name and body.
75
+ - `name` - variable, function or class name.
76
+ - `body` - code block which follows after `:` in function or class definition.
77
+ - `definition` - whole class or function definition expression including its name and body.
77
78
 
78
79
 
79
80
  ## Rules
@@ -173,6 +174,9 @@ code base is implemented in.
173
174
  - [ ] Check if file is still valid/parsable after automatic fixing, if not: halt the change and report error.
174
175
 
175
176
  ## Release notes
177
+ - v2.3.2:
178
+ - Add `pre-commit` hook support.
179
+ - Drop support for Python 3.8 and 3.9 versions, since their ast implementation is lacking features.
176
180
  - v2.3.1:
177
181
  - Started analysing files in bytes instead of trying to convert them into UTF-8 encoded strings.
178
182
  - Improved automatic removal of unused imports.
@@ -41,8 +41,13 @@ def fix_or_show_unused_code(unused_items: Iterable[CodeItem], args: Args) -> str
41
41
  if args.dry and ('__all_files__' in args.dry or _match(filename, args.dry)):
42
42
  with open(filename, 'rb') as f:
43
43
  filename_bytes = filename.encode()
44
- diff = diff_bytes(unified_diff, f.readlines(), updated_file_content_lines,
45
- fromfile=filename_bytes, tofile=filename_bytes)
44
+ diff = diff_bytes(
45
+ unified_diff,
46
+ f.readlines(),
47
+ updated_file_content_lines,
48
+ fromfile=filename_bytes,
49
+ tofile=filename_bytes,
50
+ )
46
51
  # TODO: consider printing result instantly to save memory
47
52
  result_chunk = b''.join(diff)
48
53
  if args.no_color:
@@ -3,6 +3,7 @@ from typing import Optional, TypeVar
3
3
 
4
4
  T = TypeVar('T')
5
5
 
6
+
6
7
  def fix_indent(doc: T) -> Optional[T]:
7
8
  """Finds indentation of a first line and removes it from all following lines.
8
9
 
@@ -1,20 +1,18 @@
1
1
  [project]
2
2
  name = "deadcode"
3
- version = "2.3.1"
3
+ version = "2.3.2"
4
4
  authors = [
5
5
  {name = "Albertas Gimbutas", email = "albertasgim@gmail.com"},
6
6
  ]
7
7
  description = "Find and remove dead code."
8
8
  readme = "README.md"
9
- requires-python = ">= 3.8"
9
+ requires-python = ">= 3.10"
10
10
  classifiers = [
11
11
  "Development Status :: 3 - Alpha",
12
12
  "License :: OSI Approved :: GNU Affero General Public License v3",
13
13
  "Natural Language :: English",
14
14
  "Operating System :: OS Independent",
15
15
  "Programming Language :: Python",
16
- "Programming Language :: Python :: 3.8",
17
- "Programming Language :: Python :: 3.9",
18
16
  "Programming Language :: Python :: 3.10",
19
17
  "Programming Language :: Python :: 3.11",
20
18
  "Programming Language :: Python :: 3.12",
@@ -156,10 +154,9 @@ ignore = [
156
154
  ]
157
155
  "tests/fix/test_unused_imports.py" = ["F401", "W291"]
158
156
 
159
-
160
157
  [tool.mypy]
161
158
  exclude = ["build", "dist", ".venv"]
162
- python_version = "3.8"
159
+ python_version = "3.10"
163
160
  strict = true
164
161
  pretty = true
165
162
  color_output = true
@@ -167,12 +164,6 @@ show_error_codes = true
167
164
  warn_return_any = true
168
165
  warn_unused_configs = true
169
166
 
170
-
171
- [tool.isort]
172
- profile = "black"
173
- multi_line_output = 3
174
- known_third_party = ["deadcode"]
175
-
176
167
  [tool.deadcode]
177
168
  ignore_names = [
178
169
  "ERROR_CODES",
@@ -195,14 +186,7 @@ ignore_names = [
195
186
  ignore_names_in_files = [
196
187
  "deadcode/utils/base_test_case.py"
197
188
  ]
198
-
199
189
  exclude = ["tests"]
200
190
 
201
- [tool.black]
202
- max_line_length = 120
203
- line_length = 120
204
- target_version = ["py38"]
205
-
206
-
207
191
  [tool.pytest.ini_options]
208
192
  addopts = "--cov=. --no-cov-on-fail --cov-fail-under=88.0"
File without changes
File without changes
File without changes
File without changes
File without changes