mirror of
https://github.com/bec-project/ophyd_devices.git
synced 2026-11-04 03:53:11 +01:00
fix(utils): coerce explicit status timeouts through float()
This commit is contained in:
1 parent
00c14b28be
commit
ff7e023c3a
1 file changed
+6
@@ -252,6 +252,12 @@ def _resolve_timeout(timeout, obj) -> float | None:
|
||||
if timeout is NO_TIMEOUT:
|
||||
return None
|
||||
if timeout is not None:
|
||||
try:
|
||||
timeout = float(timeout)
|
||||
except (TypeError, ValueError) as exc:
|
||||
raise TypeError(
|
||||
f"Status timeout must be a number, None or NO_TIMEOUT, got {timeout!r}"
|
||||
) from exc
|
||||
if not math.isfinite(timeout) or timeout <= 0:
|
||||
return None
|
||||
return timeout
|
||||
|
||||
Reference in new issue
Block a user