dcnum.common
Attributes
Lazily loaded h5py module |
Classes
Lazily load a module |
Functions
|
Get the number of processes |
|
Patiently join a worker (Thread or Process) |
|
|
|
Hook for LazyLoader that imports hdf5plugin |
Module Contents
- class dcnum.common.LazyLoader(modname: str, sibling: str = None, action: Callable = None)[source]
Lazily load a module
- Parameters:
modname (str) – The name of the module (e.g.
"scipy.ndimage")sibling (str) –
The
__name__of a sibling of the module. This is useful for performing relative imports. Consider this module structure:module-submod_1-submod_2
If
submod_1would like to lazily importsubmod_2:submod_2 = LazyLoader("submod_2", sibling==__name__)
action (Callable) – Method that should be called after the actual import. Must accept the module as an argument. This is useful if any setup steps need to be made after import (e.g. for ensuring reproducibility).
- _modname
- _mod = None
- _action = None
- dcnum.common.cpu_count() int[source]
Get the number of processes
Try to get the number of CPUs the current process can use first. Fallback to mp.cpu_count()
- dcnum.common.join_worker(worker, timeout=30, retries=10, logger=None, name=None)[source]
Patiently join a worker (Thread or Process)
- dcnum.common.h5py
Lazily loaded h5py module