Manually edited code, can dedent
(text: str)
| 65 | |
| 66 | |
| 67 | def fixed_dedent(text: str) -> str: |
| 68 | """Manually edited code, can dedent""" |
| 69 | # Added robustness for AI generated code |
| 70 | lines = text.splitlines() |
| 71 | for line in lines: |
| 72 | if content := line.lstrip(): |
| 73 | indent = line[: len(line) - len(content)] |
| 74 | break |
| 75 | else: |
| 76 | # Quit early, no clear leading spaces |
| 77 | return dedent(text) |
| 78 | |
| 79 | def refill(line: str) -> str: |
| 80 | if not line.startswith(indent): |
| 81 | return indent + line |
| 82 | return line |
| 83 | |
| 84 | return dedent("\n".join(map(refill, lines))) |
| 85 | |
| 86 | |
| 87 | def unwrap_cell_body(formatted: str) -> str: |
searching dependent graphs…