(_code: str)
| 16 | from pathlib import Path |
| 17 | |
| 18 | def __write_script_file(_code: str): |
| 19 | _workspace = Path(os.getenv('TEMP_CODE_DIR', 'temp')).resolve() |
| 20 | _workspace.mkdir(exist_ok=True) |
| 21 | filename = f"{uuid.uuid4()}.py" |
| 22 | code_path = _workspace / filename |
| 23 | code_content = _code if _code.endswith("\n") else _code + "\n" |
| 24 | code_path.write_text(code_content, encoding="utf-8") |
| 25 | return code_path |
| 26 | |
| 27 | def __default_interpreter() -> str: |
| 28 | return sys.executable or "python3" |