INNER CODE UNIT · Python

out

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

            out = fn(**call_args)
        except Exception as e:  # noqa: BLE001 — 纯函数不应抛出;抛出即库内部缺陷,如实标记
            out = _error_out(f"库内部异常:{type(e).__name__}: {e}", "internal_error")
    return {"calculation_id": cid, "function": function, "calc_version": CALC_VERSION, "inputs": args,
            "inputs_resolved": record, "inputs_refs": refs, "output": attach_display(out)}


def _reject_constant(name: str):
    raise ValueError(f"JSON 中不允许非标准常量 {name}(NaN / Infinity),请传 null 或有限数")


def _load_json(text: str):
    """严格 JSON 解析:拒绝 NaN / Infinity / -Infinity 字面量(Python 默认会接受)。"""
    return json.loads(text, parse_constant=_reject_constant)


def _dump(obj) -> str:
    try:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…