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