From b738a0fc1c620f3836d868235af16dfb61a91a50 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Thu, 27 Jun 2024 07:20:15 +0000 Subject: [PATCH] [autofix.ci] apply automated fixes --- tests/ocpp-server/server.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/ocpp-server/server.py b/tests/ocpp-server/server.py index 5738c7e3..c8bdd085 100644 --- a/tests/ocpp-server/server.py +++ b/tests/ocpp-server/server.py @@ -2,7 +2,6 @@ import argparse import asyncio import logging from datetime import datetime, timezone -from functools import partial from threading import Timer import ocpp.v201 @@ -127,7 +126,6 @@ class ChargePoint(ocpp.v201.ChargePoint): logging.info("%s filed", Action.GetBaseReport) - # Function to send OCPP command async def send_ocpp_command(cp, command_name, delay=None, period=None): try: @@ -147,7 +145,9 @@ async def send_ocpp_command(cp, command_name, delay=None, period=None): await asyncio.sleep(delay) if period: - my_timer = RepeatTimer(period, asyncio.create_task, [cp.send_ocpp_command(command_name)]) + my_timer = RepeatTimer( + period, asyncio.create_task, [cp.send_ocpp_command(command_name)] + ) my_timer.start() @@ -184,6 +184,7 @@ async def on_connect(websocket, path): ChargePoints.remove(cp) logging.debug("Connected ChargePoint(s): %d", len(ChargePoints)) + # Main function to start the WebSocket server. async def main(): # Define argument parser @@ -192,7 +193,6 @@ async def main(): parser.add_argument("--delay", type=int, help="Delay in seconds") parser.add_argument("--period", type=int, help="Period in seconds") - # Create the WebSocket server and specify the handler for new connections. server = await websockets.serve( on_connect, @@ -208,7 +208,7 @@ async def main(): for cp in ChargePoints: asyncio.create_task( send_ocpp_command(cp, args.command, args.delay, args.period) - ) + ) # Wait for the server to close (runs indefinitely). await server.wait_closed() -- 2.34.1