bindings: python: make internal a private submodule
authorVincent Fazio <vfazio@xes-inc.com>
Thu, 14 Nov 2024 14:50:55 +0000 (08:50 -0600)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 19 Nov 2024 14:21:01 +0000 (15:21 +0100)
The internal submodule shouldn't be exposed as part of the public
interface, so mark it private following PEP 8 convention [0].

[0]: https://peps.python.org/pep-0008/#public-and-internal-interfaces

Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
Link: https://lore.kernel.org/r/20241114145116.2123714-3-vfazio@xes-inc.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
bindings/python/gpiod/_internal.py [new file with mode: 0644]
bindings/python/gpiod/chip.py
bindings/python/gpiod/internal.py [deleted file]
bindings/python/gpiod/line_request.py

diff --git a/bindings/python/gpiod/_internal.py b/bindings/python/gpiod/_internal.py
new file mode 100644 (file)
index 0000000..d1e95e4
--- /dev/null
@@ -0,0 +1,18 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl>
+
+from datetime import timedelta
+from select import select
+from typing import Optional, Union
+
+__all__ = ["poll_fd"]
+
+
+def poll_fd(fd: int, timeout: Optional[Union[timedelta, float]] = None) -> bool:
+    if isinstance(timeout, timedelta):
+        sec = timeout.total_seconds()
+    else:
+        sec = timeout
+
+    readable, _, _ = select([fd], [], [], sec)
+    return True if fd in readable else False
index 29c30f5dffbfdf7d478204170deec03bbdc1f305..175fcb0e77cfbd40cc7850a41b488a1cafc403ac 100644 (file)
@@ -6,8 +6,8 @@ from errno import ENOENT
 from typing import TYPE_CHECKING, Optional, Union
 
 from . import _ext
+from ._internal import poll_fd
 from .exception import ChipClosedError
-from .internal import poll_fd
 from .line import Value
 from .line_request import LineRequest
 from .line_settings import LineSettings, _line_settings_to_ext
diff --git a/bindings/python/gpiod/internal.py b/bindings/python/gpiod/internal.py
deleted file mode 100644 (file)
index d1e95e4..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-# SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl>
-
-from datetime import timedelta
-from select import select
-from typing import Optional, Union
-
-__all__ = ["poll_fd"]
-
-
-def poll_fd(fd: int, timeout: Optional[Union[timedelta, float]] = None) -> bool:
-    if isinstance(timeout, timedelta):
-        sec = timeout.total_seconds()
-    else:
-        sec = timeout
-
-    readable, _, _ = select([fd], [], [], sec)
-    return True if fd in readable else False
index 292fa1b5fb477fa5d3b65ac2cfdb6485c35c5bee..a8e4a87d0b3ca378321bb4b55ccc77ea030f0bbf 100644 (file)
@@ -4,9 +4,8 @@
 from typing import TYPE_CHECKING, Optional, Union
 
 from . import _ext
-
+from ._internal import poll_fd
 from .exception import RequestReleasedError
-from .internal import poll_fd
 from .line_settings import LineSettings, _line_settings_to_ext
 
 if TYPE_CHECKING: