Closed domna closed 2 months ago
@domna This seems to work with
def is_value_valid_element_of_enum(value, elem) -> Tuple[bool, list]:
"""Checks whether a value has to be specific from the NXDL enumeration and returns options."""
if elem is not None:
enums = nexus.get_enums(elem)
if enums and (
isinstance(value, list) or value not in enums or value == ""
):
return False, enums
return True, []
But I don't overlook where else this is used. I suggest to also make this a warning instead of Exceptions: https://github.com/FAIRmat-NFDI/pynxtools/blob/6960709e974a39a55d139f5c6430aaa1bdcc38e1/pynxtools/dataconverter/helpers.py#L632
Also, this should be a warning, I would say: https://github.com/FAIRmat-NFDI/pynxtools/blob/6960709e974a39a55d139f5c6430aaa1bdcc38e1/pynxtools/dataconverter/helpers.py#L478
Thanks for the comments. I agree with your suggestions and will add it in https://github.com/FAIRmat-NFDI/pynxtools/pull/313
@rettigl