从 JSON 字符串反序列化场景字典。
(text: str)
| 216 | |
| 217 | @staticmethod |
| 218 | def from_json(text: str) -> Dict[str, Any]: |
| 219 | """从 JSON 字符串反序列化场景字典。""" |
| 220 | try: |
| 221 | obj = json.loads(text) |
| 222 | except json.JSONDecodeError as exc: |
| 223 | raise ValueError(f"JSON 解析失败: {exc}") from exc |
| 224 | if not isinstance(obj, dict): |
| 225 | raise ValueError("JSON 根对象必须为 object") |
| 226 | return obj |
| 227 | |
| 228 | @staticmethod |
| 229 | def to_yaml(data: Dict[str, Any]) -> str: |
nothing calls this directly
no outgoing calls
no test coverage detected