bindings: python: add type hint for the sec variable in poll_fd
authorVincent Fazio <vfazio@xes-inc.com>
Thu, 14 Nov 2024 14:51:00 +0000 (08:51 -0600)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 19 Nov 2024 14:21:01 +0000 (15:21 +0100)
The sec variable can be either a float or None, so type it accordingly
to avoid complaints from type checkers.

Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
Link: https://lore.kernel.org/r/20241114145116.2123714-8-vfazio@xes-inc.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
bindings/python/gpiod/_internal.py

index d1e95e4ade3146f596643d52207b367e332e6f7e..c9b5d2850389d5314a12bf6d151774a96469a085 100644 (file)
@@ -9,6 +9,7 @@ __all__ = ["poll_fd"]
 
 
 def poll_fd(fd: int, timeout: Optional[Union[timedelta, float]] = None) -> bool:
+    sec: Union[float, None]
     if isinstance(timeout, timedelta):
         sec = timeout.total_seconds()
     else: