deadcode 2.3.1__py3-none-any.whl → 2.3.2__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.
@@ -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,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.
@@ -5,7 +5,7 @@ deadcode/data_types.py,sha256=U7G0EZC0eioOoHoVhwq9nom2HKup5FDQaGrCOAMC89M,1314
5
5
  deadcode/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  deadcode/actions/find_python_filenames.py,sha256=uUKvCcisGc4zb6CjUDOhGYPjwW4S2Ysfr2MRhkMD7m0,1546
7
7
  deadcode/actions/find_unused_names.py,sha256=TagYxuxNrBarwmJ23tuxuCGNinj8mQo26RGZTh90a-8,494
8
- deadcode/actions/fix_or_show_unused_code.py,sha256=KoCowcgzECbr_Z0c4DX-b3o3hS_Pgq9tTjRWwaYE3IU,2748
8
+ deadcode/actions/fix_or_show_unused_code.py,sha256=QtS7H618TjANuTs9tpQJF3b4I6aqvhZ_38yJn1Ley-o,2853
9
9
  deadcode/actions/get_unused_names_error_message.py,sha256=wYYZFSI7_TXPA3a_Qrn-8ttysezKDqErZEUqvWENI3E,1160
10
10
  deadcode/actions/merge_overlaping_file_parts.py,sha256=ukErzpXCuUOWk5CCpPxD43edqoE087sGJGvYZnwUGXs,3165
11
11
  deadcode/actions/parse_abstract_syntax_tree.py,sha256=iL0ukt-FQKA9DuFUk7-sSJZ9nfBzDlJBY-ijItYR6PU,547
@@ -14,7 +14,7 @@ deadcode/actions/remove_file_parts_from_content.py,sha256=vz9fjniO6Tx3y-rUb4pmAW
14
14
  deadcode/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  deadcode/utils/add_colors_to_diff.py,sha256=JSEtaHbyojIpCOBa2UNCaKDJr0a9hxkeDlRB4h-YpBI,423
16
16
  deadcode/utils/base_test_case.py,sha256=QvUgLgZ_yklDahwO-7StEKxgt12sSbcO3K3-ha4AtQk,3492
17
- deadcode/utils/fix_indent.py,sha256=kBIB9HYQqvh_KNT-Z66vsswaDDfTBq9IdJJxlvuzOXA,2367
17
+ deadcode/utils/fix_indent.py,sha256=8eApS20lC6i2CwmMpBhTX8iRyJ3yOZJ_QaJVa-cQlfo,2368
18
18
  deadcode/utils/flatten_lists.py,sha256=iRGu_oVQZazcAek77QI1FyewxLhP5Ea1AMY_Exs7eHM,616
19
19
  deadcode/utils/nested_scopes.py,sha256=jlVrSnDjgeE7Tj5sSANi54woM7Vlr5VNYlHXxX7epFE,3467
20
20
  deadcode/utils/print_ast.py,sha256=ovXtdOSgkjQGAeplFt3_LAv3K2r8iiRGu7c6RrflpUU,87
@@ -25,8 +25,8 @@ deadcode/visitor/ignore.py,sha256=m8qB8uKYB65D-53JOB5LKz32TF9c1y623EyZ1uFFc9A,31
25
25
  deadcode/visitor/lines.py,sha256=0NCrWAqYua7k93VYy7yLby7olhT2Pe4VU_Z5ImNKkjE,3241
26
26
  deadcode/visitor/noqa.py,sha256=0zRA9q0MzEzKe-N285JafP1DSJ3QqGL4GTb9m0QwCiY,2088
27
27
  deadcode/visitor/utils.py,sha256=55WcdKJPRrQiFrc0tIkcGO7dUkTnfvZ3qSzsLsTR4MI,2765
28
- deadcode-2.3.1.dist-info/METADATA,sha256=h4CM70epDJ4ohW9M8GEJ-xPE39G9jXQa-uA6Fns_ES8,11409
29
- deadcode-2.3.1.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
30
- deadcode-2.3.1.dist-info/entry_points.txt,sha256=B0nEkycvQHBUJVGS4KmWCBtcWoEM87Gae6zHbrXCU2Q,47
31
- deadcode-2.3.1.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
32
- deadcode-2.3.1.dist-info/RECORD,,
28
+ deadcode-2.3.2.dist-info/METADATA,sha256=ZSyj3T_sYQJVBwOVKQZdQy0v2U2YVxEF9xUp4x16hL8,11658
29
+ deadcode-2.3.2.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
30
+ deadcode-2.3.2.dist-info/entry_points.txt,sha256=B0nEkycvQHBUJVGS4KmWCBtcWoEM87Gae6zHbrXCU2Q,47
31
+ deadcode-2.3.2.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
32
+ deadcode-2.3.2.dist-info/RECORD,,