Giter Site home page Giter Site logo

aiochan's People

Contributors

msladecek avatar zh217 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aiochan's Issues

FYI: pygolang

Hello up there.

No bug on aiochan side found but just wanted to let you know that a similar project exists with support for channels and goroutines: pygolang.

Thanks.

How do I dynamically chain ops

Hi, great library, thanks.

I'm creating a pipeline, where pipeline tasks are user defined and can be dynamic. e.g. below are tasks that user wish to pass to aiochan,

test.py

gen = [1, 2, 3]
download = DownloadSomethingFromInternet() # it contains 'execute' method
batchify = ("group", 2) # group 2 downloads
proceess = SomeProcessing() # it contains 'execute' method

p = AioChanPipeline.run(gen, [download,  batchify,  process])

for d in p:
   ....

server.py

class AioChanPipeline:

    async def run(self, gen, stages):
        pipeline_stream = ac.from_iter(gen)

        for stage in stages:
            if isinstance(stage, tuple):
                pipeline_stream = getattr(pipeline_stream, stage[0])(**stage[1])
            else:
                pipeline_stream = pipeline_stream.async_pipe_unordered(stage.execute)

        async for data in pipeline_stream:
            yield data

Im running above test.py using @pytest.mark.asyncio and it works If I exclude last process stage. I think after getattr(pipeline_stream, stage[0])(**stage[1]) call something went wrong.

so do you any way to pipe operations without method call?

Apply type hints

What do you think about adding type hints for channels for better control?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.