Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(10)  |  Call(10)  |  Derive(0)  |  Import(0)

src/c/o/concurrence-HEAD/examples/chat.py   concurrence(Download)
    def writer():
        for msg, args, kwargs in Tasklet.receive():
            if msg.match(MSG_WRITE_LINE):
                stream.writer.write_bytes(args[0] + '\n')
                stream.writer.flush()
    MSG_WRITE_LINE.send(writer_task)("type 'quit' to exit..")
 
    for msg, args, kwargs in Tasklet.receive():
        if msg.match(MSG_QUIT):
            break

src/c/o/concurrence-HEAD/examples/message.py   concurrence(Download)
def printer():
    for msg, args, kwargs in Tasklet.receive():
        if msg.match(MSG_GREETING):
            print 'Hello', args[0]
        elif msg.match(MSG_FAREWELL):

src/c/o/concurrence-HEAD/lib/concurrence/http/server.py   concurrence(Download)
    def write_responses(self, control, stream):        
        try:
            for msg, (request, response), kwargs in Tasklet.receive():
                request.write_response(response, stream.writer)
                self.MSG_RESPONSE_WRITTEN.send(control)(request, response)
 
        #control wait for msgs to arrive:        
        for msg, (request, response), kwargs in Tasklet.receive():
            if msg.match(self.MSG_REQUEST_READ):
                #we use reque to be able to send the responses back in the correct order later

src/c/o/concurrence-HEAD/test/testcore.py   concurrence(Download)
        def c(parent):
            for msg, args, kwargs in Tasklet.receive():     
                if msg.match(MSG_PING):
                    self.assertEquals((10, ), args)
                    MSG_PONG.send(parent)(20)
        i = 0
        MSG_PING.send(child)(10)
        for msg, args, kwargs in Tasklet.receive():
            if msg.match(MSG_PONG):
                self.assertEquals((20, ), args)
        try:
            start = time.time()
            for msg, args, kwargs in Tasklet.receive(2.0):
                self.fail('expected timeout error')            
        except TimeoutError:
        def c():
            for msg, args, kwargs in Tasklet.receive():
                if msg.match(MSG_TEST_SUM):
                    msg.reply(sum(args))
                elif msg.match(MSG_TEST_MAX):

src/c/o/concurrence-HEAD/test/testremote.py   concurrence(Download)
                server_endpoint = remote_server.serve(('localhost', 9081))
                remote_server.register('testing123')
                for msg, args, kwargs in Tasklet.receive():
                    if msg.match(MSG_SUM):
                        server_results.append('s')