Unverified Commit e6a3dea5 authored by John Chilton's avatar John Chilton Committed by GitHub
Browse files

Merge pull request #20492 from natefoo/optional-edam

[24.2] Make optional edam-ontology in datatypes registry optional
parents 539441dd 957ccca5
Loading
Loading
Loading
Loading
+14 −9
Original line number Diff line number Diff line
@@ -57,8 +57,12 @@ class ConfigurationError(Exception):

class Registry:
    def __init__(self, config=None):
        self.log = logging.getLogger(__name__)
        self.log.addHandler(logging.NullHandler())

        edam_ontology_path = config.get("edam_toolbox_ontology_path", None) if config is not None else None

        try:
            edam = load_edam_tree(
                None if not edam_ontology_path or not os.path.exists(edam_ontology_path) else edam_ontology_path,
                "format_",
@@ -66,9 +70,10 @@ class Registry:
                "operation_",
                "topic_",
            )
        except AssertionError as exc:
            self.log.warning(exc)
            edam = {}

        self.log = logging.getLogger(__name__)
        self.log.addHandler(logging.NullHandler())
        self.config = config
        self.edam = edam
        self.datatypes_by_extension: Dict[str, Data] = {}