From ad8df5d38dd7ef010f652a4e60f4af2c67e6d908 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 27 Jun 2024 22:19:25 +0200 Subject: [PATCH] chore(ocpp-server): refine ruff linter configuration MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- tests/ocpp-server/pyproject.toml | 2 +- tests/ocpp-server/server.py | 3 ++- tests/ocpp-server/timer.py | 11 ++++------- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/tests/ocpp-server/pyproject.toml b/tests/ocpp-server/pyproject.toml index c01082ee..3d9c4e3b 100644 --- a/tests/ocpp-server/pyproject.toml +++ b/tests/ocpp-server/pyproject.toml @@ -20,7 +20,7 @@ format = "ruff format . && ruff check --fix ." lint = "ruff format --check --diff . && ruff check --diff ." [tool.ruff.lint] -select = ["E", "W", "F", "B", "Q", "I"] +select = ["E", "W", "F", "ASYNC", "S", "B", "A", "Q", "RUF", "I"] [build-system] diff --git a/tests/ocpp-server/server.py b/tests/ocpp-server/server.py index a7ec73c4..a5ebed38 100644 --- a/tests/ocpp-server/server.py +++ b/tests/ocpp-server/server.py @@ -170,7 +170,8 @@ async def on_connect( period: Optional[float], ): """For every new charge point that connects, create a ChargePoint instance and start - listening for messages.""" + listening for messages. + """ try: requested_protocols = websocket.request_headers["Sec-WebSocket-Protocol"] except KeyError: diff --git a/tests/ocpp-server/timer.py b/tests/ocpp-server/timer.py index b267bef6..aca74045 100644 --- a/tests/ocpp-server/timer.py +++ b/tests/ocpp-server/timer.py @@ -1,6 +1,4 @@ -""" -Timer for asyncio. -""" +"""Timer for asyncio.""" import asyncio @@ -17,7 +15,7 @@ class Timer: """An asynchronous Timer object. Parameters - ----------- + ---------- timeout: :class:`float`: The duration for which the timer should last. @@ -33,6 +31,7 @@ class Timer: callback_kwargs: Optional[:class:`dict`]: The kwargs to be passed to the callback. + """ self._timeout = timeout self._repeat = repeat @@ -61,7 +60,5 @@ class Timer: self._callback(*self._callback_args, **self._callback_kwargs) def cancel(self): - """ - Cancels the timer. The callback will not be called. - """ + """Cancels the timer. The callback will not be called.""" self._task.cancel() -- 2.34.1