本文整理汇总了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)