معرفی شرکت ها


aioconcurrency-0.5.0


Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر

توضیحات

Run a coroutine with each item in an iterable, concurrently
ویژگی مقدار
سیستم عامل -
نام فایل aioconcurrency-0.5.0
نام aioconcurrency
نسخه کتابخانه 0.5.0
نگهدارنده []
ایمیل نگهدارنده []
نویسنده Daniel Lupu
ایمیل نویسنده dflupu@gmail.com
آدرس صفحه اصلی http://github.com/dflupu/aioconcurrency
آدرس اینترنتی https://pypi.org/project/aioconcurrency/
مجوز MIT
# aioconcurrency [![Build Status](https://travis-ci.org/dflupu/aioconcurrency.svg?branch=master)](https://travis-ci.org/dflupu/aioconcurrency) Run a coroutine with each item in an iterable, concurrently ## Install `pip install aioconcurrency` ## Usage example ``` import aioconcurrency items = [1, 2, 3, 4] async def f(item): return item * 2 async def main(): await aioconcurrency.map(items, f, concurrency=2) # Returns [2, 4, 6, 8] async for result in aioconcurrency.each(items, f, concurrency=2): print(result) # Prints 2 4 6 8 in random order ``` ## Api ### aioconcurrency.map Runs the given coroutine concurrently with each item in an iterable. The list of the return values will be ordered as if ran serially. `items` An iterable object. `coro` Coroutine to feed each item to. `optional: concurrency` Number of concurrent runs of `coro`. Defaults to `aioconcurrency.Infinite`. `optional: executor` Can be an instance of ThreadPoolExecutor. `optional: loop` The asyncio event loop that will be used. ### aioconcurrency.each Runs the given coroutine concurrently with each item in an iterable. Returns a generator that may be used to iterate over the return values. The generator yields values as soon as they are available. `items` An iterable object. If an `asyncio.Queue` is passed then `.each` will read from it indefinitely. `coro` Coroutine to feed each item to. `optional: concurrency` Number of concurrent runs of `coro`. Defaults to `aioconcurrency.Infinite`. `optional: executor` Can be an instance of ThreadPoolExecutor. `optional: loop` The asyncio event loop that will be used. `optional: discard_results` If truthy, discard the return value of `coro`. Defaults to false. `property: wait()` Coroutine. May be used to wait until all items have been processed. `property: processed_count` The number of items that have been processed so far. `property: cancel()` Cancels all runs of `coro`. ## Tests `pytest .`


نحوه نصب


نصب پکیج whl aioconcurrency-0.5.0:

    pip install aioconcurrency-0.5.0.whl


نصب پکیج tar.gz aioconcurrency-0.5.0:

    pip install aioconcurrency-0.5.0.tar.gz