| 454 | empty_lines = re.compile('^\s*##SPLOOTCODEEMPTYLINE$', flags=re.MULTILINE) |
| 455 | |
| 456 | def convertSplootToText(tree: dict) -> str: |
| 457 | if tree["type"] != "PYTHON_FILE": |
| 458 | raise Exception("Invalid file type") |
| 459 | |
| 460 | statements = getStatementsFromBlock(tree["childSets"]["body"], insert_pass=False) |
| 461 | |
| 462 | mods = ast.Module(body=statements, type_ignores=[]) |
| 463 | ast.fix_missing_locations(mods) |
| 464 | code_string = ast_comments.unparse(mods) |
| 465 | code_string = re.sub(empty_lines, '', code_string) |
| 466 | return code_string |
| 467 | |
| 468 | |
| 469 | result = None |