diff mbox series

[libgpiod,v2,10/23] bindings: python: add type hints for LineRequest's internal members

Message ID 20241114145116.2123714-11-vfazio@xes-inc.com
State New
Headers show
Series bindings: python: conform to mypy and ruff linter recommendations | expand

Commit Message

Vincent Fazio Nov. 14, 2024, 2:51 p.m. UTC
Add type hints for LineRequest's internal members so type checkers can
ensure the code properly constrains to these types and accounts for
scenarios where the values are `None`.

Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
---
 bindings/python/gpiod/line_request.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/bindings/python/gpiod/line_request.py b/bindings/python/gpiod/line_request.py
index 0846e6b..f8bbf64 100644
--- a/bindings/python/gpiod/line_request.py
+++ b/bindings/python/gpiod/line_request.py
@@ -34,7 +34,12 @@  class LineRequest:
         LineRequest objects can only be instantiated by a Chip parent. This is
         not part of stable API.
         """
-        self._req = req
+        self._req: Union[_ext.Request, None] = req
+        self._chip_name: str
+        self._offsets: list[int]
+        self._name_map: dict[str, int]
+        self._offset_map: dict[int, str]
+        self._lines: list[Union[int, str]]
 
     def __bool__(self) -> bool:
         """