Ejemplo n.º 1
0
    def __init__(self, info, prefmt=''):
        names, formats = zip(*info)

        # Remove empty names
        self._names = [n for n in names if n]

        Struct.__init__(self, prefmt + ''.join(f for f in formats if f))
Ejemplo n.º 2
0
    def __init__(self, info, prefmt=''):
        names, formats = zip(*info)

        # Remove empty names
        self._names = [n for n in names if n]

        Struct.__init__(self, prefmt + ''.join(f for f in formats if f))
Ejemplo n.º 3
0
    def __init__(self, tag, fields):
        self.tag = tag
        self.fields = fields

        fmt = '<'
        for f in self.fields:
            fmt += f['fmt']
        Struct.__init__(self, fmt)

        self.clean()
        self.header()
Ejemplo n.º 4
0
 def __init__(self, info, prefmt='', tuple_name=None):
     if tuple_name is None:
         tuple_name = 'NamedStruct'
     names, fmts = zip(*info)
     self.converters = {}
     conv_off = 0
     for ind, i in enumerate(info):
         if len(i) > 2:
             self.converters[ind - conv_off] = i[-1]
         elif not i[0]:  # Skip items with no name
             conv_off += 1
     self._tuple = namedtuple(tuple_name, ' '.join(n for n in names if n))
     Struct.__init__(self, prefmt + ''.join(f for f in fmts if f))
Ejemplo n.º 5
0
 def __init__(self, fmt):
     f = ''
     for l in fmt.splitlines():
         try:
             i = l.index('#')
             if i >= 0:
                 l = l[:i]
         except ValueError:
             pass
         l = l.strip()
         if l:
             f = f + l
     _Struct.__init__(self, f)
Ejemplo n.º 6
0
 def __init__(self, info, prefmt='', tuple_name=None):
     if tuple_name is None:
         tuple_name = 'NamedStruct'
     names, fmts = zip(*info)
     self.converters = {}
     conv_off = 0
     for ind, i in enumerate(info):
         if len(i) > 2:
             self.converters[ind - conv_off] = i[-1]
         elif not i[0]:  # Skip items with no name
             conv_off += 1
     self._tuple = namedtuple(tuple_name, ' '.join(n for n in names if n))
     Struct.__init__(self, prefmt + ''.join(f for f in fmts if f))
Ejemplo n.º 7
0
    def __init__(self, tag, fields):
        self.tag = tag
        self.fields = fields
        #        print (tag)
        #        print (fields)

        fmt = '<'
        for f in self.fields:
            fmt += f['fmt']
        #        print(fmt)
        Struct.__init__(self, fmt)

        self.clean()
        self.header()
Ejemplo n.º 8
0
 def __init__(self, fmt):
     Struct.__init__(self, "<" + fmt)
Ejemplo n.º 9
0
 def __init__(self, fmt, fobj):
     self._fobj = fobj
     Struct.__init__(self, fmt)
Ejemplo n.º 10
0
 def __init__(self, info, prefmt='', tuple_name=None):
     if tuple_name is None:
         tuple_name = 'NamedStruct'
     names, fmts = zip(*info)
     self._tuple = namedtuple(tuple_name, ' '.join(n for n in names if n))
     Struct.__init__(self, prefmt + ''.join(fmts))
Ejemplo n.º 11
0
 def __init__(self, info, prefmt='', tuple_name=None):
     if tuple_name is None:
         tuple_name = 'NamedStruct'
     names, fmts = zip(*info)
     self._tuple = namedtuple(tuple_name, ' '.join(n for n in names if n))
     Struct.__init__(self, prefmt + ''.join(fmts))
Ejemplo n.º 12
0
 def __init__(self, **kw):
     Struct.__init__(self, "<BBBBLHHB")
     OpenStruct.__init__(self, **kw)
     self.bDescriptorSubtype = 0x0F
     self.bDescriptorType = CS_INTERFACE
Ejemplo n.º 13
0
 def __init__(self):
     Struct.__init__(self, "!BBHHH")
Ejemplo n.º 14
0
 def __init__(self, fmt):
     Struct.__init__(self, "<" + fmt)
Ejemplo n.º 15
0
 def __init__(self):
     Struct.__init__(self, "!BBHHH")
Ejemplo n.º 16
0
 def __init__(self, fmt, fobj):
     self._fobj = fobj
     Struct.__init__(self, fmt)
Ejemplo n.º 17
0
 def __init__(self,**kw):
     Struct.__init__(self, "<BBBBLHHB")
     OpenStruct.__init__(self, **kw)
     self.bDescriptorSubtype = 0x0F
     self.bDescriptorType    = CS_INTERFACE
Ejemplo n.º 18
0
 def __init__(self, fmt, fields):
     self._ntuple = namedtuple(type(self).__name__, fields)
     super(NamedStruct, self).__init__(fmt)
     Struct.__init__(self, fmt)