MCPcopy
hub / github.com/IBM/AssetOpsBench / _load_scenario_file

Function _load_scenario_file

src/evaluation/loader.py:126–143  ·  view source on GitHub ↗
(path: Path)

Source from the content-addressed store, hash-verified

124
125
126def _load_scenario_file(path: Path) -> list[Scenario]:
127 text = path.read_text(encoding="utf-8").strip()
128 if not text:
129 return []
130
131 if path.suffix == ".jsonl":
132 return [
133 Scenario.from_raw(json.loads(line))
134 for line in text.splitlines()
135 if line.strip()
136 ]
137
138 raw = json.loads(text)
139 if isinstance(raw, list):
140 return [Scenario.from_raw(item) for item in raw]
141 if isinstance(raw, dict):
142 return [Scenario.from_raw(raw)]
143 raise ValueError(f"unexpected scenario JSON shape in {path}: {type(raw).__name__}")
144
145
146def join_records(

Callers 1

load_scenariosFunction · 0.85

Calls 1

from_rawMethod · 0.45

Tested by

no test coverage detected