Beispiel #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))
Beispiel #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))
Beispiel #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()
Beispiel #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))
 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)
Beispiel #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))
Beispiel #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()
Beispiel #8
0
 def __init__(self, fmt):
     Struct.__init__(self, "<" + fmt)
Beispiel #9
0
 def __init__(self, fmt, fobj):
     self._fobj = fobj
     Struct.__init__(self, fmt)
Beispiel #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))
Beispiel #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))
 def __init__(self, **kw):
     Struct.__init__(self, "<BBBBLHHB")
     OpenStruct.__init__(self, **kw)
     self.bDescriptorSubtype = 0x0F
     self.bDescriptorType = CS_INTERFACE
Beispiel #13
0
 def __init__(self):
     Struct.__init__(self, "!BBHHH")
Beispiel #14
0
 def __init__(self, fmt):
     Struct.__init__(self, "<" + fmt)
Beispiel #15
0
 def __init__(self):
     Struct.__init__(self, "!BBHHH")
Beispiel #16
0
 def __init__(self, fmt, fobj):
     self._fobj = fobj
     Struct.__init__(self, fmt)
Beispiel #17
0
 def __init__(self,**kw):
     Struct.__init__(self, "<BBBBLHHB")
     OpenStruct.__init__(self, **kw)
     self.bDescriptorSubtype = 0x0F
     self.bDescriptorType    = CS_INTERFACE
Beispiel #18
0
 def __init__(self, fmt, fields):
     self._ntuple = namedtuple(type(self).__name__, fields)
     super(NamedStruct, self).__init__(fmt)
     Struct.__init__(self, fmt)