diff --git a/raillabel_providerkit/validation/validate_onthology/_onthology_classes/_attributes/_attribute_abc.py b/raillabel_providerkit/validation/validate_onthology/_onthology_classes/_attributes/_attribute_abc.py index b7894ba..1ac1d68 100644 --- a/raillabel_providerkit/validation/validate_onthology/_onthology_classes/_attributes/_attribute_abc.py +++ b/raillabel_providerkit/validation/validate_onthology/_onthology_classes/_attributes/_attribute_abc.py @@ -19,7 +19,7 @@ def supports(cls, data_dict: dict) -> bool: @classmethod @abc.abstractmethod - def fromdict(cls, data_dict: dict) -> type[_Attribute]: + def fromdict(cls, data_dict: dict) -> _Attribute: raise NotImplementedError @abc.abstractmethod @@ -48,5 +48,5 @@ def _collect_attribute_classes() -> None: ATTRIBUTE_CLASSES.append(class_) -ATTRIBUTE_CLASSES = [] +ATTRIBUTE_CLASSES: list[type[_Attribute]] = [] _collect_attribute_classes() diff --git a/raillabel_providerkit/validation/validate_onthology/_onthology_classes/_attributes/_multi_select_attribute.py b/raillabel_providerkit/validation/validate_onthology/_onthology_classes/_attributes/_multi_select_attribute.py index 246a0df..32c4d3a 100644 --- a/raillabel_providerkit/validation/validate_onthology/_onthology_classes/_attributes/_multi_select_attribute.py +++ b/raillabel_providerkit/validation/validate_onthology/_onthology_classes/_attributes/_multi_select_attribute.py @@ -23,19 +23,19 @@ def fromdict(cls, data_dict: dict) -> _MultiSelectAttribute: return _MultiSelectAttribute(options=set(data_dict["options"])) def check( - self, attribute_name: str, attribute_values: bool | float | str | list, annotation_id: str + self, attribute_name: str, attribute_value: bool | float | str | list, annotation_id: str ) -> list[str]: - if type(attribute_values) is not list: + if type(attribute_value) is not list: return [ f"Attribute '{attribute_name}' of annotation {annotation_id} is of type " - f"'{attribute_values.__class__.__name__}' (should be 'list')." + f"'{attribute_value.__class__.__name__}' (should be 'list')." ] - for attribute_value in attribute_values: - if attribute_value not in self.options: + for single_value in attribute_value: + if single_value not in self.options: return [ f"Attribute '{attribute_name}' of annotation {annotation_id} has an undefined " - f"value '{attribute_value}' (defined options: {self._stringify_options()})." + f"value '{single_value}' (defined options: {self._stringify_options()})." ] return []