bindings: python: loosen type requirements in public API
authorVincent Fazio <vfazio@xes-inc.com>
Thu, 14 Nov 2024 14:50:56 +0000 (08:50 -0600)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 19 Nov 2024 14:21:01 +0000 (15:21 +0100)
commit8f62e6c45355588621ca5916cfab6d1d8e787a77
treedc6d4bed66f6f4521047152bda06461a9611d020
parentb306ce694ab1acf75502ae1cedf8ab6d8d9e7647
bindings: python: loosen type requirements in public API

Previously, `Chip.request_lines` and `LineRequest.reconfigure_lines`
were typed to accept a config argument that was either an int, a str,
or a tuple[int | str].

This had two downsides, namely:
* The tuple was typed as having only a single element and not a variable
  number of elements. The examples and test suite relied on a variable
  length tuple.
* The tuple type itself was overly restictive. The function
  implementations had no requirement that the value be a tuple, only
  that it was iterable if it was not a str or an int.

Now, these functions accept an Iterable[int | str] instead of tuples to
offer greater flexibility to callers.

This change does not break compatibility for existing users.

Closes: https://github.com/brgl/libgpiod/issues/102
Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
Link: https://lore.kernel.org/r/20241114145116.2123714-4-vfazio@xes-inc.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
bindings/python/gpiod/chip.py
bindings/python/gpiod/line_request.py