Known subclasses: tubes.itube.IDivertable

Known implementations: tubes.tube._Tubule

A tube transforms input into output.

Look at this awesome ASCII art:

                    a fount
                 +----+--------+               +-----  a
                / +---+------+ | | data flow  / +----  fount
    a tube --->/ /           | | v           / /
              / /            | |            / /
             / /             | |  a drain  / /
   a     ---+ /              | +----+-----+ /<--- a tube
   drain ----+               +------+------+

         =========> direction of flow =========>

(Image credit Nam Nguyen)

NoteITube providers participate in data processing not in flow control. That is to say, an ITube provider can translate its input to output, but cannot impact the rate at which that output is delivered. If you want to implement flow-control modifications, implement IDrain directly. IDrain providers may be easily connected up to ITube providers with series, so you may implement flow-control in an IDrain that passes on its input unmodified and data-processing in an ITube and hook them together.
Attribute inputType The type expected to be received as input to received.
Attribute outputType The type expected to be sent as output to tube.deliver.
Method started The flow of items has started. received may be called at any point after this.
Method received An item was received from 'upstream', i.e. the framework, or the lower-level data source that this ITube is interacting with.
Method stopped The flow of data from this ITube's input has ceased; this corresponds to IDrain.flowStopped.
inputType =

The type expected to be received as input to received.

outputType =

The type expected to be sent as output to tube.deliver.

def started():

The flow of items has started. received may be called at any point after this.

def received(item):

An item was received from 'upstream', i.e. the framework, or the lower-level data source that this ITube is interacting with.

ReturnsAn iterable of values to propagate to the downstream drain attached to this ITube. (type: iterable of ITube.outputType)
def stopped(reason):

The flow of data from this ITube's input has ceased; this corresponds to IDrain.flowStopped.

ReturnsThe same as ITube.received; values returned (or yielded) by this method will be propagated before the IDrain.flowStopped notification to the downstream drain. (type: same as ITube.received)
NoteITube has no notification corresponding to IFount.stopFlow, since it has no control over whether additional data will be synthesized / processed by its fount, there's no useful work it can do.
API Documentation for tubes, generated by pydoctor at 2016-01-18 07:46:47.