27
27
28
28
29
29
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
+ """
31
34
32
35
id : int
33
36
connection_type : str | None
34
37
35
38
36
39
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
+ """
38
44
39
45
type : str
40
46
@@ -46,7 +52,7 @@ def __init__(self, key: str, serverState: "ServerState | None" = None) -> None:
46
52
"""Constructor
47
53
48
54
:param key: Unique identifier of this channel.
49
- :param serverSstate : Server state, defaults to None
55
+ :param serverState : Server state, defaults to None
50
56
"""
51
57
self .clients : OrderedDict [int , User ] = OrderedDict ()
52
58
self .key = key
@@ -380,8 +386,8 @@ def main() -> Deferred[None]: # pragma: no cover
380
386
)
381
387
# Initialise the server state machine
382
388
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 :
385
391
state .motd = fp .read ().strip ()
386
392
else :
387
393
state .motd = None
0 commit comments