utils
Constants and helper functions.
Provides syntactic path transformations to implement the Metador container layout.
METADOR_SPEC_VERSION
module-attribute
¶
METADOR_SPEC_VERSION: Final[str] = '1.0'
Version of container spec created by this package.
METADOR_PREF
module-attribute
¶
METADOR_PREF: Final[str] = 'metador_'
Reserved prefix for group and dataset names.
METADOR_META_PREF
module-attribute
¶
METADOR_META_PREF: Final[str] = METADOR_PREF + 'meta_'
Sub-prefix for group that stores group or dataset metadata.
METADOR_TOC_PATH
module-attribute
¶
METADOR_TOC_PATH: Final[str] = f'/{METADOR_PREF}container'
Path of group with the Metador metadata index structure of the container.
METADOR_VERSION_PATH
module-attribute
¶
METADOR_VERSION_PATH: Final[
str
] = f"{METADOR_TOC_PATH}/version"
Path of dataset with the Metador container spec version of the container.
METADOR_UUID_PATH
module-attribute
¶
METADOR_UUID_PATH: Final[str] = f'{METADOR_TOC_PATH}/uuid'
Path of dataset with the Metador container version of the container.
METADOR_PACKAGES_PATH
module-attribute
¶
METADOR_PACKAGES_PATH: Final[
str
] = f"{METADOR_TOC_PATH}/packages"
Path of group with package info of packages providing used schemas in the container.
METADOR_SCHEMAS_PATH
module-attribute
¶
METADOR_SCHEMAS_PATH: Final[
str
] = f"{METADOR_TOC_PATH}/schemas"
Path of group with info about used schemas in the container.
METADOR_LINKS_PATH
module-attribute
¶
METADOR_LINKS_PATH: Final[str] = f"{METADOR_TOC_PATH}/links"
Path of group with links to schema instances in the container.
is_internal_path ¶
is_internal_path(
path: str, pref: str = METADOR_PREF
) -> bool
Return whether the path of this node is Metador-internal (metador_*).
Optional argument can set a different prefix that path segments are checked for.
Source code in src/metador_core/container/utils.py
37 38 39 40 41 42 43 |
|
is_meta_base_path ¶
is_meta_base_path(path: str) -> bool
Return whether the path is a metadata base dir (but not an inner path!).
Source code in src/metador_core/container/utils.py
49 50 51 |
|
to_meta_base_path ¶
to_meta_base_path(node_path: str, is_dataset: bool) -> str
Return path to base group containing metadata for given node.
Source code in src/metador_core/container/utils.py
54 55 56 57 58 59 60 61 62 63 |
|
to_data_node_path ¶
to_data_node_path(meta_dir_path: str) -> str
Given a metadata group path, infer the correct node path.
Path can be relative or absolute. Will not check validity of the passed path, assumes it is fitting the scheme!
Source code in src/metador_core/container/utils.py
66 67 68 69 70 71 72 73 74 75 76 77 |
|