MCPcopy Create free account
hub / github.com/algorithmicsuperintelligence/optillm / save_result

Function save_result

scripts/eval_imobench_answer.py:202–215  ·  view source on GitHub ↗

Save a single result to the results file with incremental updates

(filename: str, result: Dict)

Source from the content-addressed store, hash-verified

200
201
202def save_result(filename: str, result: Dict):
203 """Save a single result to the results file with incremental updates"""
204 results = []
205 if os.path.exists(filename):
206 try:
207 with open(filename, 'r') as f:
208 results = json.load(f)
209 except (FileNotFoundError, json.JSONDecodeError):
210 results = []
211
212 results.append(result)
213
214 with open(filename, 'w') as f:
215 json.dump(results, f, indent=2)
216
217
218def load_existing_results(filename: str) -> List[Dict]:

Callers 1

mainFunction · 0.70

Calls 1

loadMethod · 0.80

Tested by

no test coverage detected