crackerjack 0.22.0__py3-none-any.whl → 0.22.1__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.
Potentially problematic release.
This version of crackerjack might be problematic. Click here for more details.
- crackerjack/.ruff_cache/0.12.1/5056746222905752453 +0 -0
- crackerjack/crackerjack.py +75 -8
- crackerjack/pyproject.toml +1 -1
- {crackerjack-0.22.0.dist-info → crackerjack-0.22.1.dist-info}/METADATA +1 -1
- {crackerjack-0.22.0.dist-info → crackerjack-0.22.1.dist-info}/RECORD +8 -8
- {crackerjack-0.22.0.dist-info → crackerjack-0.22.1.dist-info}/WHEEL +0 -0
- {crackerjack-0.22.0.dist-info → crackerjack-0.22.1.dist-info}/entry_points.txt +0 -0
- {crackerjack-0.22.0.dist-info → crackerjack-0.22.1.dist-info}/licenses/LICENSE +0 -0
|
Binary file
|
crackerjack/crackerjack.py
CHANGED
|
@@ -74,16 +74,83 @@ class CodeCleaner(BaseModel, arbitrary_types_allowed=True):
|
|
|
74
74
|
parent_pycache.rmdir()
|
|
75
75
|
|
|
76
76
|
def clean_file(self, file_path: Path) -> None:
|
|
77
|
+
from crackerjack.errors import ExecutionError, handle_error
|
|
78
|
+
|
|
77
79
|
try:
|
|
78
|
-
code = file_path.read_text()
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
code = file_path.read_text(encoding="utf-8")
|
|
81
|
+
original_code = code
|
|
82
|
+
try:
|
|
83
|
+
code = self.remove_line_comments(code)
|
|
84
|
+
except Exception as e:
|
|
85
|
+
self.console.print(
|
|
86
|
+
f"[yellow]Warning: Failed to remove line comments from {file_path}: {e}[/yellow]"
|
|
87
|
+
)
|
|
88
|
+
code = original_code
|
|
89
|
+
try:
|
|
90
|
+
code = self.remove_docstrings(code)
|
|
91
|
+
except Exception as e:
|
|
92
|
+
self.console.print(
|
|
93
|
+
f"[yellow]Warning: Failed to remove docstrings from {file_path}: {e}[/yellow]"
|
|
94
|
+
)
|
|
95
|
+
code = original_code
|
|
96
|
+
try:
|
|
97
|
+
code = self.remove_extra_whitespace(code)
|
|
98
|
+
except Exception as e:
|
|
99
|
+
self.console.print(
|
|
100
|
+
f"[yellow]Warning: Failed to remove extra whitespace from {file_path}: {e}[/yellow]"
|
|
101
|
+
)
|
|
102
|
+
try:
|
|
103
|
+
code = self.reformat_code(code)
|
|
104
|
+
except Exception as e:
|
|
105
|
+
self.console.print(
|
|
106
|
+
f"[yellow]Warning: Failed to reformat {file_path}: {e}[/yellow]"
|
|
107
|
+
)
|
|
108
|
+
file_path.write_text(code, encoding="utf-8")
|
|
109
|
+
self.console.print(f"Cleaned: {file_path}")
|
|
110
|
+
except PermissionError as e:
|
|
111
|
+
handle_error(
|
|
112
|
+
ExecutionError(
|
|
113
|
+
message=f"Permission denied while cleaning {file_path}",
|
|
114
|
+
error_code=ErrorCode.PERMISSION_ERROR,
|
|
115
|
+
details=str(e),
|
|
116
|
+
recovery=f"Check file permissions for {file_path} and ensure you have write access",
|
|
117
|
+
),
|
|
118
|
+
console=self.console,
|
|
119
|
+
exit_on_error=False,
|
|
120
|
+
)
|
|
121
|
+
except OSError as e:
|
|
122
|
+
handle_error(
|
|
123
|
+
ExecutionError(
|
|
124
|
+
message=f"File system error while cleaning {file_path}",
|
|
125
|
+
error_code=ErrorCode.FILE_WRITE_ERROR,
|
|
126
|
+
details=str(e),
|
|
127
|
+
recovery=f"Check that {file_path} exists and is not being used by another process",
|
|
128
|
+
),
|
|
129
|
+
console=self.console,
|
|
130
|
+
exit_on_error=False,
|
|
131
|
+
)
|
|
132
|
+
except UnicodeDecodeError as e:
|
|
133
|
+
handle_error(
|
|
134
|
+
ExecutionError(
|
|
135
|
+
message=f"Encoding error while reading {file_path}",
|
|
136
|
+
error_code=ErrorCode.FILE_READ_ERROR,
|
|
137
|
+
details=str(e),
|
|
138
|
+
recovery=f"File {file_path} contains non-UTF-8 characters. Please check the file encoding.",
|
|
139
|
+
),
|
|
140
|
+
console=self.console,
|
|
141
|
+
exit_on_error=False,
|
|
142
|
+
)
|
|
85
143
|
except Exception as e:
|
|
86
|
-
|
|
144
|
+
handle_error(
|
|
145
|
+
ExecutionError(
|
|
146
|
+
message=f"Unexpected error while cleaning {file_path}",
|
|
147
|
+
error_code=ErrorCode.UNEXPECTED_ERROR,
|
|
148
|
+
details=str(e),
|
|
149
|
+
recovery="This is an unexpected error. Please report this issue with the file content if possible.",
|
|
150
|
+
),
|
|
151
|
+
console=self.console,
|
|
152
|
+
exit_on_error=False,
|
|
153
|
+
)
|
|
87
154
|
|
|
88
155
|
def _initialize_docstring_state(self) -> dict[str, t.Any]:
|
|
89
156
|
return {
|
crackerjack/pyproject.toml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
crackerjack-0.22.
|
|
2
|
-
crackerjack-0.22.
|
|
3
|
-
crackerjack-0.22.
|
|
4
|
-
crackerjack-0.22.
|
|
1
|
+
crackerjack-0.22.1.dist-info/METADATA,sha256=3r_1hJF1MDMQFHHeXUcm2jqGyUsOMcAL6wRHA_f4hDw,26251
|
|
2
|
+
crackerjack-0.22.1.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
|
|
3
|
+
crackerjack-0.22.1.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
|
4
|
+
crackerjack-0.22.1.dist-info/licenses/LICENSE,sha256=fDt371P6_6sCu7RyqiZH_AhT1LdN3sN1zjBtqEhDYCk,1531
|
|
5
5
|
crackerjack/.gitignore,sha256=n8cD6U16L3XZn__PvhYm_F7-YeFHFucHCyxWj2NZCGs,259
|
|
6
6
|
crackerjack/.libcst.codemod.yaml,sha256=a8DlErRAIPV1nE6QlyXPAzTOgkB24_spl2E9hphuf5s,772
|
|
7
7
|
crackerjack/.pdm.toml,sha256=dZe44HRcuxxCFESGG8SZIjmc-cGzSoyK3Hs6t4NYA8w,23
|
|
@@ -34,7 +34,7 @@ crackerjack/.ruff_cache/0.11.7/10386934055395314831,sha256=lBNwN5zAgM4OzbkXIOzCc
|
|
|
34
34
|
crackerjack/.ruff_cache/0.11.7/3557596832929915217,sha256=fKlwUbsvT3YIKV6UR-aA_i64lLignWeVfVu-MMmVbU0,207
|
|
35
35
|
crackerjack/.ruff_cache/0.11.8/530407680854991027,sha256=xAMAL3Vu_HR6M-h5ojCTaak0By5ii8u-14pXULLgLqw,224
|
|
36
36
|
crackerjack/.ruff_cache/0.12.0/5056746222905752453,sha256=MqrIT5qymJcgAOBZyn-TvYoGCFfDFCgN9IwSULq8n14,256
|
|
37
|
-
crackerjack/.ruff_cache/0.12.1/5056746222905752453,sha256=
|
|
37
|
+
crackerjack/.ruff_cache/0.12.1/5056746222905752453,sha256=KCTml3tihhRQ1Ozj4zGskv4OHSLOqzmJJjRFZBf9QGY,256
|
|
38
38
|
crackerjack/.ruff_cache/0.2.0/10047773857155985907,sha256=j9LNa_RQ4Plor7go1uTYgz17cEENKvZQ-dP6b9MX0ik,248
|
|
39
39
|
crackerjack/.ruff_cache/0.2.1/8522267973936635051,sha256=u_aPBMibtAp_iYvLwR88GMAECMcIgHezxMyuapmU2P4,248
|
|
40
40
|
crackerjack/.ruff_cache/0.2.2/18053836298936336950,sha256=Xb_ebP0pVuUfSqPEZKlhQ70so_vqkEfMYpuHQ06iR5U,248
|
|
@@ -64,9 +64,9 @@ crackerjack/.ruff_cache/0.9.9/8843823720003377982,sha256=e4ymkXfQsUg5e_mtO34xTsa
|
|
|
64
64
|
crackerjack/.ruff_cache/CACHEDIR.TAG,sha256=WVMVbX4MVkpCclExbq8m-IcOZIOuIZf5FrYw5Pk-Ma4,43
|
|
65
65
|
crackerjack/__init__.py,sha256=8tBSPAru_YDuPpjz05cL7pNbZjYFoRT_agGd_FWa3gY,839
|
|
66
66
|
crackerjack/__main__.py,sha256=lEyi83ChuehqEJgUQ6Ib4ByOofvmhi_0M7oFamMC_1I,6407
|
|
67
|
-
crackerjack/crackerjack.py,sha256=
|
|
67
|
+
crackerjack/crackerjack.py,sha256=DK3vYooXdhXEZPsaR3AEpXCgpZYVGGmcNwtdlKWJeF4,42927
|
|
68
68
|
crackerjack/errors.py,sha256=QEPtVuMtKtQHuawgr1ToMaN1KbUg5h9-4mS33YB5Znk,4062
|
|
69
69
|
crackerjack/interactive.py,sha256=y5QbyR2Wp8WkC_iC89ZqETm-wjAN9X5DK1L3yetpjN4,16153
|
|
70
70
|
crackerjack/py313.py,sha256=buYE7LO11Q64ffowEhTZRFQoAGj_8sg3DTlZuv8M9eo,5890
|
|
71
|
-
crackerjack/pyproject.toml,sha256=
|
|
72
|
-
crackerjack-0.22.
|
|
71
|
+
crackerjack/pyproject.toml,sha256=Bdo5jk9pDTS9-Fnsg-Qpr2yKM4kL_OB4KmNCaKQfayQ,4988
|
|
72
|
+
crackerjack-0.22.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|