From 047656c31d035ac3ffefa54f9d9c0b6a7915cf42 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 21 Aug 2025 12:21:41 +0200 Subject: [PATCH] refactor(qav3): add input guards MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- quickadapter/user_data/strategies/Utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/quickadapter/user_data/strategies/Utils.py b/quickadapter/user_data/strategies/Utils.py index b296804..a71e041 100644 --- a/quickadapter/user_data/strategies/Utils.py +++ b/quickadapter/user_data/strategies/Utils.py @@ -1019,6 +1019,8 @@ def round_to_step(value: float | int, step: int) -> int: @lru_cache(maxsize=128) def ceil_to_step(value: float | int, step: int) -> int: + if not isinstance(value, (int, float)): + raise ValueError("value must be an integer or float") if not isinstance(step, int) or step <= 0: raise ValueError("step must be a positive integer") if isinstance(value, (int, np.integer)): @@ -1030,6 +1032,8 @@ def ceil_to_step(value: float | int, step: int) -> int: @lru_cache(maxsize=128) def floor_to_step(value: float | int, step: int) -> int: + if not isinstance(value, (int, float)): + raise ValueError("value must be an integer or float") if not isinstance(step, int) or step <= 0: raise ValueError("step must be a positive integer") if isinstance(value, (int, np.integer)): -- 2.43.0