Do not instantiate unused unpacker

This commit is contained in:
ChillerDragon 2023-04-02 20:00:42 +02:00
parent df3fcb9b17
commit d6d8abc091
15 changed files with 2 additions and 15 deletions

View file

@ -265,7 +265,8 @@ def generate_msg(msg: NetMessageJson, game: Literal['game', 'system']) -> None:
out_file.write(' # has to be the first byte of the message payload\n')
out_file.write(' # NOT the chunk header and NOT the message id\n')
out_file.write(' def unpack(self, data: bytes) -> bool:\n')
out_file.write(' unpacker = Unpacker(data)\n')
if len(msg['members']) > 0:
out_file.write(' unpacker = Unpacker(data)\n')
for member in msg['members']:
# {'name': ['message'], 'type': {'kind': 'string', 'disallow_cc': False}}
unpacker = 'int()'

View file

@ -18,7 +18,6 @@ class MsgClKill(PrettyPrint):
# has to be the first byte of the message payload
# NOT the chunk header and NOT the message id
def unpack(self, data: bytes) -> bool:
unpacker = Unpacker(data)
return True
def pack(self) -> bytes:

View file

@ -18,7 +18,6 @@ class MsgClReadyChange(PrettyPrint):
# has to be the first byte of the message payload
# NOT the chunk header and NOT the message id
def unpack(self, data: bytes) -> bool:
unpacker = Unpacker(data)
return True
def pack(self) -> bytes:

View file

@ -18,7 +18,6 @@ class MsgSvGameMsg(PrettyPrint):
# has to be the first byte of the message payload
# NOT the chunk header and NOT the message id
def unpack(self, data: bytes) -> bool:
unpacker = Unpacker(data)
return True
def pack(self) -> bytes:

View file

@ -18,7 +18,6 @@ class MsgSvReadyToEnter(PrettyPrint):
# has to be the first byte of the message payload
# NOT the chunk header and NOT the message id
def unpack(self, data: bytes) -> bool:
unpacker = Unpacker(data)
return True
def pack(self) -> bytes:

View file

@ -18,7 +18,6 @@ class MsgSvVoteClearOptions(PrettyPrint):
# has to be the first byte of the message payload
# NOT the chunk header and NOT the message id
def unpack(self, data: bytes) -> bool:
unpacker = Unpacker(data)
return True
def pack(self) -> bytes:

View file

@ -18,7 +18,6 @@ class MsgSvVoteOptionListAdd(PrettyPrint):
# has to be the first byte of the message payload
# NOT the chunk header and NOT the message id
def unpack(self, data: bytes) -> bool:
unpacker = Unpacker(data)
return True
def pack(self) -> bytes:

View file

@ -18,7 +18,6 @@ class MsgConReady(PrettyPrint):
# has to be the first byte of the message payload
# NOT the chunk header and NOT the message id
def unpack(self, data: bytes) -> bool:
unpacker = Unpacker(data)
return True
def pack(self) -> bytes:

View file

@ -18,7 +18,6 @@ class MsgEnterGame(PrettyPrint):
# has to be the first byte of the message payload
# NOT the chunk header and NOT the message id
def unpack(self, data: bytes) -> bool:
unpacker = Unpacker(data)
return True
def pack(self) -> bytes:

View file

@ -18,7 +18,6 @@ class MsgPing(PrettyPrint):
# has to be the first byte of the message payload
# NOT the chunk header and NOT the message id
def unpack(self, data: bytes) -> bool:
unpacker = Unpacker(data)
return True
def pack(self) -> bytes:

View file

@ -18,7 +18,6 @@ class MsgPingReply(PrettyPrint):
# has to be the first byte of the message payload
# NOT the chunk header and NOT the message id
def unpack(self, data: bytes) -> bool:
unpacker = Unpacker(data)
return True
def pack(self) -> bytes:

View file

@ -18,7 +18,6 @@ class MsgRconAuthOff(PrettyPrint):
# has to be the first byte of the message payload
# NOT the chunk header and NOT the message id
def unpack(self, data: bytes) -> bool:
unpacker = Unpacker(data)
return True
def pack(self) -> bytes:

View file

@ -18,7 +18,6 @@ class MsgRconAuthOn(PrettyPrint):
# has to be the first byte of the message payload
# NOT the chunk header and NOT the message id
def unpack(self, data: bytes) -> bool:
unpacker = Unpacker(data)
return True
def pack(self) -> bytes:

View file

@ -18,7 +18,6 @@ class MsgReady(PrettyPrint):
# has to be the first byte of the message payload
# NOT the chunk header and NOT the message id
def unpack(self, data: bytes) -> bool:
unpacker = Unpacker(data)
return True
def pack(self) -> bytes:

View file

@ -18,7 +18,6 @@ class MsgRequestMapData(PrettyPrint):
# has to be the first byte of the message payload
# NOT the chunk header and NOT the message id
def unpack(self, data: bytes) -> bool:
unpacker = Unpacker(data)
return True
def pack(self) -> bytes: