From ba5b4235b90b2f5dee92e1d40a68444e7c5b8b90 Mon Sep 17 00:00:00 2001 From: Adam Mitchell Date: Wed, 28 May 2025 20:38:39 +0000 Subject: [PATCH 1/3] Populate __init__.py files --- python_thingset/__init__.py | 1 + python_thingset/backends/__init__.py | 4 ++++ python_thingset/encoders/__init__.py | 2 ++ 3 files changed, 7 insertions(+) create mode 100644 python_thingset/backends/__init__.py create mode 100644 python_thingset/encoders/__init__.py diff --git a/python_thingset/__init__.py b/python_thingset/__init__.py index e69de29..3e43df2 100644 --- a/python_thingset/__init__.py +++ b/python_thingset/__init__.py @@ -0,0 +1 @@ +from .thingset import ThingSet diff --git a/python_thingset/backends/__init__.py b/python_thingset/backends/__init__.py new file mode 100644 index 0000000..73c7099 --- /dev/null +++ b/python_thingset/backends/__init__.py @@ -0,0 +1,4 @@ +from .backend import ThingSetBackend +from .can import ThingSetCAN +from .serial import ThingSetSerial +from .socket import ThingSetSock diff --git a/python_thingset/encoders/__init__.py b/python_thingset/encoders/__init__.py new file mode 100644 index 0000000..3cd09bf --- /dev/null +++ b/python_thingset/encoders/__init__.py @@ -0,0 +1,2 @@ +from .binary import ThingSetBinaryEncoder +from .text import ThingSetTextEncoder From 045a65c177f2be455c500fa6ef6152b535b50e76 Mon Sep 17 00:00:00 2001 From: Adam Mitchell Date: Wed, 28 May 2025 20:41:32 +0000 Subject: [PATCH 2/3] Refactor imports --- python_thingset/backends/can.py | 2 +- python_thingset/backends/serial.py | 2 +- python_thingset/backends/socket.py | 2 +- python_thingset/cli.py | 2 +- python_thingset/client.py | 2 +- python_thingset/response.py | 2 +- python_thingset/thingset.py | 5 +---- 7 files changed, 7 insertions(+), 10 deletions(-) diff --git a/python_thingset/backends/can.py b/python_thingset/backends/can.py index af45b53..53f549e 100644 --- a/python_thingset/backends/can.py +++ b/python_thingset/backends/can.py @@ -12,7 +12,7 @@ from .backend import ThingSetBackend from ..client import ThingSetClient -from ..encoders.binary import ThingSetBinaryEncoder +from ..encoders import ThingSetBinaryEncoder from ..id import ThingSetID from ..log import get_logger diff --git a/python_thingset/backends/serial.py b/python_thingset/backends/serial.py index b71ae72..dddc6f9 100644 --- a/python_thingset/backends/serial.py +++ b/python_thingset/backends/serial.py @@ -10,7 +10,7 @@ from .backend import ThingSetBackend from ..client import ThingSetClient -from ..encoders.text import ThingSetTextEncoder +from ..encoders import ThingSetTextEncoder from ..log import get_logger diff --git a/python_thingset/backends/socket.py b/python_thingset/backends/socket.py index ed30b39..ccf101c 100644 --- a/python_thingset/backends/socket.py +++ b/python_thingset/backends/socket.py @@ -9,7 +9,7 @@ from .backend import ThingSetBackend from ..client import ThingSetClient -from ..encoders.binary import ThingSetBinaryEncoder +from ..encoders import ThingSetBinaryEncoder class Sock(ThingSetBackend): diff --git a/python_thingset/cli.py b/python_thingset/cli.py index af2abea..30e1185 100755 --- a/python_thingset/cli.py +++ b/python_thingset/cli.py @@ -10,7 +10,7 @@ from time import sleep from typing import Union -from .backends.backend import ThingSetBackend +from .backends import ThingSetBackend from .thingset import ThingSet diff --git a/python_thingset/client.py b/python_thingset/client.py index 553ad5a..3dfa2e1 100644 --- a/python_thingset/client.py +++ b/python_thingset/client.py @@ -6,7 +6,7 @@ from abc import ABC, abstractmethod from typing import Any, List, Union -from .backends.backend import ThingSetBackend +from .backends import ThingSetBackend from .response import ThingSetResponse, ThingSetStatus, ThingSetValue from .log import get_logger diff --git a/python_thingset/response.py b/python_thingset/response.py index 5b32b6b..128c2eb 100644 --- a/python_thingset/response.py +++ b/python_thingset/response.py @@ -9,7 +9,7 @@ import cbor2 -from .backends.backend import ThingSetBackend +from .backends import ThingSetBackend @dataclass diff --git a/python_thingset/thingset.py b/python_thingset/thingset.py index bde0cc8..50accc5 100755 --- a/python_thingset/thingset.py +++ b/python_thingset/thingset.py @@ -5,10 +5,7 @@ # from typing import Any, List, Union -from .backends.backend import ThingSetBackend -from .backends.can import ThingSetCAN -from .backends.serial import ThingSetSerial -from .backends.socket import ThingSetSock +from .backends import ThingSetBackend, ThingSetCAN, ThingSetSerial, ThingSetSock from .response import ThingSetResponse From 32a1ba8fcfe10caaa0c85dcfe9cb6cac5245638b Mon Sep 17 00:00:00 2001 From: Adam Mitchell Date: Wed, 28 May 2025 20:50:45 +0000 Subject: [PATCH 3/3] Add requisite names to __all__ lists --- python_thingset/__init__.py | 2 ++ python_thingset/backends/__init__.py | 2 ++ python_thingset/encoders/__init__.py | 2 ++ 3 files changed, 6 insertions(+) diff --git a/python_thingset/__init__.py b/python_thingset/__init__.py index 3e43df2..acd0b3c 100644 --- a/python_thingset/__init__.py +++ b/python_thingset/__init__.py @@ -1 +1,3 @@ from .thingset import ThingSet + +__all__ = ["ThingSet"] diff --git a/python_thingset/backends/__init__.py b/python_thingset/backends/__init__.py index 73c7099..e847f19 100644 --- a/python_thingset/backends/__init__.py +++ b/python_thingset/backends/__init__.py @@ -2,3 +2,5 @@ from .can import ThingSetCAN from .serial import ThingSetSerial from .socket import ThingSetSock + +__all__ = ["ThingSetBackend", "ThingSetCAN", "ThingSetSerial", "ThingSetSock"] diff --git a/python_thingset/encoders/__init__.py b/python_thingset/encoders/__init__.py index 3cd09bf..5ae1c2b 100644 --- a/python_thingset/encoders/__init__.py +++ b/python_thingset/encoders/__init__.py @@ -1,2 +1,4 @@ from .binary import ThingSetBinaryEncoder from .text import ThingSetTextEncoder + +__all__ = ["ThingSetBinaryEncoder", "ThingSetTextEncoder"]