下载 CFR 到指定目录或当前目录
(target_dir: Optional[str] = None)
| 45 | |
| 46 | |
| 47 | def download_cfr(target_dir: Optional[str] = None) -> str: |
| 48 | """下载 CFR 到指定目录或当前目录""" |
| 49 | if target_dir is None: |
| 50 | target_dir = str(Path.cwd()) |
| 51 | |
| 52 | target_path = os.path.join(target_dir, CFR_JAR_NAME) |
| 53 | |
| 54 | if os.path.exists(target_path): |
| 55 | return target_path |
| 56 | |
| 57 | print(f"正在下载 CFR 到 {target_path}...") |
| 58 | urllib.request.urlretrieve(CFR_DOWNLOAD_URL, target_path) |
| 59 | print("CFR 下载完成") |
| 60 | |
| 61 | return target_path |
| 62 | |
| 63 | |
| 64 | def ensure_cfr() -> str: |
no outgoing calls
no test coverage detected