correct mypy issues II

This commit is contained in:
Justus Kuhlmann 2025-12-02 12:35:41 +01:00
commit c46eb68305
Signed by: jkuhl
GPG key ID: 00ED992DD79B85A6
2 changed files with 11 additions and 11 deletions

View file

@ -2,7 +2,7 @@ import pyerrors.input.openQCD as input
import datalad.api as dl import datalad.api as dl
import os import os
import fnmatch import fnmatch
from typing import Any from typing import Any, Optional
def read_ms1_param(path: str, project: str, file_in_project: str) -> dict[str, Any]: def read_ms1_param(path: str, project: str, file_in_project: str) -> dict[str, Any]:
@ -67,7 +67,7 @@ def read_ms3_param(path: str, project: str, file_in_project: str) -> dict[str, A
return param return param
def read_rwms(path: str, project: str, dir_in_project: str, param: dict[str, Any], prefix: str, postfix: str="ms1", version: str='2.0', names: list[str]=None, files: list[str]=None) -> dict[str, Any]: def read_rwms(path: str, project: str, dir_in_project: str, param: dict[str, Any], prefix: str, postfix: str="ms1", version: str='2.0', names: Optional[list[str]]=None, files: Optional[list[str]]=None) -> dict[str, Any]:
dataset = os.path.join(path, "projects", project) dataset = os.path.join(path, "projects", project)
directory = os.path.join(dataset, dir_in_project) directory = os.path.join(dataset, dir_in_project)
if files is None: if files is None:
@ -94,7 +94,7 @@ def read_rwms(path: str, project: str, dir_in_project: str, param: dict[str, Any
return rw_dict return rw_dict
def extract_t0(path: str, project: str, dir_in_project: str, param: dict[str, Any], prefix: str, dtr_read: int, xmin: int, spatial_extent: int, fit_range: int = 5, postfix: str=None, names: list[str]=None, files: list[str]=None) -> dict[str, Any]: def extract_t0(path: str, project: str, dir_in_project: str, param: dict[str, Any], prefix: str, dtr_read: int, xmin: int, spatial_extent: int, fit_range: int = 5, postfix: str="", names: Optional[list[str]]=None, files: Optional[list[str]]=None) -> dict[str, Any]:
dataset = os.path.join(path, "projects", project) dataset = os.path.join(path, "projects", project)
directory = os.path.join(dataset, dir_in_project) directory = os.path.join(dataset, dir_in_project)
if files is None: if files is None:
@ -132,7 +132,7 @@ def extract_t0(path: str, project: str, dir_in_project: str, param: dict[str, An
return t0_dict return t0_dict
def extract_t1(path: str, project: str, dir_in_project: str, param: dict[str, Any], prefix: str, dtr_read: int, xmin: int, spatial_extent: int, fit_range: int = 5, postfix: str = None, names: list[str]=None, files: list[str]=None) -> dict[str, Any]: def extract_t1(path: str, project: str, dir_in_project: str, param: dict[str, Any], prefix: str, dtr_read: int, xmin: int, spatial_extent: int, fit_range: int = 5, postfix: str = "", names: Optional[list[str]]=None, files: Optional[list[str]]=None) -> dict[str, Any]:
directory = os.path.join(path, "projects", project, dir_in_project) directory = os.path.join(path, "projects", project, dir_in_project)
if files is None: if files is None:
files = [] files = []

View file

@ -5,7 +5,7 @@ import os
from typing import Any from typing import Any
bi_corrs: list = ["f_P", "fP", "f_p", bi_corrs: list[str] = ["f_P", "fP", "f_p",
"g_P", "gP", "g_p", "g_P", "gP", "g_p",
"fA0", "f_A", "f_a", "fA0", "f_A", "f_a",
"gA0", "g_A", "g_a", "gA0", "g_A", "g_a",
@ -43,7 +43,7 @@ bi_corrs: list = ["f_P", "fP", "f_p",
"l3A2", "l3_A2", "g_av23", "l3A2", "l3_A2", "g_av23",
] ]
bb_corrs: list = [ bb_corrs: list[str] = [
'F1', 'F1',
'F_1', 'F_1',
'f_1', 'f_1',
@ -64,7 +64,7 @@ bb_corrs: list = [
'F_sPdP_d', 'F_sPdP_d',
] ]
bib_corrs: list = [ bib_corrs: list[str] = [
'F_V0', 'F_V0',
'K_V0', 'K_V0',
] ]
@ -184,7 +184,7 @@ def read_param(path: str, project: str, file_in_project: str) -> dict[str, Any]:
return params return params
def _map_params(params: dict, spec_list: list) -> dict[str, Any]: def _map_params(params: dict[str, Any], spec_list: list[str]) -> dict[str, Any]:
""" """
Map the extracted parameters to the extracted data. Map the extracted parameters to the extracted data.
@ -194,7 +194,7 @@ def _map_params(params: dict, spec_list: list) -> dict[str, Any]:
The parameters extracted from the parameter (input) file. in the dict form given by read_param. The parameters extracted from the parameter (input) file. in the dict form given by read_param.
spec_list: list spec_list: list
The list of specifications that belongs to the dorrelator in question. The list of specifications that belongs to the dorrelator in question.
Return Return
------ ------
new_specs: dict new_specs: dict
@ -228,7 +228,7 @@ def _map_params(params: dict, spec_list: list) -> dict[str, Any]:
return new_specs return new_specs
def get_specs(key, parameters, sep='/') -> str: def get_specs(key: str, parameters: dict[str, Any], sep: str = '/') -> str:
key_parts = key.split(sep) key_parts = key.split(sep)
if corr_types[key_parts[0]] == 'bi': if corr_types[key_parts[0]] == 'bi':
param = _map_params(parameters, key_parts[1:-1]) param = _map_params(parameters, key_parts[1:-1])
@ -238,7 +238,7 @@ def get_specs(key, parameters, sep='/') -> str:
return s return s
def read_data(path, project, dir_in_project, prefix, param, version='1.0c', cfg_seperator='n', sep='/', **kwargs) -> dict: def read_data(path: str, project: str, dir_in_project: str, prefix: str, param: dict[str, Any], version: str = '1.0c', cfg_seperator: str = 'n', sep: str = '/', **kwargs: Any) -> dict[str, Any]:
""" """
Extract the data from the sfcf file. Extract the data from the sfcf file.