Source code for ewoksfluo.tasks.hdf5_utils

# TODO: copied from ewoksxrpd with a different (instrument group is not linked directly) -> extract to ewoksdata

import os
from typing import Union

import h5py
from silx.io.url import DataUrl
from blissdata.h5api import dynamic_hdf5






def _get_hdf5_filename(file_obj) -> str:
    try:
        return file_obj.filename
    except AttributeError:
        # to be fixed in blissdata
        return file_obj._retry_handler.file_obj.filename






def _normalize_hdf5_item_name(*parts) -> str:
    name = "/".join([s for part in parts for s in part.split("/") if s])
    return f"/{name}"