itertools and builtins for AsyncIO and mixed iterables
Go to file
dependabot[bot] c78d11b574
Bump flake8 from 4.0.1 to 5.0.4 (#126)
Bumps [flake8](https://github.com/pycqa/flake8) from 4.0.1 to 5.0.4.
- [Release notes](https://github.com/pycqa/flake8/releases)
- [Commits](https://github.com/pycqa/flake8/compare/4.0.1...5.0.4)

---
updated-dependencies:
- dependency-name: flake8
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-16 19:30:04 -07:00
.github Remove codecov 2022-02-06 21:10:23 -08:00
aioitertools Update names and copyright 2022-08-23 21:54:36 -07:00
docs Update names and copyright 2022-08-23 21:54:36 -07:00
.flake8 Switch from pylint to flake8 2021-05-16 14:04:41 -07:00
.gitignore Add sphinx documentation 2020-04-28 23:07:43 -07:00
.pylint Upgrade deps, fix lint 2020-11-08 13:43:28 -08:00
.readthedocs.yml Add sphinx documentation 2020-04-28 23:07:43 -07:00
CHANGELOG.md Version bump v0.10.0 2022-02-23 19:38:11 -08:00
CODE_OF_CONDUCT.md Update names and copyright 2022-08-23 21:54:36 -07:00
CONTRIBUTING.md Readme/contributing updates 2019-10-19 19:51:57 -07:00
LICENSE Update names and copyright 2022-08-23 21:54:36 -07:00
MANIFEST.in Add changelog, contributers, and code of conduct to sdists 2019-11-12 21:01:10 -08:00
README.md Update url 2022-08-23 22:02:24 -07:00
makefile Remove codecov, enforce 100% coverage 2022-02-06 21:21:56 -08:00
mypy.ini Switch to flit and pyproject.toml 2020-04-22 11:54:06 -07:00
pyproject.toml Update names and copyright 2022-08-23 21:54:36 -07:00
requirements-dev.txt Bump flake8 from 4.0.1 to 5.0.4 (#126) 2022-09-16 19:30:04 -07:00
requirements.txt Deprecate loop parameter to asyncio functions 2022-02-05 00:31:56 -08:00

README.md

aioitertools

Implementation of itertools, builtins, and more for AsyncIO and mixed-type iterables.

documentation version changelog license

Install

aioitertools requires Python 3.6 or newer. You can install it from PyPI:

$ pip install aioitertools

Usage

aioitertools shadows the standard library whenever possible to provide asynchronous version of the modules and functions you already know. It's fully compatible with standard iterators and async iterators alike, giving you one unified, familiar interface for interacting with iterable objects:

from aioitertools import iter, next, map, zip

something = iter(...)
first_item = await next(something)

async for item in iter(something):
    ...


async def fetch(url):
    response = await aiohttp.request(...)
    return response.json

async for value in map(fetch, MANY_URLS):
    ...


async for a, b in zip(something, something_else):
    ...

aioitertools emulates the entire itertools module, offering the same function signatures, but as async generators. All functions support standard iterables and async iterables alike, and can take functions or coroutines:

from aioitertools import chain, islice

async def generator1(...):
    yield ...

async def generator2(...):
    yield ...

async for value in chain(generator1(), generator2()):
    ...

async for value in islice(generator1(), 2, None, 2):
    ...

See builtins.py, itertools.py, and more_itertools.py for full documentation of functions and abilities.

License

aioitertools is copyright Amethyst Reese, and licensed under the MIT license. I am providing code in this repository to you under an open source license. This is my personal repository; the license you receive to my code is from me and not from my employer. See the LICENSE file for details.