當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。