parse_hive_path_attrs

function of dascore.utils.paths source

parse_hive_path_attrs(
    rel_posix: str ,
)-> ‘dict[str, str]’

Parse hive-style key=value pairs from a relative path.

Only the directories containing the source participate, as in Hive partitioning; the source’s own name — the last segment, whether that is a file or a directory-format unit — is opaque. A segment holds one pair (acquisition_key=XX.R2D1..RAW/) or several separated by __, the same separator DASCore’s default patch names use, as in cable=n__tag=raw/. Keys and values are percent-decoded after splitting, so encoded = (%3D), __ (%5F%5F), and . survive inside either part. When a key repeats, the deepest (then rightmost) one wins. Pairs with an empty key or value, or with Hive’s NULL sentinel as the value, are skipped, as are segments/parts without =.

Parameters

Parameter Description
rel_posix A POSIX-style path relative to the spool root (as stored in the
index), e.g. "acquisition_key=XX.R2D1..RAW/file.h5".

Examples

from dascore.utils.paths import parse_hive_path_attrs
parse_hive_path_attrs("acquisition_key=XX.R2D1..RAW/cable=n/file.h5")
{'acquisition_key': 'XX.R2D1..RAW', 'cable': 'n'}