bindings: python: tests: add type stubs for external modules
authorVincent Fazio <vfazio@xes-inc.com>
Thu, 14 Nov 2024 14:51:11 +0000 (08:51 -0600)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 19 Nov 2024 14:23:24 +0000 (15:23 +0100)
Add type stubs for the compiled external modules so that types and
methods used from the modules are accurately type checked.

Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
Link: https://lore.kernel.org/r/20241114145116.2123714-19-vfazio@xes-inc.com
[Bartosz: add missing SPDX license and copyright tags]
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
bindings/python/tests/gpiosim/_ext.pyi [new file with mode: 0644]
bindings/python/tests/procname/_ext.pyi [new file with mode: 0644]

diff --git a/bindings/python/tests/gpiosim/_ext.pyi b/bindings/python/tests/gpiosim/_ext.pyi
new file mode 100644 (file)
index 0000000..db5a452
--- /dev/null
@@ -0,0 +1,24 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+# SPDX-FileCopyrightText: 2024 Vincent Fazio <vfazio@gmail.com>
+
+class Chip:
+    def __init__(self) -> None: ...
+    def set_label(self, label: str) -> None: ...
+    def set_num_lines(self, num_lines: int) -> None: ...
+    def set_line_name(self, offset: int, name: str) -> None: ...
+    def set_hog(self, offset: int, name: str, direction: int) -> None: ...
+    def enable(self) -> None: ...
+    def get_value(set, offset: int) -> int: ...
+    def set_pull(set, offset: int, pull: int) -> None: ...
+    @property
+    def dev_path(self) -> str: ...
+    @property
+    def name(self) -> str: ...
+
+PULL_DOWN: int
+PULL_UP: int
+VALUE_INACTIVE: int
+VALUE_ACTIVE: int
+DIRECTION_INPUT: int
+DIRECTION_OUTPUT_HIGH: int
+DIRECTION_OUTPUT_LOW: int
diff --git a/bindings/python/tests/procname/_ext.pyi b/bindings/python/tests/procname/_ext.pyi
new file mode 100644 (file)
index 0000000..df8bb15
--- /dev/null
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+# SPDX-FileCopyrightText: 2024 Vincent Fazio <vfazio@gmail.com>
+
+def set_process_name(name: str) -> None: ...