def incrementer_proceed(last_received=[None]): """Increment every received number.""" while True: number = yield from receive() yield from send(number + 1) yield from proceed() # this basically does nothing last_received[0] = number
def _send_two(self, event): """Send the event to the connection. This is used to overwrite the after_send of the bottom of the pipeline if it's an automatic pipeline. """ # print('Sending to pipeline one: {}'.format(event)) self.pipeline_one.to_receive(event) yield from proceed()
def _after_send(self, event): """Pass the processed event down to the bottom layer.""" self._directly_to_send(event) yield from proceed() # proceed to process any additional events
def _after_receive(self, event): """Pass the processed event up to the top layer.""" self._directly_receive(event) yield from proceed() # proceed to process any additional events