From 6e8311fe920f05cb07409896a23d8f9495a126ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Sat, 21 Dec 2024 20:48:15 -0500 Subject: [PATCH] ENH: Add type annotation for variable in GP estimation error analysis Add type annotation for local variable `scores` in GP estimation error analysis script. Fixes: ``` scripts/dwi_gp_estimation_error_analysis.py:207: error: Need type annotation for "scores" [var-annotated] ``` raised for example in: https://github.com/nipreps/nifreeze/actions/runs/12437972140/job/34728973936#step:8:112 --- scripts/dwi_gp_estimation_error_analysis.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/dwi_gp_estimation_error_analysis.py b/scripts/dwi_gp_estimation_error_analysis.py index 936931a..a061649 100644 --- a/scripts/dwi_gp_estimation_error_analysis.py +++ b/scripts/dwi_gp_estimation_error_analysis.py @@ -31,6 +31,7 @@ import argparse from collections import defaultdict from pathlib import Path +from typing import DefaultDict, List import numpy as np import pandas as pd @@ -206,7 +207,7 @@ def main() -> None: if args.kfold: # Use Scikit-learn cross validation - scores = defaultdict(list, {}) + scores: DefaultDict[str, List[float | str]] = defaultdict(list) for n in args.kfold: for i in range(args.repeats): cv_scores = -1.0 * cross_validate(X, y.T, n, n_repeats, gpr)