From 7abcc63a90ff86112ff4f8caaddf028e16825f8d Mon Sep 17 00:00:00 2001 From: atse Date: Mon, 8 Jul 2024 17:21:58 +0800 Subject: [PATCH] AsyncIO version Client -> AsyncioClient --- pytec/examples/aioexample.py | 4 ++-- pytec/pytec/aioclient.py | 4 ++-- pytec/pytec/gui/model/thermostat.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pytec/examples/aioexample.py b/pytec/examples/aioexample.py index c502995..598aef2 100644 --- a/pytec/examples/aioexample.py +++ b/pytec/examples/aioexample.py @@ -1,9 +1,9 @@ import asyncio -from pytec.aioclient import Client +from pytec.aioclient import AsyncioClient async def main(): - tec = Client() + tec = AsyncioClient() await tec.start_session() # (host="192.168.1.26", port=23) await tec.set_param("s-h", 1, "t0", 20) print(await tec.get_pwm()) diff --git a/pytec/pytec/aioclient.py b/pytec/pytec/aioclient.py index 57f2c2e..e423e89 100644 --- a/pytec/pytec/aioclient.py +++ b/pytec/pytec/aioclient.py @@ -11,7 +11,7 @@ class StoppedConnecting(Exception): pass -class Client: +class AsyncioClient: def __init__(self): self._reader = None self._writer = None @@ -26,7 +26,7 @@ class Client: Throws asyncio.TimeoutError if timeout was exceeded. Example:: - client = Client() + client = AsyncioClient() try: await client.start_session() except StoppedConnecting: diff --git a/pytec/pytec/gui/model/thermostat.py b/pytec/pytec/gui/model/thermostat.py index 8013c12..8dc8e52 100644 --- a/pytec/pytec/gui/model/thermostat.py +++ b/pytec/pytec/gui/model/thermostat.py @@ -3,7 +3,7 @@ from qasync import asyncSlot from pytec.gui.model.property import Property, PropertyMeta import asyncio import logging -from pytec.aioclient import Client +from pytec.aioclient import AsyncioClient class Thermostat(QObject, metaclass=PropertyMeta): @@ -20,7 +20,7 @@ class Thermostat(QObject, metaclass=PropertyMeta): def __init__(self, parent, update_s): self._update_s = update_s - self._client = Client() + self._client = AsyncioClient() self._watch_task = None self._report_mode_task = None self._poll_for_report = True