INNER CODE UNIT · Python

main

simonlin1212/Vibe-Research · calc/cli.py:313

def main() -> None:
    # 🔴 **必须在打任何 JSON 之前**:中文 Windows 的管道默认 GBK,
    #    含 \xa0 会当场崩、其余中文会变成 Node 按 UTF-8 读不懂的字节(上游 issue #27)。
    force_utf8_stdio()
    p = argparse.ArgumentParser(description="确定性估值计算入口")
    p.add_argument("function", help="函数名,或 list 列出全部")
    p.add_argument("--args", default=None, help="JSON 对象字符串")
    p.add_argument("--args-file", default=None, help="含 JSON 对象的文件路径")
    p.add_argument("--evidence", nargs="*", default=[], help="输入所引用的 evidence id(ev-xxxx)")
    p.add_argument("--calc", nargs="*", default=[], help="输入所引用的上游 calculation id(calc-xxxx)")
    p.add_argument("--run-dir", default=None, help="运行目录;history_csv 类输入从其下 raw/ 加载")
    a = p.parse_args()
    if a.function == "list":
        print(_dump({"calc_version": CALC_VERSION, "functions": {k: (v.__doc__ or "").strip().split("\n")[0]
                                                                 for k, v in FUNCTIONS.items()}}))
        sys.exit(0)
    try:
        if a.args_file:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…