From b7f1a824a69e8e871507da4b8d88059a462b81d3 Mon Sep 17 00:00:00 2001 From: Jiri Kalvoda <jirikalvoda@kam.mff.cuni.cz> Date: Fri, 19 Jul 2024 13:07:35 +0200 Subject: [PATCH] Code cleanup --- prog/communication.py | 12 ++++++------ prog/gtfs.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/prog/communication.py b/prog/communication.py index 6ee46eb..bfcb63b 100644 --- a/prog/communication.py +++ b/prog/communication.py @@ -31,7 +31,7 @@ async def connect_stdin_stdout(): writer = asyncio.StreamWriter(w_transport, w_protocol, reader, loop) return reader, writer -class Socket(): +class Socket: async def write(): raise NotImplementedError async def read(): @@ -82,7 +82,7 @@ class UnixSocket(AsincioStreamSocket): -class MsgParser(): +class MsgParser: def __init__(self, socket): self.socket = socket self.buffer = [] @@ -116,11 +116,11 @@ def msg(head, data): assert head return int_to_str_len(len(head), 5).encode('utf-8') + int_to_str_len(len(data), 12).encode('utf-8') + head + data -class WaitingQuestion(): +class WaitingQuestion: def __init__(self, id): self.future = asyncio.get_running_loop().create_future() -class Client(): +class Client: def __init__(self, socket): self.socket = socket self.msg_parser = MsgParser(socket) @@ -151,7 +151,7 @@ class Client(): # eprint(asyncio.all_tasks()) return await q.future -class Server(): +class Server: def __init__(self, socket, callback): self.socket = socket self.msg_parser = MsgParser(socket) @@ -172,7 +172,7 @@ class Server(): def cbor_dump(x): return cbor2.dumps(x, timezone=local_timezone) -class FuncCaller(): +class FuncCaller: def __init__(self, socket=None, is_server=False): if socket == None: is_server = True diff --git a/prog/gtfs.py b/prog/gtfs.py index 595ae30..30c512b 100644 --- a/prog/gtfs.py +++ b/prog/gtfs.py @@ -47,7 +47,7 @@ class TripStop: shape_dist_traveled: float -class GtfsDay(): +class GtfsDay: def __init__(self, date, data_getter): self.date = date self.data_getter = data_getter -- GitLab