From d84aab7febf7c4bf9cd903fa2ae0a9da4f7d2236 Mon Sep 17 00:00:00 2001 From: Firepup Sixfifty Date: Wed, 31 Jul 2024 19:07:05 +0000 Subject: [PATCH] Formatting --- logs.py | 4 +++- server.py | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/logs.py b/logs.py index 3fcbdec..1b94441 100644 --- a/logs.py +++ b/logs.py @@ -33,7 +33,9 @@ def log( ) else: for line in message.split("\n"): - log = log + f"\r\n[{level}]{'['+origin+']' if origin else ''}[{time}] {line}" + log = ( + log + f"\r\n[{level}]{'['+origin+']' if origin else ''}[{time}] {line}" + ) print( f"[{level}]{'['+origin+']' if origin else ''}[{time}] {line}", file=stream, diff --git a/server.py b/server.py index 35945fb..98babd3 100755 --- a/server.py +++ b/server.py @@ -15,7 +15,13 @@ class Globals: ... TimeoutErrors = (TimeoutError, asyncio.exceptions.TimeoutError) -DisconnectErrors = (ConnectionResetError, BrokenPipeError, IndexError, UnicodeDecodeError, *TimeoutErrors) +DisconnectErrors = ( + ConnectionResetError, + BrokenPipeError, + IndexError, + UnicodeDecodeError, + *TimeoutErrors, +) G = Globals() G.uniqueClients = 0 G.servers = {} @@ -593,6 +599,7 @@ async def connectServer(hostname: str, port: int): log(line, "ERROR") raise FailedLinkError + async def runServer(address: str, port: int): global G server = await asyncio.start_server(handleClient, address, port)