meta¶
Utility functions for merging metadata for multiple files.
- class meta.MergeMetaAll[source]¶
Merge metadata by taking the set of values.
- property valid¶
Check if the value is valid.
- property value¶
Get the merged value.
- class meta.MergeMetaMax[source]¶
Merge metadata by taking the maximum value.
- property valid¶
Check if the value is valid.
- class meta.MergeMetaMin[source]¶
Merge metadata by taking the minimum value.
- property valid¶
Check if the value is valid.
- class meta.MergeMetaOverride(value=None)[source]¶
Merge metadata by overriding the value.
- property valid¶
Check if the value is valid.
- class meta.MergeMetaSubset(value=None)[source]¶
Merge metadata by taking the subset of consistent values.
- property valid¶
Check if the value is valid.
- property warn¶
Whether to warn about inconsistent metadata.
- class meta.MergeMetaSum[source]¶
Merge metadata by adding the values.
- property valid¶
Check if the value is valid.
- class meta.MergeMetaUnion[source]¶
Merge metadata by taking the union.
- property valid¶
Check if the value is valid.
- property value¶
Get the merged value.
- class meta.MergeMetaUnique(value=None)[source]¶
Merge metadata by taking the unique values.
- property valid¶
Check if the value is valid.
- class meta.MetaNameDict(meta: dict)[source]¶
Wrapper class to access metadata dictionary.
Initialize the MetaNameDict with a metadata dictionary.
- meta.check_method(files: dict) None[source]¶
Check and set the merging method based on the input file metadata.
- Parameters:
files – set of files to merge
- meta.check_required(metadata: dict) list[source]¶
Check if the metadata dictionary contains all required keys.
- Parameters:
metadata – metadata dictionary
- Returns:
List of any missing required keys
- meta.fix(name: str, metadata: dict) None[source]¶
Fix the metadata dictionary.
- Parameters:
name – name of the file (for logging)
metadata – metadata dictionary
- meta.make_name(files: dict) str[source]¶
Update merging method and create a name for the merged files.
- Parameters:
files – set of files to merge
- Returns:
merged file name
- meta.merged_keys(files: dict, warn: bool = False) dict[source]¶
Merge metadata from multiple files into a single dictionary.
- Parameters:
files – set of files to merge
warn – whether to warn about inconsistent metadata
- Returns:
merged metadata
- meta.parents(files: dict) list[str][source]¶
Retrieve all the parents from a set of files.
- Parameters:
files – set of files to merge
- Returns:
set of parents
- meta.set_extension(files: dict) None[source]¶
Get the file extension for the merged file.
- Parameters:
files – set of files to merge
- Returns:
file extension
- meta.set_method(method: dict) None[source]¶
Set merging method parameters.
- Parameters:
method – merging method dictionary