A _Siphon is an IDrain and possibly also an IFount, and provides lots of conveniences to make it easy to implement something that does fancy flow control with just a few methods.

Method __init__ Initialize this _Siphon with the given ITube to control its behavior.
Method __repr__ Nice string representation.
Method ejectPending Eject the entire pending buffer into a list for reassembly by a diverter.
Instance Variable _tube the ITube which will receive values from this siphon and call deliver to deliver output to it. (When set, this will automatically set the siphon attribute of said ITube as well, as well as un-setting the siphon attribute of the old tube.)
Instance Variable _currentlyPaused is this _Siphon currently paused? Boolean: True if paused, False if not.
Instance Variable _pauseBecausePauseCalled an IPause from the upstream fount, present because pauseFlow has been called.
Instance Variable _flowStoppingReason If this is not None, then call flowStopped on the downstream IDrain at the next opportunity, where "the next opportunity" is when all buffered input (values yielded from started, received, and stopped) has been written to the downstream drain and we are unpaused.
Instance Variable _everStarted Has this _Siphon ever called started on its ITube? (type: bool)
Method _noMore I am now unable to produce further input, or output, or both.
Method _deliverFrom Deliver some items from a callable that will produce an iterator.
Method _unbufferIterator Un-buffer some items buffered in self._pending and actually deliver them, as long as we're not paused.
Method _endOfLine We've reached the end of the line. Immediately stop delivering all buffers and notify our downstream drain why the flow has stopped.
_tube =
the ITube which will receive values from this siphon and call deliver to deliver output to it. (When set, this will automatically set the siphon attribute of said ITube as well, as well as un-setting the siphon attribute of the old tube.)
_currentlyPaused =
is this _Siphon currently paused? Boolean: True if paused, False if not.
_pauseBecausePauseCalled =
an IPause from the upstream fount, present because pauseFlow has been called.
_flowStoppingReason =
If this is not None, then call flowStopped on the downstream IDrain at the next opportunity, where "the next opportunity" is when all buffered input (values yielded from started, received, and stopped) has been written to the downstream drain and we are unpaused.
_everStarted =
Has this _Siphon ever called started on its ITube? (type: bool)
def __init__(self, tube):

Initialize this _Siphon with the given ITube to control its behavior.

def _noMore(self, input, output):

I am now unable to produce further input, or output, or both.

ParametersinputTrue if I can no longer produce input.
outputTrue if I can no longer produce output.
def __repr__(self):

Nice string representation.

def _deliverFrom(self, deliverySource):

Deliver some items from a callable that will produce an iterator.

ParametersdeliverySourcea 0-argument callable that will return an iterable.
def _unbufferIterator(self):

Un-buffer some items buffered in self._pending and actually deliver them, as long as we're not paused.

def _endOfLine(self, flowStoppingReason):

We've reached the end of the line. Immediately stop delivering all buffers and notify our downstream drain why the flow has stopped.

ParametersflowStoppingReasonthe reason that the flow was stopped.
def ejectPending(self):

Eject the entire pending buffer into a list for reassembly by a diverter.

Returnsa list of all buffered output values.
API Documentation for tubes, generated by pydoctor at 2016-01-18 07:46:47.