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


Python field.FieldSet类代码示例

本文整理汇总了Python中hachoir.field.FieldSet的典型用法代码示例。如果您正苦于以下问题:Python FieldSet类的具体用法?Python FieldSet怎么用?Python FieldSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __init__

 def __init__(self, *args, **kw):
     FieldSet.__init__(self, *args, **kw)
     value = 0
     for field in self:
         value <<= 15
         value += (field.value & 0x7fff)
     self.createValue = lambda: value
开发者ID:JackDandy,项目名称:SickGear,代码行数:7,代码来源:iptc.py

示例2: __init__

 def __init__(self, parent, name, toc, description, size=None):
     FieldSet.__init__(self, parent, name, description, size=size)
     self.toc = toc
     if self["format/byte_big_endian"].value:
         self.endian = BIG_ENDIAN
     else:
         self.endian = LITTLE_ENDIAN
开发者ID:JackDandy,项目名称:SickGear,代码行数:7,代码来源:pcf.py

示例3: __init__

 def __init__(self, *args, **kw):
     FieldSet.__init__(self, *args, **kw)
     if not self._size:
         frame_size = self.getFrameSize()
         if not frame_size:
             raise ParserError("MPEG audio: Invalid frame %s" % self.path)
         self._size = min(frame_size * 8, self.parent.size - self.address)
开发者ID:JackDandy,项目名称:SickGear,代码行数:7,代码来源:mpeg_audio.py

示例4: __init__

    def __init__(self, parent, ids):
        FieldSet.__init__(self, parent, "?[]")

        # Set name
        id = self['id'].value
        self.val = ids.get(id)
        if not self.val:
            if id == 0xBF:
                self.val = 'CRC-32[]', Binary
            elif id == 0xEC:
                self.val = 'Void[]', Binary
            elif id == 0x1B538667:
                self.val = 'SignatureSlot[]', signature
            else:
                self.val = 'Unknown[]', Binary
        self._name = self.val[0]

        # Compute size
        size = self['size']
        if size.value is not None:
            self._size = size.address + size.size + size.value * 8
        elif self._parent._parent:
            raise ParserError("Unknown length (only allowed for the last Level 0 element)")
        elif self._parent._size is not None:
            self._size = self._parent._size - self.address
开发者ID:JackDandy,项目名称:SickGear,代码行数:25,代码来源:mkv.py

示例5: __init__

 def __init__(self, parent, name, num_digests, digest_desc=None, desc=None):
     FieldSet.__init__(self, parent, name, desc)
     self.num_digests = num_digests
     if digest_desc is None:
         self.digest_desc = ['stream %d' % i for i in xrange(num_digests)]
     else:
         self.digest_desc = digest_desc
开发者ID:JackDandy,项目名称:SickGear,代码行数:7,代码来源:sevenzip.py

示例6: __init__

 def __init__(self, *args, **kw):
     FieldSet.__init__(self, *args, **kw)
     key = self["type"].value & 31
     if self['class'].value == 0:
         # universal object
         if key in self.TYPE_INFO:
             self._name, self._handler, self._description, create_desc = self.TYPE_INFO[key]
             if create_desc:
                 self.createDescription = lambda: "%s: %s" % (self.TYPE_INFO[key][2], create_desc(self))
                 self._description = None
         elif key == 31:
             raise ParserError("ASN.1 Object: tag bigger than 30 are not supported")
         else:
             self._handler = None
     elif self['form'].value:
         # constructed: treat as sequence
         self._name = 'seq[]'
         self._handler = readSequence
         self._description = 'constructed object type %i' % key
     else:
         # primitive, context/private
         self._name = 'raw[]'
         self._handler = readASCIIString
         self._description = '%s object type %i' % (self['class'].display, key)
     field = self["size"]
     self._size = field.address + field.size + field.value * 8
开发者ID:JackDandy,项目名称:SickGear,代码行数:26,代码来源:asn1.py

