def pull_frame(self): try: frame = self.oframes.get(block=False) for byte in frame: for bit in utils.to_bits(ord(byte)): self.oframe.append(bit) except Queue.Empty: pass
def pull_frame(self): try: frame = self._oframes.popleft() self.obuffer_used -= len(frame) self._oframe.clear() self._oframe.extend(self.FLAG) for byte in frame: for bit in utils.to_bits(ord(byte)): self._oframe.append(bit) if self._successive_bits_detector.feed(bit): self._oframe.append(0) self._successive_bits_detector.clear() self._oframe.extend(self.FLAG) except IndexError: pass