# -*- coding: utf-8 -*- """撤掉 RelayTransport 里的临时调试打点。""" from __future__ import annotations import re import sys from pathlib import Path RELAY = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote\android\src" r"\com\lanremote\watch\RelayTransport.java") def main() -> int: text = RELAY.read_text(encoding="utf-8") lines = text.splitlines(keepends=True) kept = [line for line in lines if "[dbg]" not in line] removed = len(lines) - len(kept) # 顺手清掉可能留下的空 if text = "".join(kept) RELAY.write_text(text, encoding="utf-8") print(f" 撤掉 {removed} 行调试输出") if "[dbg]" in text: print(" [注意] 还有残留") return 1 return 0 if __name__ == "__main__": sys.exit(main())