Fix comment too long

This commit is contained in:
ChillerDragon 2023-04-02 20:03:50 +02:00
parent 044e17b6e6
commit 760d8bce1f
2 changed files with 4 additions and 4 deletions

View file

@ -296,9 +296,9 @@ def generate_msg(msg: NetMessageJson, game: Literal['game', 'system']) -> None:
# TODO: unpacker should not crash on missing optional fields
# check how tw code does it and be smart here
if member['type']['inner']['kind'] == 'string': # TODO: sanitize cc
unpacker = 'str() # TODO: warning this can fail because it is an optional field'
unpacker = 'str() # TODO: this can fail for optionals'
elif member['type']['inner']['kind'] in ('int32', 'tick'):
unpacker = 'int() # TODO: warning this can fail because it is an optional field'
unpacker = 'int() # TODO: this can fail for optionals'
else:
raise ValueError(f"Error: unknown type {member['type']}")
name = name_to_snake(member["name"])

View file

@ -26,8 +26,8 @@ class MsgInfo(PrettyPrint):
def unpack(self, data: bytes) -> bool:
unpacker = Unpacker(data)
self.version = unpacker.get_str()
self.password = unpacker.get_str() # TODO: warning this can fail because it is an optional field
self.client_version = unpacker.get_int() # TODO: warning this can fail because it is an optional field
self.password = unpacker.get_str() # TODO: this can fail for optionals
self.client_version = unpacker.get_int() # TODO: this can fail for optionals
return True
def pack(self) -> bytes: