当前位置: 首页>>代码示例>>Python>>正文


Python Bits.__init__方法代码示例

本文整理汇总了Python中hachoir_core.field.Bits.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Bits.__init__方法的具体用法?Python Bits.__init__怎么用?Python Bits.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hachoir_core.field.Bits的用法示例。


在下文中一共展示了Bits.__init__方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from hachoir_core.field import Bits [as 别名]
# 或者: from hachoir_core.field.Bits import __init__ [as 别名]
 def __init__(self, parent, name, description=None):
     Bits.__init__(self, parent, name, 8, description)
     stream = parent.stream
     addr = self.absolute_address
     value = 0
     while True:
         bits = stream.readBits(addr, 8, parent.endian)
         value = (value << 7) + (bits & 127)
         if not (bits & 128):
             break
         addr += 8
         self._size += 8
         if 32 < self._size:
             raise ParserError("Integer size is bigger than 32-bit")
     self.createValue = lambda: value
开发者ID:NagBhushanMDN,项目名称:raspberry_pwn,代码行数:17,代码来源:midi.py

示例2: __init__

# 需要导入模块: from hachoir_core.field import Bits [as 别名]
# 或者: from hachoir_core.field.Bits import __init__ [as 别名]
 def __init__(self, parent, name, description=None):
     Bits.__init__(self, parent, name, 8, description)
     stream = self._parent.stream
     addr = self.absolute_address
     size = 8
     value = 0
     byte = stream.readBits(addr, 8, BIG_ENDIAN)
     value = byte & 127
     while 128 <= byte:
         addr += 8
         size += 8
         if 64 < size:
             # Arbitrary limit to catch errors
             raise ParserError("ASN.1: Object identifier is limited 64 bits")
         byte = stream.readBits(addr, 8, BIG_ENDIAN)
         value = (value << 7) + (byte & 127)
     self._size = size
     self.createValue = lambda: value
开发者ID:feld,项目名称:SickRage,代码行数:20,代码来源:asn1.py

示例3: __init__

# 需要导入模块: from hachoir_core.field import Bits [as 别名]
# 或者: from hachoir_core.field.Bits import __init__ [as 别名]
 def __init__(self, parent, name, signed=False, nbits=30, description=None):
     Bits.__init__(self, parent, name, 8, description)
     stream = self._parent.stream
     addr = self.absolute_address
     size = 0
     value = 0
     mult = 1
     while True:
         byte = stream.readBits(addr+size, 8, LITTLE_ENDIAN)
         value += mult * (byte & 0x7f)
         size += 8
         mult <<= 7
         if byte < 128:
             break
     self._size = size
     if signed and (1 << (nbits-1)) <= value:
         value -= (1 << nbits)
     self.createValue = lambda: value
开发者ID:AdriSol,项目名称:metagoofil,代码行数:20,代码来源:action_script.py

示例4: __init__

# 需要导入模块: from hachoir_core.field import Bits [as 别名]
# 或者: from hachoir_core.field.Bits import __init__ [as 别名]
 def __init__(self, parent, name, size, description=None):
     Bits.__init__(self, parent, name, size, description)
开发者ID:Apocrathia,项目名称:SickGear,代码行数:4,代码来源:timestamp.py

示例5: __init__

# 需要导入模块: from hachoir_core.field import Bits [as 别名]
# 或者: from hachoir_core.field.Bits import __init__ [as 别名]
 def __init__(self, parent, name):
     Bits.__init__(self, parent, name, 4)
开发者ID:NagBhushanMDN,项目名称:raspberry_pwn,代码行数:4,代码来源:bmp.py

示例6: __init__

# 需要导入模块: from hachoir_core.field import Bits [as 别名]
# 或者: from hachoir_core.field.Bits import __init__ [as 别名]
 def __init__(self, parent, name, size):
     Bits.__init__(self, parent, name, size)
     self.bias = 2 ** (size-1) - 1
开发者ID:1EDTHEMAN1,项目名称:raspberry_pwn,代码行数:5,代码来源:float.py

示例7: __init__

# 需要导入模块: from hachoir_core.field import Bits [as 别名]
# 或者: from hachoir_core.field.Bits import __init__ [as 别名]
 def __init__(self, parent, name, signed, size, description=None):
     if not (8 <= size <= 256):
         raise FieldError("Invalid integer size (%s): have to be in 8..256" % size)
     Bits.__init__(self, parent, name, size, description)
     self.signed = signed
开发者ID:1EDTHEMAN1,项目名称:raspberry_pwn,代码行数:7,代码来源:integer.py

示例8: __init__

# 需要导入模块: from hachoir_core.field import Bits [as 别名]
# 或者: from hachoir_core.field.Bits import __init__ [as 别名]
 def __init__(self, parent, name, signed, endian, size, description=None):
     if not (8 <= size <= 16384):
         raise FieldError("Invalid integer size (%s): have to be in 8..16384" % size)
     Bits.__init__(self, parent, name, size, description)
     self.signed = signed
     self.endian = endian or self._parent.endian
开发者ID:Woerd88,项目名称:script.module.hachoir,代码行数:8,代码来源:integer.py

示例9: __init__

# 需要导入模块: from hachoir_core.field import Bits [as 别名]
# 或者: from hachoir_core.field.Bits import __init__ [as 别名]
 def __init__(self, parent, name, nbits, description="Padding", pattern=None):
     Bits.__init__(self, parent, name, nbits, description)
     self.pattern = pattern
     self._display_pattern = self.checkPattern()
开发者ID:BaldyBadgersRunningRoundMyBrain,项目名称:raspberry_pwn,代码行数:6,代码来源:padding.py


注:本文中的hachoir_core.field.Bits.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。