コード例 #1
0
ファイル: tools.py プロジェクト: scollis/MetPy
    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))
コード例 #2
0
ファイル: tools.py プロジェクト: wadere/MetPy
    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))
コード例 #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()
コード例 #4
0
ファイル: tools.py プロジェクト: scollis/MetPy
 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))
コード例 #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)
コード例 #6
0
ファイル: tools.py プロジェクト: wadere/MetPy
 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))
コード例 #7
0
ファイル: serializer.py プロジェクト: valmac/wire_tests
    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()
コード例 #8
0
ファイル: util.py プロジェクト: terhorst/bamsort
 def __init__(self, fmt):
     Struct.__init__(self, "<" + fmt)
コード例 #9
0
ファイル: nexrad.py プロジェクト: rayg-ssec/MetPy
 def __init__(self, fmt, fobj):
     self._fobj = fobj
     Struct.__init__(self, fmt)
コード例 #10
0
ファイル: nexrad.py プロジェクト: rayg-ssec/MetPy
 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))
コード例 #11
0
ファイル: nexrad.py プロジェクト: rayg-ssec/MetPy
 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))
コード例 #12
0
 def __init__(self, **kw):
     Struct.__init__(self, "<BBBBLHHB")
     OpenStruct.__init__(self, **kw)
     self.bDescriptorSubtype = 0x0F
     self.bDescriptorType = CS_INTERFACE
コード例 #13
0
 def __init__(self):
     Struct.__init__(self, "!BBHHH")
コード例 #14
0
ファイル: util.py プロジェクト: terhorst/bamsort
 def __init__(self, fmt):
     Struct.__init__(self, "<" + fmt)
コード例 #15
0
ファイル: ping.py プロジェクト: ww9rivers/c9r
 def __init__(self):
     Struct.__init__(self, "!BBHHH")
コード例 #16
0
ファイル: nexrad.py プロジェクト: rayg-ssec/MetPy
 def __init__(self, fmt, fobj):
     self._fobj = fobj
     Struct.__init__(self, fmt)
コード例 #17
0
ファイル: desc.py プロジェクト: pscholl/ethbridge
 def __init__(self,**kw):
     Struct.__init__(self, "<BBBBLHHB")
     OpenStruct.__init__(self, **kw)
     self.bDescriptorSubtype = 0x0F
     self.bDescriptorType    = CS_INTERFACE
コード例 #18
0
ファイル: nldecap.py プロジェクト: ffourcot/nldecap
 def __init__(self, fmt, fields):
     self._ntuple = namedtuple(type(self).__name__, fields)
     super(NamedStruct, self).__init__(fmt)
     Struct.__init__(self, fmt)