forked from microsoft/bocpy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexport_module.py
More file actions
27 lines (20 loc) · 965 Bytes
/
export_module.py
File metadata and controls
27 lines (20 loc) · 965 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""Tool for viewing and debugging BOC module export.
This tool is intended for advanced users. The result of passing it a
Python module file which contains behaviors will be an exported
version of the file in the same format into which the bocpy scheduler
will transpile it for inclusion on worker nodes. Seeing this file can
help debug why a particular file is not working as intended.
"""
import argparse
from bocpy.transpiler import export_module_from_file
if __name__ == "__main__":
parser = argparse.ArgumentParser("Export Test")
parser.add_argument("path", type=str, help="Path to module file")
parser.add_argument("--output", "-o", type=str, default="boc_export.py", help="Path to bocpy exported module")
args = parser.parse_args()
export = export_module_from_file(args.path)
with open(args.output, "w") as file:
file.write(export.code)
print(export.classes)
print(export.functions)
print(export.behaviors)