| 6228 | } |
| 6229 | |
| 6230 | fn verification_reports_from_value( |
| 6231 | reports: serde_json::Value, |
| 6232 | ) -> PyResult<Vec<RustVerificationReport>> { |
| 6233 | let reports = match reports { |
| 6234 | serde_json::Value::Array(_) => serde_json::from_value(reports), |
| 6235 | serde_json::Value::Object(_) => { |
| 6236 | serde_json::from_value::<RustVerificationReport>(reports).map(|report| vec![report]) |
| 6237 | } |
| 6238 | _ => { |
| 6239 | return Err(PyTypeError::new_err( |
| 6240 | "verification reports must be a list or dict", |
| 6241 | )); |
| 6242 | } |
| 6243 | }; |
| 6244 | reports.map_err(|e| PyValueError::new_err(format!("Invalid verification report: {e}"))) |
| 6245 | } |
| 6246 | |
| 6247 | fn py_verification_reports_to_rust( |
| 6248 | _py: Python<'_>, |