monarch-initiative / koza

Data transformation framework for LinkML data models
https://koza.monarchinitiative.org/
BSD 3-Clause "New" or "Revised" License
47 stars 4 forks source link

`**yaml.safe_load(`string-path`)` will not load the YAML file. #103

Closed hrshdhgd closed 1 year ago

hrshdhgd commented 1 year ago

This is with regards to the code in source_config.py. Is self.metadata expected to be the path to metadata.yaml? If so this piece of code will not do anything and hence returns

WARNING:Could not load dataset description from metadata file

and proceeds doing its thing.

By doing this it is actually not doing anything with the metadata path. Would it make sense to code it like this (?):

            try:
                with open(self.metadata, "r") as meta:
                    object.__setattr__(
                        self, 'metadata', DatasetDescription(**yaml.safe_load(meta))
                    )
            except Exception as e:
                raise ValueError(f"Unable to load metadata from {self.metadata}: {e}")
                # LOG.warning(f"Could not load dataset description from metadata file")
hrshdhgd commented 1 year ago

I have proactively made a PR for this as seen above. You can choose to reject it if I'm mistaken and apologies in advance if I'm missing anything.