def process(self, *args, **kwargs): assert(self._source is not None) for frame in self._source: if isinstance(frame, struct): it = frame self._send_dict(it.as_dict(without_meta = True)) else: it = struct(frame) self._send_dict(it.as_dict(without_meta = True)) yield frame
def read(self, *args, **kwargs): while True: kind, payload = self._next_frame() if kind==KIND_DATA: yield struct(payload, meta=self.provides) elif kind==KIND_META: self._set_meta(payload) elif kind==None: raise StopIteration() else: LOG.warning('unknown kind: %s, ignoring' % kind)
def struct_maker(source): for f in source: yield struct(f)
def struct_maker(source): for f in source: yield struct(f)