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.

Every path segment participates, including the file name, whose extension is first stripped. A segment holds one pair (Hive layout, acquisition_key=XX.R2D1..RAW/) or several separated by __ — the same separator DASCore’s default patch names use — as in cable=n__tag=raw.h5. 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__tag=raw.h5")
{'acquisition_key': 'XX.R2D1..RAW', 'cable': 'n', 'tag': 'raw'}