INNER CODE UNIT · Python

resolve_inputs

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

def resolve_inputs(args: dict, run_dir: str | None) -> tuple[dict, dict, dict]:
    """返回 (可调用参数, 解析记录, 用于哈希的规范化实参)。history_csv / history_json 在哈希实参里被替换为文件身份(sha256 等)。"""
    call_args, record, ident = {}, {}, {}
    for k, v in args.items():
        if isinstance(v, dict) and "history_csv" in v:
            vals, rec = _load_history_csv(v["history_csv"], run_dir)
            call_args[k] = vals
            record[k] = rec
            ident[k] = {"history_csv": {"raw_ref": rec["raw_ref"], "column": rec["column"], "where": rec["where"],
                                        "sha256": rec["sha256"], "rows_used": rec["rows_used"]}}
            if "date_column" in rec:
                ident[k]["history_csv"].update(date_column=rec["date_column"], period=rec["period"])
        elif isinstance(v, dict) and "history_json" in v:
            rows, rec = _load_history_json(v["history_json"], run_dir)
            call_args[k] = rows
            record[k] = rec
            ident[k] = {"history_json": {"raw_ref": rec["raw_ref"], "rows_path": rec["rows_path"], "columns": rec["columns"], "where": rec["where"],
                                         "sha256": rec["sha256"], "rows_used": rec["rows_used"]}}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…