Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
""" Manage meta-data in YAML files. """
""" Meta-data stored in a YAML file. """
#: The keys that must appear in the YAML file.
#: The keys that should be removed from the YAML file.
""" Create the metadata object. """
#: The globally unique identifier of the data.
#: The path of the directory containing the data.
#: The path of the YAML meta-data file.
""" Return the metadata as a clean dictionary for dumping to YAML. """ dictionary = vars(self).copy() dictionary.update(kwargs)
for key in self.removed_keys: if key in dictionary: del dictionary[key]
for key, value in dictionary.items(): if key.endswith('uuid'): dictionary[key] = str(value)
return dictionary
""" Dump batch metadata into a file. """ with open(yaml_path, 'w') as file: file.write(yaml.dump(self.as_dict(**kwargs), default_flow_style=False))
""" Load the batch meta-data from a file. """ lambda: YamlMetadata._load(cls, yaml_path))
_dictionary: Dict[str, Any]) -> Type[YM]: """ Decide on the concrete metadata class to load from the dictionary. """ |