def __init__(self, record_type=None, record_name=None, data=None):
self._message_begin = self._message_end = False
self._type = self._name = self._data = ''
if not (record_type is None and record_name is None):
self.type = record_type if record_type is not None else 'unknown'
if record_name is not None:
self.name = record_name
if data is not None:
self.data = data
elif data is not None:
if isinstance(data, (bytearray, str)):
data = io.BytesIO(data)
if isinstance(data, io.IOBase):
self._read(data)
else:
raise TypeError("invalid data argument type")
评论列表
文章目录