crackerjack 0.22.0__tar.gz → 0.22.1__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.
Potentially problematic release.
This version of crackerjack might be problematic. Click here for more details.
- {crackerjack-0.22.0 → crackerjack-0.22.1}/PKG-INFO +1 -1
- crackerjack-0.22.1/crackerjack/.ruff_cache/0.12.1/5056746222905752453 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/crackerjack.py +75 -8
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/pyproject.toml +1 -1
- {crackerjack-0.22.0 → crackerjack-0.22.1}/pyproject.toml +1 -1
- {crackerjack-0.22.0 → crackerjack-0.22.1}/tests/test_structured_errors.py +2 -2
- crackerjack-0.22.0/crackerjack/.ruff_cache/0.12.1/5056746222905752453 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/LICENSE +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/README.md +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.gitignore +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.libcst.codemod.yaml +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.pdm.toml +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.pre-commit-config-ai.yaml +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.pre-commit-config.yaml +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.pytest_cache/.gitignore +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.pytest_cache/CACHEDIR.TAG +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.pytest_cache/README.md +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.pytest_cache/v/cache/nodeids +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.pytest_cache/v/cache/stepwise +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/.gitignore +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.1.11/3256171999636029978 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.1.14/602324811142551221 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.1.4/10355199064880463147 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.1.6/15140459877605758699 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.1.7/1790508110482614856 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.1.9/17041001205004563469 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.11/18187162184424859798 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.12/16869036553936192448 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.12/1867267426380906393 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.12/4240757255861806333 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.12/4441409093023629623 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.13/1867267426380906393 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.13/4240757255861806333 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.2/4070660268492669020 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.3/9818742842212983150 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.4/9818742842212983150 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.6/3557596832929915217 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.7/10386934055395314831 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.7/3557596832929915217 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.8/530407680854991027 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.12.0/5056746222905752453 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.2.0/10047773857155985907 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.2.1/8522267973936635051 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.2.2/18053836298936336950 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.3.0/12548816621480535786 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.3.3/11081883392474770722 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.3.4/676973378459347183 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.3.5/16311176246009842383 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.5.7/1493622539551733492 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.5.7/6231957614044513175 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.5.7/9932762556785938009 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.6.0/11982804814124138945 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.6.0/12055761203849489982 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.6.2/1206147804896221174 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.6.4/1206147804896221174 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.6.5/1206147804896221174 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.6.7/3657366982708166874 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.6.9/285614542852677309 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.7.1/1024065805990144819 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.7.1/285614542852677309 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.7.3/16061516852537040135 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.8.4/16354268377385700367 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.9.10/12813592349865671909 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.9.10/923908772239632759 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.9.3/13948373885254993391 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.9.9/12813592349865671909 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.9.9/8843823720003377982 +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/CACHEDIR.TAG +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/__init__.py +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/__main__.py +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/errors.py +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/interactive.py +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/py313.py +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/tests/TESTING.md +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/tests/__init__.py +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/tests/conftest.py +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/tests/data/comments_sample.txt +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/tests/data/docstrings_sample.txt +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/tests/data/expected_comments_sample.txt +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/tests/data/init.py +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/tests/test_crackerjack.py +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/tests/test_crackerjack_runner.py +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/tests/test_errors.py +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/tests/test_interactive.py +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/tests/test_interactive_run.py +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/tests/test_main.py +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/tests/test_multiline_functions.py +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/tests/test_py313_advanced.py +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/tests/test_py313_features.py +0 -0
- {crackerjack-0.22.0 → crackerjack-0.22.1}/tests/test_pytest_features.py +0 -0
|
Binary file
|
|
@@ -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 {
|
|
@@ -91,9 +91,9 @@ class TestErrorHandlingIntegration:
|
|
|
91
91
|
cleaner.clean_file(test_path)
|
|
92
92
|
captured = capsys.readouterr()
|
|
93
93
|
output = captured.out.strip()
|
|
94
|
-
assert "
|
|
94
|
+
assert "FILE_WRITE_ERROR" in output
|
|
95
95
|
assert str(test_path) in output
|
|
96
|
-
assert "
|
|
96
|
+
assert "File system error while cleaning" in output
|
|
97
97
|
|
|
98
98
|
def test_error_handling_in_publish_project(self) -> None:
|
|
99
99
|
from crackerjack.crackerjack import Crackerjack
|
|
Binary file
|
|
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
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.1.11/3256171999636029978
RENAMED
|
File without changes
|
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.1.4/10355199064880463147
RENAMED
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.1.6/15140459877605758699
RENAMED
|
File without changes
|
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.1.9/17041001205004563469
RENAMED
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.11/18187162184424859798
RENAMED
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.12/16869036553936192448
RENAMED
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.12/1867267426380906393
RENAMED
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.12/4240757255861806333
RENAMED
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.12/4441409093023629623
RENAMED
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.13/1867267426380906393
RENAMED
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.13/4240757255861806333
RENAMED
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.2/4070660268492669020
RENAMED
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.3/9818742842212983150
RENAMED
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.4/9818742842212983150
RENAMED
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.6/3557596832929915217
RENAMED
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.7/10386934055395314831
RENAMED
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.11.7/3557596832929915217
RENAMED
|
File without changes
|
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.12.0/5056746222905752453
RENAMED
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.2.0/10047773857155985907
RENAMED
|
File without changes
|
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.2.2/18053836298936336950
RENAMED
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.3.0/12548816621480535786
RENAMED
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.3.3/11081883392474770722
RENAMED
|
File without changes
|
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.3.5/16311176246009842383
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.6.0/11982804814124138945
RENAMED
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.6.0/12055761203849489982
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.7.3/16061516852537040135
RENAMED
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.8.4/16354268377385700367
RENAMED
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.9.10/12813592349865671909
RENAMED
|
File without changes
|
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.9.3/13948373885254993391
RENAMED
|
File without changes
|
{crackerjack-0.22.0 → crackerjack-0.22.1}/crackerjack/.ruff_cache/0.9.9/12813592349865671909
RENAMED
|
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
|