brain_pipe.save.default.DefaultSaveMetadata¶
- class DefaultSaveMetadata(key_fn: ~typing.Callable[[~typing.Dict[str, ~typing.Any]], str] = <function default_metadata_key_fn>, filename: str = '.save_metadata.json')¶
Bases:
OldMetadataCompliant,SaveMetadataImplementation of SaveMetadata to work with DefaultSave.
Attributes
FEATURE_NAME_STRFILENAME_STROLD_FORMAT_STRSET_NAME_STRRetrieve the lock to use for the metadata file.
- __init__(key_fn: ~typing.Callable[[~typing.Dict[str, ~typing.Any]], str] = <function default_metadata_key_fn>, filename: str = '.save_metadata.json')¶
Create a new DefaultSaveMetadata.
Methods
__init__([key_fn, filename])Create a new DefaultSaveMetadata.
add(data_dict, filepath, feature_name, set_name)Add metadata for a file.
attach_saver(saver)Attach a saver to the metadata.
clear()Clear the metadata.
convert_old_format(metadata_item, data_dict)Convert the metadata item from the old format.
get()Load the metadata.
get_metadata_for_savepath(path, ...[, ...])Get the metadata associated for path where data is saved.
get_path()Get the path to the metadata file.
get_relpath(path)Construct a relative path with regard to save folder.
is_old_format(metadata_item)Check if the metadata item is in the old format.
write(metadata_dict)Write the metadata to disk.
- add(data_dict: Dict[str, Any], filepath: str, feature_name: str | None, set_name: str | None)¶
Add metadata for a file.
- attach_saver(saver)¶
Attach a saver to the metadata.
- Parameters:
saver (DefaultSave) – The saver to attach.
- clear()¶
Clear the metadata.
- convert_old_format(metadata_item: str, data_dict: Dict[str, Any])¶
Convert the metadata item from the old format.
- get_metadata_for_savepath(path: str, feature_name: str | None, set_name: str | None, from_old_format=False)¶
Get the metadata associated for path where data is saved.
- get_path()¶
Get the path to the metadata file.
- Returns:
The path to the metadata file.
- Return type:
- classmethod is_old_format(metadata_item: str | Dict[str, Any])¶
Check if the metadata item is in the old format.
- property lock¶
Retrieve the lock to use for the metadata file.
- Returns:
The lock to use for the metadata file.
- Return type: