fusion_hat._utils module
- fusion_hat._utils.retry(times: int = 5)[source]
Retry decorator retry specified times if any error occurs
- Parameters:
times (int, optional) – number of times to retry. Defaults to 5.
- Returns:
wrapper function
- Return type:
function
- fusion_hat._utils.command_exists(cmd: str) bool[source]
Check if command exists
- Parameters:
cmd (str) – command to check
- Returns:
True if exists
- Return type:
bool
- fusion_hat._utils.run_command(cmd: str, timeout: float | None = None) tuple[source]
Run command and return status and output
- Parameters:
cmd (str) – command to run
timeout (float | None) – timeout in seconds, None for no timeout
- Returns:
status, output. On timeout, returns (124, “timed out after Ns”)
- Return type:
tuple
- fusion_hat._utils.is_installed(cmd: str) bool[source]
Check if command is installed
- Parameters:
cmd (str) – command to check
- Returns:
True if installed
- Return type:
bool
- fusion_hat._utils.mapping(x: float, in_min: float, in_max: float, out_min: float, out_max: float) float[source]
Map value from one range to another range
- Parameters:
x (float) – value to map
in_min (float) – input minimum
in_max (float) – input maximum
out_min (float) – output minimum
out_max (float) – output maximum
- Returns:
mapped value
- Return type:
float