Fix core types not being printed because of missing __slots__

This commit is contained in:
Dan 2019-03-28 14:01:16 +01:00
parent b4da453ef3
commit e05a5ebf6f
5 changed files with 20 additions and 0 deletions

View File

@ -26,6 +26,10 @@ from .primitives import Int, Long
class FutureSalt(Object):
ID = 0x0949d9dc
__slots__ = ["valid_since", "valid_until", "salt"]
QUALNAME = "FutureSalt"
def __init__(self, valid_since: int or datetime, valid_until: int or datetime, salt: int):
self.valid_since = valid_since
self.valid_until = valid_until

View File

@ -27,6 +27,10 @@ from .primitives import Int, Long
class FutureSalts(Object):
ID = 0xae500895
__slots__ = ["req_msg_id", "now", "salts"]
QUALNAME = "FutureSalts"
def __init__(self, req_msg_id: int, now: int or datetime, salts: list):
self.req_msg_id = req_msg_id
self.now = now

View File

@ -26,6 +26,10 @@ from .primitives import Int, Bytes
class GzipPacked(Object):
ID = 0x3072cfa1
__slots__ = ["packed_data"]
QUALNAME = "GzipPacked"
def __init__(self, packed_data: Object):
self.packed_data = packed_data

View File

@ -25,6 +25,10 @@ from .primitives import Int, Long
class Message(Object):
ID = 0x5bb8e511 # hex(crc32(b"message msg_id:long seqno:int bytes:int body:Object = Message"))
__slots__ = ["msg_id", "seq_no", "length", "body"]
QUALNAME = "Message"
def __init__(self, body: Object, msg_id: int, seq_no: int, length: int):
self.msg_id = msg_id
self.seq_no = seq_no

View File

@ -26,6 +26,10 @@ from .primitives import Int
class MsgContainer(Object):
ID = 0x73f1f8dc
__slots__ = ["messages"]
QUALNAME = "MsgContainer"
def __init__(self, messages: list):
self.messages = messages