crackerjack 0.20.12__py3-none-any.whl → 0.20.13__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.
- crackerjack/.ruff_cache/0.11.13/1867267426380906393 +0 -0
- crackerjack/crackerjack.py +50 -3
- crackerjack/pyproject.toml +1 -1
- {crackerjack-0.20.12.dist-info → crackerjack-0.20.13.dist-info}/METADATA +1 -1
- {crackerjack-0.20.12.dist-info → crackerjack-0.20.13.dist-info}/RECORD +8 -8
- {crackerjack-0.20.12.dist-info → crackerjack-0.20.13.dist-info}/WHEEL +0 -0
- {crackerjack-0.20.12.dist-info → crackerjack-0.20.13.dist-info}/entry_points.txt +0 -0
- {crackerjack-0.20.12.dist-info → crackerjack-0.20.13.dist-info}/licenses/LICENSE +0 -0
Binary file
|
crackerjack/crackerjack.py
CHANGED
@@ -118,7 +118,10 @@ class CodeCleaner(BaseModel, arbitrary_types_allowed=True):
|
|
118
118
|
i += 1
|
119
119
|
elif char == "#" and in_string is None:
|
120
120
|
comment = line[i:].strip()
|
121
|
-
if re.match(
|
121
|
+
if re.match(
|
122
|
+
"^#\\s*(?:type:\\s*ignore|noqa|nosec|pragma:\\s*no\\s*cover|pylint:\\s*disable|mypy:\\s*ignore)",
|
123
|
+
comment,
|
124
|
+
):
|
122
125
|
result.append(line[i:])
|
123
126
|
break
|
124
127
|
break
|
@@ -133,11 +136,55 @@ class CodeCleaner(BaseModel, arbitrary_types_allowed=True):
|
|
133
136
|
def remove_extra_whitespace(self, code: str) -> str:
|
134
137
|
lines = code.split("\n")
|
135
138
|
cleaned_lines = []
|
139
|
+
in_function = False
|
140
|
+
function_indent = 0
|
136
141
|
for i, line in enumerate(lines):
|
137
142
|
line = line.rstrip()
|
138
|
-
|
139
|
-
|
143
|
+
stripped_line = line.lstrip()
|
144
|
+
if stripped_line.startswith(("def ", "async def ")):
|
145
|
+
in_function = True
|
146
|
+
function_indent = len(line) - len(stripped_line)
|
147
|
+
elif (
|
148
|
+
in_function
|
149
|
+
and line
|
150
|
+
and (len(line) - len(stripped_line) <= function_indent)
|
151
|
+
and (not stripped_line.startswith(("@", "#")))
|
152
|
+
):
|
153
|
+
in_function = False
|
154
|
+
function_indent = 0
|
155
|
+
if not line:
|
156
|
+
if i > 0 and cleaned_lines and (not cleaned_lines[-1]):
|
157
|
+
continue
|
158
|
+
if in_function:
|
159
|
+
next_line_idx = i + 1
|
160
|
+
if next_line_idx < len(lines):
|
161
|
+
next_line = lines[next_line_idx].strip()
|
162
|
+
if not (
|
163
|
+
next_line.startswith(
|
164
|
+
("return", "class ", "def ", "async def ", "@")
|
165
|
+
)
|
166
|
+
or next_line in ("pass", "break", "continue", "raise")
|
167
|
+
or (
|
168
|
+
next_line.startswith("#")
|
169
|
+
and any(
|
170
|
+
(
|
171
|
+
pattern in next_line
|
172
|
+
for pattern in (
|
173
|
+
"type:",
|
174
|
+
"noqa",
|
175
|
+
"nosec",
|
176
|
+
"pragma:",
|
177
|
+
"pylint:",
|
178
|
+
"mypy:",
|
179
|
+
)
|
180
|
+
)
|
181
|
+
)
|
182
|
+
)
|
183
|
+
):
|
184
|
+
continue
|
140
185
|
cleaned_lines.append(line)
|
186
|
+
while cleaned_lines and (not cleaned_lines[-1]):
|
187
|
+
cleaned_lines.pop()
|
141
188
|
return "\n".join(cleaned_lines)
|
142
189
|
|
143
190
|
def reformat_code(self, code: str) -> str:
|
crackerjack/pyproject.toml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
crackerjack-0.20.
|
2
|
-
crackerjack-0.20.
|
3
|
-
crackerjack-0.20.
|
4
|
-
crackerjack-0.20.
|
1
|
+
crackerjack-0.20.13.dist-info/METADATA,sha256=3KcyynnFmWmncj4aGPVu5kFy5wnnPMYVf7aCyTrsOoc,26384
|
2
|
+
crackerjack-0.20.13.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
|
3
|
+
crackerjack-0.20.13.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
4
|
+
crackerjack-0.20.13.dist-info/licenses/LICENSE,sha256=fDt371P6_6sCu7RyqiZH_AhT1LdN3sN1zjBtqEhDYCk,1531
|
5
5
|
crackerjack/.gitignore,sha256=4DYG7ZoVEHR5Tv1gQliRWmsNku5Fw2_k756cG_t12Cg,185
|
6
6
|
crackerjack/.libcst.codemod.yaml,sha256=a8DlErRAIPV1nE6QlyXPAzTOgkB24_spl2E9hphuf5s,772
|
7
7
|
crackerjack/.pdm.toml,sha256=dZe44HRcuxxCFESGG8SZIjmc-cGzSoyK3Hs6t4NYA8w,23
|
@@ -23,7 +23,7 @@ crackerjack/.ruff_cache/0.11.12/16869036553936192448,sha256=pYYUCDrYh7fPq8xkFLxv
|
|
23
23
|
crackerjack/.ruff_cache/0.11.12/1867267426380906393,sha256=2w4M0Lrjd9flwuq6uJxehTbm7FVUcK5sL2sz1gS2Yvo,256
|
24
24
|
crackerjack/.ruff_cache/0.11.12/4240757255861806333,sha256=uph5uIRG-XnF7ywAEcCxqqgIkWALPCvJFcwCgnNfTI4,77
|
25
25
|
crackerjack/.ruff_cache/0.11.12/4441409093023629623,sha256=eHrESew3XCFJ2WqmKvtGLO1r4mY5Q_mv7yGlDmM1sSc,153
|
26
|
-
crackerjack/.ruff_cache/0.11.13/1867267426380906393,sha256=
|
26
|
+
crackerjack/.ruff_cache/0.11.13/1867267426380906393,sha256=KmwKiZGTVUDcLqqzw2kSoqlT6ABtaGbSBFLbNLO_MHw,256
|
27
27
|
crackerjack/.ruff_cache/0.11.13/4240757255861806333,sha256=l35TwAYyTusgJgyePvfP4_CCllPs1sWapEiLFZw8chQ,83
|
28
28
|
crackerjack/.ruff_cache/0.11.2/4070660268492669020,sha256=FTRTUmvj6nZw_QQBp_WHI-h3_iqRejzL39api-9wTvs,224
|
29
29
|
crackerjack/.ruff_cache/0.11.3/9818742842212983150,sha256=U-4mT__a-OljovvAJvv5M6X7TCMa3dReLXx3kTNGgwU,224
|
@@ -61,9 +61,9 @@ crackerjack/.ruff_cache/0.9.9/8843823720003377982,sha256=e4ymkXfQsUg5e_mtO34xTsa
|
|
61
61
|
crackerjack/.ruff_cache/CACHEDIR.TAG,sha256=WVMVbX4MVkpCclExbq8m-IcOZIOuIZf5FrYw5Pk-Ma4,43
|
62
62
|
crackerjack/__init__.py,sha256=LyIPEfjBcqWp7UVuJ-b7cc8oiFxrQqyL8RJ7g6c17Qs,838
|
63
63
|
crackerjack/__main__.py,sha256=g-vag4kDCPjbY_ik6l6Qqc5ZRVuKGN4ofVA5x3syfFI,6733
|
64
|
-
crackerjack/crackerjack.py,sha256=
|
64
|
+
crackerjack/crackerjack.py,sha256=nwsAFZwTfc4zmdMUeuhFzF7QXY0U2pC60XC5LaimiXY,25869
|
65
65
|
crackerjack/errors.py,sha256=xvXO3bk0VrxQz0lysIuVOju6SxxDgf04Wne1BedLFB8,4061
|
66
66
|
crackerjack/interactive.py,sha256=hNYhsLkdy956AUQ10_21pE_ZBqfV81iKK9i2EKVSY9Q,15332
|
67
67
|
crackerjack/py313.py,sha256=o6ywqlRANq4I_IESPMuaOU_IEQDOBiHkApFu1klvbZ4,5892
|
68
|
-
crackerjack/pyproject.toml,sha256=
|
69
|
-
crackerjack-0.20.
|
68
|
+
crackerjack/pyproject.toml,sha256=szylSeogkB0mlSeToFr84pk-hY_XdtgOoizGhW672V4,4880
|
69
|
+
crackerjack-0.20.13.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|