()
| 430 | |
| 431 | |
| 432 | def main(): |
| 433 | parser = argparse.ArgumentParser(description="Analyze AST of Python and SQL blocks") |
| 434 | parser.add_argument("--input", required=True, help="JSON input file path") |
| 435 | parser.add_argument("--output", required=True, help="JSON output file path") |
| 436 | |
| 437 | args = parser.parse_args() |
| 438 | |
| 439 | try: |
| 440 | # Read input data from file |
| 441 | with open(args.input, "r") as f: |
| 442 | data = json.load(f) |
| 443 | |
| 444 | blocks = comment_out_jupyter_bash_commands(data["blocks"]) |
| 445 | result = analyze_blocks(blocks) |
| 446 | |
| 447 | # Write output data to file |
| 448 | with open(args.output, "w") as f: |
| 449 | json.dump(result, f) |
| 450 | |
| 451 | except Exception as e: |
| 452 | error_result = {"errorMessage": f"{e.__class__.__name__}: {str(e)}"} |
| 453 | # Write error to output file |
| 454 | with open(args.output, "w") as f: |
| 455 | json.dump(error_result, f) |
| 456 | sys.exit(1) |
| 457 | |
| 458 | |
| 459 | if __name__ == "__main__": |
no test coverage detected