示例7: __init__

 def __init__(self, parent, name, desc=None):
     FieldSet.__init__(self, parent, name, desc)
     pos = self.stream.searchBytesLength(CrossReferenceTable.MAGIC, False)
     if pos is None:
         raise ParserError("Can't find xref starting at %u" %
                           (self.absolute_address // 8))
     self._size = 8 * pos - self.absolute_address
开发者ID:JackDandy,项目名称:SickGear,代码行数:7,代码来源:pdf.py

示例8: __init__

 def __init__(self, *args):
     FieldSet.__init__(self, *args)
     code = self["code"].value
     if code in self.ext_code:
         self._name, self.parser, self._description = self.ext_code[code]
     else:
         self.parser = defaultExtensionParser
开发者ID:JackDandy,项目名称:SickGear,代码行数:7,代码来源:gif.py

示例9: __init__

 def __init__(self, parent, name, **kw):
     FieldSet.__init__(self, parent, name, **kw)
     code = self["bytecode"].value
     if code not in self.bytecode_info:
         raise ParserError('Unknown bytecode %r at position %s'
                           % (code, self.absolute_address // 8))
     self.code_info = self.bytecode_info[code]
     if not name:
         self._name = self.code_info[0]
     if code == "l":
         self.createValue = self.createValueLong
     elif code in ("i", "I", "f", "g"):
         self.createValue = lambda: self["value"].value
     elif code == "T":
         self.createValue = lambda: True
     elif code == "F":
         self.createValue = lambda: False
     elif code in ("x", "y"):
         self.createValue = self.createValueComplex
     elif code in ("s", "t", "u"):
         self.createValue = self.createValueString
         self.createDisplay = self.createDisplayString
         if code == 't':
             if not hasattr(self.root, 'string_table'):
                 self.root.string_table = []
             self.root.string_table.append(self)
     elif code == 'R':
         if hasattr(self.root, 'string_table'):
             self.createValue = self.createValueStringRef
开发者ID:JackDandy,项目名称:SickGear,代码行数:29,代码来源:python.py

示例10: __init__

 def __init__(self, *args, **kw):
     FieldSet.__init__(self, *args, **kw)
     self._size = (11 + self["size"].value) * 8
     tag = self["tag"].value
     if tag in self.tag_info:
         self._name, self.parser, self._description = self.tag_info[tag]
     else:
         self.parser = None
开发者ID:JackDandy,项目名称:SickGear,代码行数:8,代码来源:flv.py

示例11: __init__

 def __init__(self, *args):
     FieldSet.__init__(self, *args)
     self._size = (8 + alignValue(self["size"].value, 2)) * 8
     tag = self["type"].value
     if tag in self.TAG_INFO:
         self._name, self._description, self._parser = self.TAG_INFO[tag]
     else:
         self._parser = None
开发者ID:JackDandy,项目名称:SickGear,代码行数:8,代码来源:aiff.py

示例12: __init__

 def __init__(self, *args, **kw):
     FieldSet.__init__(self, *args, **kw)
     try:
         self._name, self.handler, self._description = self.TAG_INFO[self["tag"].value]
     except KeyError:
         self.handler = None
     size = self["size"]
     self._size = size.address + size.size + alignValue(size.value, 2) * 8
开发者ID:JackDandy,项目名称:SickGear,代码行数:8,代码来源:photoshop_metadata.py

示例13: __init__

 def __init__(self, *args, **kw):
     FieldSet.__init__(self, *args, **kw)
     self._size = 32 + self["metadata_length"].value * 8
     try:
         key = self["block_type"].value
         self._name, self._description, self.handler = self.BLOCK_TYPES[key]
     except KeyError:
         self.handler = None
开发者ID:JackDandy,项目名称:SickGear,代码行数:8,代码来源:flac.py

示例14: __init__

 def __init__(self, *args, **kwargs):
     if 'prev_command' in kwargs:
         self.prev_command = kwargs['prev_command']
         del kwargs['prev_command']
     else:
         self.prev_command = None
     self.command = None
     FieldSet.__init__(self, *args, **kwargs)
开发者ID:JackDandy,项目名称:SickGear,代码行数:8,代码来源:midi.py

示例15: __init__

 def __init__(self, parent, name, entry, size=None):
     FieldSet.__init__(self, parent, name, size=entry["size"].value * 8)
     self.entry = entry
     res_type = self.getResType()
     if res_type in RESOURCE_TYPE:
         self._name, description, self._parser = RESOURCE_TYPE[res_type]
     else:
         self._parser = None
开发者ID:JackDandy,项目名称:SickGear,代码行数:8,代码来源:exe_res.py


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