Example #1
0
class msg_alert(MsgSerializable):
    command = b"alert"

    def __init__(self, protover=PROTO_VERSION):
        super(msg_alert, self).__init__(protover)
        self.alert = CAlert()

    @classmethod
    def msg_deser(cls, f, protover=PROTO_VERSION):
        c = cls()
        c.alert = CAlert.stream_deserialize(f)
        return c

    def msg_ser(self, f):
        self.alert.stream_serialize(f)

    def __repr__(self):
        return "msg_alert(alert=%s)" % (repr(self.alert), )
Example #2
0
class msg_alert(MsgSerializable):
    command = b"alert"

    def __init__(self, protover=PROTO_VERSION):
        super(msg_alert, self).__init__(protover)
        self.alert = CAlert()

    @classmethod
    def msg_deser(cls, f, protover=PROTO_VERSION):
        c = cls()
        c.alert = CAlert.stream_deserialize(f)
        return c

    def msg_ser(self, f):
        self.alert.stream_serialize(f)

    def __repr__(self):
        return "msg_alert(alert=%s)" % (repr(self.alert),)
Example #3
0
    def test_serialization(self):
        alert = CAlert()
        alert.setCancel = [1, 2, 3]
        alert.strComment = b"Comment"
        stream = _BytesIO()

        alert.stream_serialize(stream)
        serialized = _BytesIO(stream.getvalue())

        deserialized = CAlert.stream_deserialize(serialized)
        self.assertEqual(deserialized, alert)
Example #4
0
 def msg_deser(cls, f, protover=PROTO_VERSION):
     c = cls()
     c.alert = CAlert.stream_deserialize(f)
     return c
Example #5
0
 def __init__(self, protover=PROTO_VERSION):
     super(msg_alert, self).__init__(protover)
     self.alert = CAlert()
Example #6
0
 def msg_deser(cls, f, protover=PROTO_VERSION):
     c = cls()
     c.alert = CAlert.stream_deserialize(f)
     return c
Example #7
0
 def __init__(self, protover=PROTO_VERSION):
     super(msg_alert, self).__init__(protover)
     self.alert = CAlert()