crackerjack 0.21.4__py3-none-any.whl → 0.21.6__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/.gitignore +4 -1
- crackerjack/crackerjack.py +46 -3
- crackerjack/pyproject.toml +1 -1
- {crackerjack-0.21.4.dist-info → crackerjack-0.21.6.dist-info}/METADATA +1 -1
- {crackerjack-0.21.4.dist-info → crackerjack-0.21.6.dist-info}/RECORD +8 -8
- {crackerjack-0.21.4.dist-info → crackerjack-0.21.6.dist-info}/WHEEL +0 -0
- {crackerjack-0.21.4.dist-info → crackerjack-0.21.6.dist-info}/entry_points.txt +0 -0
- {crackerjack-0.21.4.dist-info → crackerjack-0.21.6.dist-info}/licenses/LICENSE +0 -0
crackerjack/.gitignore
CHANGED
crackerjack/crackerjack.py
CHANGED
@@ -89,23 +89,50 @@ class CodeCleaner(BaseModel, arbitrary_types_allowed=True):
|
|
89
89
|
def remove_docstrings(self, code: str) -> str:
|
90
90
|
lines = code.split("\n")
|
91
91
|
cleaned_lines = []
|
92
|
-
docstring_state = {
|
93
|
-
|
92
|
+
docstring_state = {
|
93
|
+
"in_docstring": False,
|
94
|
+
"delimiter": None,
|
95
|
+
"waiting": False,
|
96
|
+
"function_indent": 0,
|
97
|
+
"removed_docstring": False,
|
98
|
+
}
|
99
|
+
for i, line in enumerate(lines):
|
94
100
|
stripped = line.strip()
|
95
101
|
if self._is_function_or_class_definition(stripped):
|
96
102
|
docstring_state["waiting"] = True
|
103
|
+
docstring_state["function_indent"] = len(line) - len(line.lstrip())
|
104
|
+
docstring_state["removed_docstring"] = False
|
97
105
|
cleaned_lines.append(line)
|
98
106
|
continue
|
99
107
|
if docstring_state["waiting"] and stripped:
|
100
108
|
if self._handle_docstring_start(stripped, docstring_state):
|
109
|
+
if not docstring_state["in_docstring"]:
|
110
|
+
if self._needs_pass_statement(
|
111
|
+
lines, i + 1, docstring_state["function_indent"]
|
112
|
+
):
|
113
|
+
pass_line = (
|
114
|
+
" " * (docstring_state["function_indent"] + 4) + "pass"
|
115
|
+
)
|
116
|
+
cleaned_lines.append(pass_line)
|
117
|
+
docstring_state["removed_docstring"] = True
|
101
118
|
continue
|
102
119
|
else:
|
103
120
|
docstring_state["waiting"] = False
|
104
121
|
if docstring_state["in_docstring"]:
|
105
122
|
if self._handle_docstring_end(stripped, docstring_state):
|
123
|
+
if self._needs_pass_statement(
|
124
|
+
lines, i + 1, docstring_state["function_indent"]
|
125
|
+
):
|
126
|
+
pass_line = (
|
127
|
+
" " * (docstring_state["function_indent"] + 4) + "pass"
|
128
|
+
)
|
129
|
+
cleaned_lines.append(pass_line)
|
130
|
+
docstring_state["removed_docstring"] = False
|
106
131
|
continue
|
107
132
|
else:
|
108
133
|
continue
|
134
|
+
if docstring_state["removed_docstring"] and stripped:
|
135
|
+
docstring_state["removed_docstring"] = False
|
109
136
|
cleaned_lines.append(line)
|
110
137
|
|
111
138
|
return "\n".join(cleaned_lines)
|
@@ -137,6 +164,22 @@ class CodeCleaner(BaseModel, arbitrary_types_allowed=True):
|
|
137
164
|
state["in_docstring"] = False
|
138
165
|
state["delimiter"] = None
|
139
166
|
return True
|
167
|
+
return False
|
168
|
+
|
169
|
+
def _needs_pass_statement(
|
170
|
+
self, lines: list[str], start_index: int, function_indent: int
|
171
|
+
) -> bool:
|
172
|
+
for i in range(start_index, len(lines)):
|
173
|
+
line = lines[i]
|
174
|
+
stripped = line.strip()
|
175
|
+
if not stripped:
|
176
|
+
continue
|
177
|
+
line_indent = len(line) - len(line.lstrip())
|
178
|
+
if line_indent <= function_indent:
|
179
|
+
return True
|
180
|
+
if line_indent == function_indent + 4:
|
181
|
+
return False
|
182
|
+
|
140
183
|
return True
|
141
184
|
|
142
185
|
def remove_line_comments(self, code: str) -> str:
|
@@ -633,7 +676,7 @@ class Crackerjack(BaseModel, arbitrary_types_allowed=True):
|
|
633
676
|
)
|
634
677
|
if result.returncode == 0:
|
635
678
|
self.console.print("PDM installed: ✅\n")
|
636
|
-
self.execute_command(["pdm", "
|
679
|
+
self.execute_command(["pdm", "lock"])
|
637
680
|
self.console.print("Lock file updated: ✅\n")
|
638
681
|
else:
|
639
682
|
self.console.print(
|
crackerjack/pyproject.toml
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
crackerjack-0.21.
|
2
|
-
crackerjack-0.21.
|
3
|
-
crackerjack-0.21.
|
4
|
-
crackerjack-0.21.
|
5
|
-
crackerjack/.gitignore,sha256=
|
1
|
+
crackerjack-0.21.6.dist-info/METADATA,sha256=YcmoMu7VODbnvoQf63uApMapVEOpKbHjdeFs0Qutza4,26414
|
2
|
+
crackerjack-0.21.6.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
|
3
|
+
crackerjack-0.21.6.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
4
|
+
crackerjack-0.21.6.dist-info/licenses/LICENSE,sha256=fDt371P6_6sCu7RyqiZH_AhT1LdN3sN1zjBtqEhDYCk,1531
|
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
|
8
8
|
crackerjack/.pre-commit-config-ai.yaml,sha256=K8xXKMJcdhfXOk24L4XpK7H8YlvnZfOh4NVA6qvOz8I,3319
|
@@ -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=AknITUlFjq3YUK9s2xeL62dM0GN82JBQyDkPzQ_hCUg,6561
|
67
|
-
crackerjack/crackerjack.py,sha256=
|
67
|
+
crackerjack/crackerjack.py,sha256=p5079e4I_pMHKiTFm0ckiuKJ1jvYCq8Na_0Vk-R12xA,35155
|
68
68
|
crackerjack/errors.py,sha256=QEPtVuMtKtQHuawgr1ToMaN1KbUg5h9-4mS33YB5Znk,4062
|
69
69
|
crackerjack/interactive.py,sha256=5KXKSvWKttLvHcI1L4VEDc3Rb-ZpHBOl_Qr7lhD-O4Q,16262
|
70
70
|
crackerjack/py313.py,sha256=buYE7LO11Q64ffowEhTZRFQoAGj_8sg3DTlZuv8M9eo,5890
|
71
|
-
crackerjack/pyproject.toml,sha256=
|
72
|
-
crackerjack-0.21.
|
71
|
+
crackerjack/pyproject.toml,sha256=w4ssNTiRx9zQqQuywBGMIISalKLwg59DPSza9eGXuGk,4988
|
72
|
+
crackerjack-0.21.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|