优化:移除unused依赖、懒加载和容错处理

This commit is contained in:
Liang Jiaqing
2026-02-01 20:03:39 +08:00
parent da10ba404b
commit 6e6e5d989d
3 changed files with 5 additions and 4 deletions

4
ga.py
View File

@@ -1,4 +1,4 @@
import sys, os, re, json, time, pyperclip, threading
import sys, os, re, json, time, threading
from pathlib import Path
import tempfile, traceback, subprocess, itertools, collections
if sys.stdout is None: sys.stdout = open(os.devnull, "w")
@@ -22,7 +22,7 @@ def code_run(code: str, code_type: str = "python", timeout: int = 60, cwd: str =
tmp_file.write(code)
tmp_path = tmp_file.name
tmp_file.close()
cmd = ["python", "-X", "utf8", "-u", tmp_path]
cmd = [sys.executable, "-X", "utf8", "-u", tmp_path]
elif code_type in ["powershell", "bash"]:
if os.name == 'nt': cmd = ["powershell", "-NoProfile", "-NonInteractive", "-Command", code]
else: cmd = ["bash", "-c", code]