Skip to content

Commit 589d2fb

Browse files
committed
Format code.
1 parent 1b52cf9 commit 589d2fb

2 files changed

Lines changed: 9 additions & 22 deletions

File tree

src/wolsocketproxy/monitor.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ async def fetch(session: ClientSession, url: str, timeout: ClientTimeout) -> int
6363
assert conf.online_check_http_url is not None
6464

6565
resp_future = fetch(
66-
session,
67-
conf.online_check_http_url,
68-
timeout=ClientTimeout(total=conf.online_check_timeout)
66+
session, conf.online_check_http_url, timeout=ClientTimeout(total=conf.online_check_timeout)
6967
)
7068

7169
result_names.append(name)

src/wolsocketproxy/proxy.py

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class IPMIConfig:
5252
class ProxyConfig:
5353
routes: list[ProxyRoute]
5454
machines: dict[str, MachineConfig] | None = None
55-
mac_mappings: dict[str, str] | None = None # Deprecated, use machines[n].mac_address instead
55+
mac_mappings: dict[str, str] | None = None # Deprecated, use machines[n].mac_address instead
5656
ipmi_configs: list[IPMIConfig] | None = None
5757

5858

@@ -66,12 +66,7 @@ class ProxyUdpProtocol(asyncio.DatagramProtocol):
6666
_target_pair: tuple[str, int]
6767

6868
def __init__(
69-
self,
70-
proxy: "Proxy",
71-
monitor: Monitor,
72-
target_machine_name: str,
73-
target_address: str,
74-
target_port: int
69+
self, proxy: "Proxy", monitor: Monitor, target_machine_name: str, target_address: str, target_port: int
7570
) -> None:
7671
self._proxy = proxy
7772
self._monitor = monitor
@@ -81,7 +76,7 @@ def __init__(
8176
self._target_pair = (target_address, target_port)
8277

8378
@override
84-
def connection_made(self, transport: asyncio.transports.DatagramTransport) -> None: # type: ignore[override]
79+
def connection_made(self, transport: asyncio.transports.DatagramTransport) -> None: # type: ignore[override]
8580
self._transport = transport
8681

8782
@override
@@ -204,7 +199,7 @@ async def __pipe(self, target_address: str, reader: asyncio.StreamReader, writer
204199
finally:
205200
writer.close()
206201

207-
def __make_tcp_route_handler(self, target_machine_name: str, target_address: str, target_port: int) -> Any: # noqa: ANN401
202+
def __make_tcp_route_handler(self, target_machine_name: str, target_address: str, target_port: int) -> Any: # noqa: ANN401
208203
async def handler(local_reader: asyncio.StreamReader, local_writer: asyncio.StreamWriter) -> None:
209204
if not self._monitor.is_available(target_machine_name):
210205
await self._wake_up_target(target_machine_name)
@@ -229,9 +224,7 @@ def __create_udp_route(self, route: ProxyRoute) -> None:
229224
loop = asyncio.get_event_loop()
230225

231226
cr = loop.create_datagram_endpoint(
232-
lambda: ProxyUdpProtocol(
233-
self, self._monitor, target_machine_name, route.target_address, route.target_port
234-
),
227+
lambda: ProxyUdpProtocol(self, self._monitor, target_machine_name, route.target_address, route.target_port),
235228
local_addr=(route.local_address, route.local_port),
236229
)
237230

@@ -271,7 +264,8 @@ async def _wake_up_target(self, target_machine_name: str) -> None:
271264
if machine.ipmi_reset_retried_count > machine.ipmi_max_reset_try_count:
272265
self._log.error(
273266
"Target %s still not online after %d IPMI resets, will not retry!",
274-
target_machine_name, machine.ipmi_reset_retried_count
267+
target_machine_name,
268+
machine.ipmi_reset_retried_count,
275269
)
276270

277271
raise ConnectionAbortedError(f"Target {target_machine_name} does not wake up!")
@@ -300,11 +294,7 @@ async def __call_reset_on_ipmi(self, ipmi_config: IPMIConfig, reset_type: str) -
300294
await asyncio.to_thread(ipmi_client.login, auth="session")
301295

302296
await perform_ipmi_action(
303-
ipmi_client,
304-
"/redfish/v1/Systems/1/Actions/ComputerSystem.Reset",
305-
body={
306-
"ResetType": reset_type
307-
}
297+
ipmi_client, "/redfish/v1/Systems/1/Actions/ComputerSystem.Reset", body={"ResetType": reset_type}
308298
)
309299
finally:
310300
await asyncio.to_thread(ipmi_client.logout)
@@ -326,4 +316,3 @@ async def __reset_by_ipmi(self, target_address: str, machine: MachineConfig) ->
326316
await self.__call_reset_on_ipmi(ipmi_config, "PowerCycle")
327317

328318
self._log.info("Target %s power-cycle succeeded, waiting for online...", target_address)
329-

0 commit comments

Comments
 (0)