drivers
Metador driver abstraction in order to enable different underlying implementations.
MetadorDriver
module-attribute
¶
MetadorDriver = Union[h5py.File, IH5Record]
Union of all supported classes (for static type check).
METADOR_DRIVERS
module-attribute
¶
METADOR_DRIVERS = MetadorDriverEnum.to_dict()
Dict representation of MetadorDriverEnum.
METADOR_DRIVER_CLASSES
module-attribute
¶
METADOR_DRIVER_CLASSES = tuple(METADOR_DRIVERS.values())
Tuple of all supported classes (for instance check).
MetadorDriverEnum ¶
Bases: Enum
Supported classes that work with MetadorContainer.
Note that they must be unrelated (i.e. not subclasses of each other).
Source code in src/metador_core/container/drivers.py
11 12 13 14 15 16 17 18 19 20 21 22 |
|
get_driver_type ¶
get_driver_type(
raw_cont: MetadorDriver,
) -> MetadorDriverEnum
Return the driver type of container (if it is a suitable (sub)class).
Source code in src/metador_core/container/drivers.py
38 39 40 41 42 43 |
|
get_source ¶
get_source(
raw_cont: MetadorDriver,
driver: MetadorDriverEnum = None,
) -> Any
Return an object (i.e. input resource(s)) needed to re-open the given container.
Source code in src/metador_core/container/drivers.py
46 47 48 49 50 51 52 53 |
|
to_h5filelike ¶
to_h5filelike(
name_or_obj: Union[MetadorDriver, Any],
mode: OpenMode = "r",
*,
driver: Optional[Type[MetadorDriver]] = None
) -> H5FileLike
Given a container or a resource with a driver, try to return a H5FileLike.
If first argument is instance of a known driver is returned unchanged. Otherwise, will try to open it using the driver (h5py.File by default).
Returns a H5FileLike compatible with MetadorContainer, or raises ValueError.
Source code in src/metador_core/container/drivers.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
|