Пример #1
0
 def __getitem__(self, idx):
     if not -self.length <= idx < self.length:
         raise IndexError('ArrayOffset index out of range: %r' % idx)
     if idx < 0:
         idx += self.length
     off = self._base + self.offset + sizeof(ttype, tver) * idx
     return ttype(self._buf, off, tver)
Пример #2
0
Файл: offset.py Проект: crnt/kdi
 def __getitem__(self, idx):
     if not -self.length <= idx < self.length:
         raise IndexError('ArrayOffset index out of range: %r' % idx)
     if idx < 0:
         idx += self.length
     off = self._base + self.offset + sizeof(ttype, tver) * idx
     return ttype(self._buf, off, tver)
Пример #3
0
 def _iteritems(self):
     off = self._base + self.offset
     sz = sizeof(ttype, tver)
     for i in xrange(self.length):
         yield ttype(self._buf, off, tver)
         off += sz
Пример #4
0
Файл: offset.py Проект: crnt/kdi
 def _iteritems(self):
     off = self._base + self.offset
     sz = sizeof(ttype, tver)
     for i in xrange(self.length):
         yield ttype(self._buf, off, tver)
         off += sz