From: Vincent Fazio Date: Thu, 14 Nov 2024 14:51:01 +0000 (-0600) Subject: bindings: python: add type hints for Chip's internal members X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=1cc8bedab60e9c72c215076424dceba0ecba5ff4;p=qemu-gpiodev%2Flibgpiod.git bindings: python: add type hints for Chip's internal members Add type hints for Chip'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 Link: https://lore.kernel.org/r/20241114145116.2123714-9-vfazio@xes-inc.com Signed-off-by: Bartosz Golaszewski --- diff --git a/bindings/python/gpiod/chip.py b/bindings/python/gpiod/chip.py index bf38c7f..69ea777 100644 --- a/bindings/python/gpiod/chip.py +++ b/bindings/python/gpiod/chip.py @@ -61,8 +61,8 @@ class Chip: path: Path to the GPIO character device file. """ - self._chip = _ext.Chip(path) - self._info = None + self._chip: Union[_ext.Chip, None] = _ext.Chip(path) + self._info: Union[ChipInfo, None] = None def __bool__(self) -> bool: """