resolve_keyed_source

function of dascore.io.utils source

resolve_keyed_source(
    sources: collections.abc.Mapping[collections.abc.Mapping[str, Any], collections.abc.Iterable[tuple[str, Any]]] ,
    key ,
    where: str = the resource,
)

Return the one source a native logical key names.

An empty resource is missing data. An unknown key, an ambiguous keyless resource, or a key naming multiple sources cannot be resolved. Native keys do not fall back to positional indices.

sources maps each native key to whatever the caller needs back, and is read lazily, so an h5py group can be passed as it is. Pass (key, value) pairs instead where a resource can state one key twice, so the ambiguity is seen rather than silently resolved.