Utils
Module with utils functions for qosst-hal.
- qosst_hal.utils.list_hardware(package: str) Dict[str, List[str]]
Return the list of classes inheriting from QOSSTHardware (except QOSSTHardware) as a Dict of list of str in the package. The key corresponds to the module name and the list to the list of hardware classes.
- Parameters:
module (str) – name of the package to inspect.
- Returns:
dict containing the list of hardwares for each submodule.
- Return type:
Dict[str, List[str]]
- qosst_hal.utils.list_hardware_str(package: str) str
Return the list of classes inheriting from QOSSTHardware (except QOSSTHardware) as a a str.
- Parameters:
package (str) – name of the package to inspect.
- Returns:
str containing the list of hardwares for each submodule.
- Return type:
str
- qosst_hal.utils.need_modules(*modules: str) Callable
Decorator generator.
This will generate a decorator ensuring that the needed modules are loadable before starting the execution of class methods.
- Parameters:
modules (str) – needed modules (
*args)
Here is a usage example :
from cvqkd_hal.utils import need_modules @need_modules("scipy", "numpy") def Class: def __init__(self): print(scipy.constants.c) print(numpy.__version__)