diff mbox series

[libgpiod,v2,02/23] bindings: python: make internal a private submodule

Message ID 20241114145116.2123714-3-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:50 p.m. UTC
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>
---
 bindings/python/gpiod/{internal.py => _internal.py} | 0
 bindings/python/gpiod/chip.py                       | 2 +-
 bindings/python/gpiod/line_request.py               | 3 +--
 3 files changed, 2 insertions(+), 3 deletions(-)
 rename bindings/python/gpiod/{internal.py => _internal.py} (100%)

Comments

Bartosz Golaszewski Nov. 20, 2024, 1:59 p.m. UTC | #1
On Thu, Nov 14, 2024 at 3:51 PM Vincent Fazio <vfazio@xes-inc.com> wrote:
>
> 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>
> ---

FYI this broke `make dist` because the Makefile still tries to package
internal.py (without the '_' prefix). I fixed it in tree.

Bart
diff mbox series

Patch

diff --git a/bindings/python/gpiod/internal.py b/bindings/python/gpiod/_internal.py
similarity index 100%
rename from bindings/python/gpiod/internal.py
rename to bindings/python/gpiod/_internal.py
diff --git a/bindings/python/gpiod/chip.py b/bindings/python/gpiod/chip.py
index 29c30f5..175fcb0 100644
--- a/bindings/python/gpiod/chip.py
+++ b/bindings/python/gpiod/chip.py
@@ -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/line_request.py b/bindings/python/gpiod/line_request.py
index 292fa1b..a8e4a87 100644
--- a/bindings/python/gpiod/line_request.py
+++ b/bindings/python/gpiod/line_request.py
@@ -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: