(
payload: dict[str, Any],
source_path: Path,
benchmark_index: dict[str, dict[str, Any]],
)
| 136 | |
| 137 | |
| 138 | def _normalize_payload( |
| 139 | payload: dict[str, Any], |
| 140 | source_path: Path, |
| 141 | benchmark_index: dict[str, dict[str, Any]], |
| 142 | ) -> Iterator[NormalizedResult]: |
| 143 | schema_version = _normalize_result_namespace(payload.get("schema_version", "")) |
| 144 | if schema_version in {"autopt.experiment_report.v1", "autopt.legacy_main_compat.v1"}: |
| 145 | for item in payload.get("results", []): |
| 146 | if isinstance(item, dict): |
| 147 | yield _normalize_task_result(item, source_path, benchmark_index) |
| 148 | for report in payload.get("reports", []): |
| 149 | if not isinstance(report, dict): |
| 150 | continue |
| 151 | for item in report.get("results", []): |
| 152 | if isinstance(item, dict): |
| 153 | yield _normalize_task_result(item, source_path, benchmark_index) |
| 154 | return |
| 155 | |
| 156 | if schema_version == "autopt.task_result.v1" or {"status", "benchmark_name", "model_alias"}.issubset(payload): |
| 157 | yield _normalize_task_result(payload, source_path, benchmark_index) |
| 158 | return |
| 159 | |
| 160 | if "flag" in payload: |
| 161 | yield _normalize_legacy_result(payload, source_path, benchmark_index) |
| 162 | |
| 163 | |
| 164 | def _normalize_task_result( |
no test coverage detected