معرفی شرکت ها


agent-0.1.2


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

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

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

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

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

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

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

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

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

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

مشاهده بیشتر

توضیحات

Async generators for humans
ویژگی مقدار
سیستم عامل -
نام فایل agent-0.1.2
نام agent
نسخه کتابخانه 0.1.2
نگهدارنده []
ایمیل نگهدارنده []
نویسنده Chris Seto
ایمیل نویسنده chriskseto@gmail.com
آدرس صفحه اصلی https://github.com/chrisseto/Agent
آدرس اینترنتی https://pypi.org/project/agent/
مجوز The MIT License (MIT) Copyright (c) 2015 Chris Seto Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# Agent: Async generators for humans **agent** provides a simple decorator to create python 3.5 [asynchronous iterators](https://docs.python.org/3/reference/compound_stmts.html#async-for) via `yield`s ## Examples Make people wait for things for no reason! ```python import agent import asyncio @agent.gen # Shorthand decorator def wait_for_me(): yield 'Like ' yield from asyncio.sleep(1) yield 'the line ' yield from asyncio.sleep(10) yield 'at ' yield from asyncio.sleep(100) yield 'the DMV' async for part in wait_for_me(): print(part) ``` Paginate websites in an easy asynchronous manner. ```python import agent import aiohttp @agent.async_generator def gen(): page, url = 0, 'http://example.com/paginated/endpoint' while True: resp = yield from aiohttp.request('GET', url, params={'page': page}) resp_json = (yield from resp.json())['data'] if not resp_json: break for blob in resp_json['data']: yield blob page += 1 # Later on.... async for blob in gen(): # Do work ``` **The possibilities are endless!** For additional, crazier, examples take a look in the [tests directory](tests/). ## Get it ```bash $ pip install -U agent ``` ## Caveats `yield from` syntax must be used as `yield` in an `async def` block is a syntax error. ```python async def generator(): yield 1 # Syntax Error :( ``` `asyncio.Future`s can not be yield directly, they must be wrapped by `agent.Result`. ## License MIT licensed. See the bundled [LICENSE](LICENSE) file for more details.


نحوه نصب


نصب پکیج whl agent-0.1.2:

    pip install agent-0.1.2.whl


نصب پکیج tar.gz agent-0.1.2:

    pip install agent-0.1.2.tar.gz