Skip to content

Commit b6810ce

Browse files
committed
Minor sweeks
1 parent 6012376 commit b6810ce

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

server.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,20 @@
2727

2828

2929
class UserDict(TypedDict):
30-
"""Typed dictionary representing a user."""
30+
"""Typed dictionary representing a user.
31+
32+
Keys in this dictionary cannot be renamed, as clients rely on them.
33+
"""
3134

3235
id: int
3336
connection_type: str | None
3437

3538

3639
class Message(TypedDict):
37-
"""Type hints for protocol messages."""
40+
"""Type hints for protocol messages.
41+
42+
Keys in this dictionary cannot be renamed, as clients rely on them.
43+
"""
3844

3945
type: str
4046

@@ -46,7 +52,7 @@ def __init__(self, key: str, serverState: "ServerState | None" = None) -> None:
4652
"""Constructor
4753
4854
:param key: Unique identifier of this channel.
49-
:param serverSstate: Server state, defaults to None
55+
:param serverState: Server state, defaults to None
5056
"""
5157
self.clients: OrderedDict[int, User] = OrderedDict()
5258
self.key = key
@@ -380,8 +386,8 @@ def main() -> Deferred[None]: # pragma: no cover
380386
)
381387
# Initialise the server state machine
382388
state = ServerState()
383-
if os.path.exists(config["motd"]):
384-
with open(config["motd"], encoding="utf-8") as fp:
389+
if os.path.isfile(config["motd"]):
390+
with open(config["motd"], "r", encoding="utf-8") as fp:
385391
state.motd = fp.read().strip()
386392
else:
387393
state.motd = None

0 commit comments

Comments
 (0)