18 from typing
import Any, List, Optional, Union
20 from ..base_list_parameter
import BaseListParameter
21 from ...utils
import getDatasetType, fetchDataset
22 from ....project
import ProjectType
23 from ....dataset
import Dataset
26 def _parseSingleDataset(value: Union[int, str], type_: ProjectType) -> Dataset:
27 isLocal = isinstance(value, str)
28 datasetType = getDatasetType(type_, isLocal)
30 dataset = fetchDataset(datasetType, value)
32 raise ValueError(f
">> [Coretex] Failed to create dataset with type \"{datasetType.__name__}\"")
37 class ListDatasetParameter(BaseListParameter[List[Union[int, str]]]):
40 def listTypes(self) -> List[type]:
43 def parseValue(self, type_: ProjectType) -> Optional[Any]:
44 if self.value
is None:
48 _parseSingleDataset(datasetValue, type_)
49 for datasetValue
in self.value