()
| 10 | |
| 11 | |
| 12 | def main(): |
| 13 | start = time.time() |
| 14 | # initialize all the built in llm options |
| 15 | llm_options = ['auto'] |
| 16 | if os.path.exists('llm'): |
| 17 | llm_options += os.listdir('llm') |
| 18 | # TODO: check this works down the line, this is only a placeholder |
| 19 | |
| 20 | parser = argparse.ArgumentParser(description='ByeCodeLLM') |
| 21 | parser.add_argument('--path', type=str, |
| 22 | help='Path to the file or directory to convert') |
| 23 | parser.add_argument('--output', type=str, |
| 24 | help='Output path', default='output') |
| 25 | parser.add_argument('--type', type=str, help='Type of the input', |
| 26 | choices=['exe', 'pyc', 'folder', 'py_bytecode'], default='pyc') |
| 27 | parser.add_argument( |
| 28 | '--llm', help='Name or path to the LLM file by default goes to one of the pretrained LLM\'s included', default='auto') |
| 29 | parser.add_argument( |
| 30 | '--llm-args', help='Arguments to pass to the LLM', default="") |
| 31 | |
| 32 | args = parser.parse_args() |
| 33 | |
| 34 | if args.llm not in llm_options: |
| 35 | print('Invalid LLM option') |
| 36 | sys.exit(1) |
| 37 | |
| 38 | if args.type == 'pyc': |
| 39 | res = PycHandler(args.path).handle() |
| 40 | with open(args.output, 'w') as f: |
| 41 | f.write(res) |
| 42 | # print(res) |
| 43 | |
| 44 | time_in_seconds = time.time() - start |
| 45 | import datetime |
| 46 | print(f"Time taken: {str(datetime.timedelta(seconds=time_in_seconds))}") |
| 47 | |
| 48 | |
| 49 | if __name__ == '__main__': |
no test coverage detected