Package: cop
==>  COPcoroutines for dataflow pipelines==>  ABOUTCop is designed to make it easyto write readable dataflow programs.Speed is important, but probablyisn't there yet.This library is a learning exercise.At this stage, it should really beseen as a source for you to seehow to implement your own coroutines.The primary motivation for cop isto facilitate readable and flexibledataflow programming. Once theproject is more mature, its focuscould shift to enhancing performance.==>  TERMINOLOGYThere are three basic terms that areused within cop: sources, steps andsinks./sources/   Feed data to steps.(cop.file, cop.web)/steps/     Process data, thenfeed it to a target./sinks/     Process data.==>  USAGEUsing cop is straight forward. Examplesgenerally follow the following pattern:from cop.sources import sourcefrom cop.steps import step1, step2from cop.sinks import sinksource(step1(step2(sink()))))/examples/>>> from cop.sources import web>>> from cop.steps import delimit>>> from cop.stops import grep>>> from cop.steps import transform>>> from cop.sinks import printer>>> url = 'http://python.org'>>> web(url,...    delimit('\n',...    transform(lambda l: l.lower(),...    grep('monty',...    printer())))In this case, nothing comes out. That'sbasically because there's very littleabout Monty Python at python.org./non-linear pipelines/Sometimes, a linear pathway isn't enough.Perhaps we would like to do somethingwith intermediate results.Enter `cop.flow`. It provides `broadcast`for sending data to multiple steps, and`loadbalance`, which implements a round-robin load balancing system between steps.==>  BACK STORYThe start of this whole thing is fromcode written by David Beazley, especiallyhis tutorial on coroutines[0]. Thatwork is excellent and should basicallybe considered the manual for this library.I read the PDF of the tutorial in themorning. By the end of the evening I hada few dozen workable functions that couldbe strung together in an almost arbitaryfunction.==>  FUTURE PLANSI would really like to see interactingwith multiple cores and hosts becometrivally easy.==>  HACKINGIf you would like to contribute to cop,that's great. It's easy to do and willhelp people. At the moment, testcoverage is at a healthy 0%.The plan is to use heavy use of doctests.`cop.printer` should be quite useful:>> source(sink(printer()))result[sidenote]I use >> as prompt when I don't wantdoctest to claim it. I find thispreferable to using the skip directive.==>  LEGAL/code/Apart from code written by David Beazley,which is used with with permission, thecode the copyright of Tim McNamara[1].The code is released under the Apache 2license[2]./docs/All documentation is the copyright ofTim McNamara. All docs are released underthe "Creative Commons Attribution 3.0New Zealand (CC BY 3.0)" licence[3], inaddition to the Apache 2 licence where itapplies./trade marks/"cop" is an unregistered trade mark ofTim McNamara under New Zealand law./Consumer Guarantees Act 1993/If you use this software for personal use,you have certain rights under the ConsumerGuarantees Act 1993. They are explained bythe Ministry of Consumer Affairs[4].Generally speaking, cop must be of"acceptable" quality and be fit for thepurposes described.However, when judging acceptable quality,please consider that you are downloadingfree software from the Internet.[sidenote]I'm not entirely certain whethersoftware code counts as a good or aservice for the purpose of the Act[sidenote]No, we can't opt out of these provisions.Irrespective of the terms of the licence.==>  FURTHER READING"Structure and Interpretation of Computer Programs"*Chaper 5: Sequences and Coroutines (esp. 5.3 "Coroutines")http://wla.berkeley.edu/~cs61a/fa11/lectures/streams.htmlThis is not the original SICP, written in Scheme, buta version which is Python specific.==>  REFERENCES[0] http://dabeaz.com/coroutines[1] @timClicks<code@timmcnamara.co.nz>[2] http://www.apache.org/licenses/LICENSE-2.0[3] http://creativecommons.org/licenses/by/3.0/nz/[4] http://www.consumer.org.nz/reports/consumer-guarantees-act/the-guarantees