本文整理匯總了Python中kaitaistruct.KaitaiStruct方法的典型用法代碼示例。如果您正苦於以下問題:Python kaitaistruct.KaitaiStruct方法的具體用法?Python kaitaistruct.KaitaiStruct怎麽用?Python kaitaistruct.KaitaiStruct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類kaitaistruct
的用法示例。
在下文中一共展示了kaitaistruct.KaitaiStruct方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: import kaitaistruct [as 別名]
# 或者: from kaitaistruct import KaitaiStruct [as 別名]
def __init__(self, _io, _parent=None, _root=None):
self._io = _io
self._parent = _parent
self._root = _root if _root else self
len_and_kind = self._io.read_u8le()
self.length = len_and_kind & 0x0fffffffffffffff
self.kind = (len_and_kind & 0xf000000000000000) >> 60
self.owning_obj_id = self._io.read_u8le()
self.refcnt = self._io.read_u4le()
# class ExtentKey(KaitaiStruct):
# __slots__ = ['_io', '_parent', '_root', 'paddr']
# def __init__(self, _io, _parent=None, _root=None):
# self._io = _io
# self._parent = _parent
# self._root = _root if _root else self
# self.paddr = self._root.RefBlock(self._io, self, self._root)
示例2: allocationinfofile_blocks
# 需要導入模塊: import kaitaistruct [as 別名]
# 或者: from kaitaistruct import KaitaiStruct [as 別名]
def allocationinfofile_blocks(self):
if hasattr(self, '_m_allocationinfofile_blocks'):
return self._m_allocationinfofile_blocks #if hasattr(self, '_m_allocationinfofile_blocks') else None
_pos = self._io.pos()
self._io.seek(self.ofs_entries)
self._m_allocationinfofile_blocks = [None] * (self.num_entries)
for i in range(self.num_entries):
self._m_allocationinfofile_blocks[i] = self._io.read_u8le()
self._io.seek(_pos)
return self._m_allocationinfofile_blocks #if hasattr(self, '_m_allocationinfofile_blocks') else None
# class HistoryKey(KaitaiStruct):
# __slots__ = ['_io', '_parent', '_root', 'xid', 'block_num']
# def __init__(self, _io, _parent=None, _root=None):
# self._io = _io
# self._parent = _parent
# self._root = _root if _root else self
# self.xid = self._io.read_u8le()
# self.block_num = self._root.RefBlock(self._io, self, self._root)