18 from typing
import Any, List, Optional, Union
20 from ..base_parameter
import BaseParameter
21 from ...utils
import getDatasetType, fetchDataset
22 from ....project
import ProjectType
25 class DatasetParameter(BaseParameter[Union[int, str]]):
28 def types(self) -> List[type]:
31 def parseValue(self, type_: ProjectType) -> Optional[Any]:
32 if self.value
is None:
35 isLocal = isinstance(self.value, str)
36 datasetType = getDatasetType(type_, isLocal)
38 dataset = fetchDataset(datasetType, self.value)
40 raise ValueError(f
">> [Coretex] Failed to create dataset with type \"{datasetType.__name__}\"")
44 def overrideValue(self, value: Optional[Any]) -> Optional[Any]:
49 self.value = int(value)
52 if isinstance(value, str):