Skip to main content

No project description provided

Project description

# aioshim

## Description

The main purpose of this lib is to provide *asyncio* compatible versions of the functions in the standard library. E.g. `itertools.chain()` doesn't work with `async_generators`, so there is `aioshim.itertools.chain()` to fill the gap. Etc.

I'm sure the stdlib will catch up with this sooner or later. This lib is for those who need a shim as soon as possible.

This could be a central repo for all such *asyncio* related shims.

If there is interest, this repo could be maintained by a github *aioshim* org or something.

## Requirements

aioshim requires Python `>= 3.6`

## Install

pip install aioshim


pipenv install aioshim

## Development

Just clone the repo and run:

pipenv install --dev

This project uses [yapf]( formatter.


# Library Documentation

* [builtins](#builtins)
* [aenumerate](#aenumerate)
* [itertools](#itertools)
* [chain](#itertoolschainiterables)
* [chain_from_iterable](#itertoolschain_from_iterableiterable)

## builtins

### `aenumerate`

Async version of: [enumerate](



async for i in aenumerate(chain(a_gen, range(10))):


## itertools

### `itertools.chain(*iterables)`

Async version of: [itertools.chain](

This function can handle `AsyncGeneratorType`.


# Use with async_generator:
async for i in chain(my_async_gen1, my_async_gen2):

# Allows for mixing normal generators with async generators:
async for i in chain(my_async_gen, range(10)):

### `itertools.chain_from_iterable(iterable)`

Async version of: [itertools.chain.from_iterable](

This function can handle `AsyncGeneratorType`.


# Use with async_generator:
async for i in chain_from_iterable(my_async_generator):

# Works with normal items as well:
async for i in chain_from_iterable([range(10)]):

## More items to come

Pull requests appreciated!

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for aioshim, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size aioshim-0.0.3-py3-none-any.whl (4.6 kB) File type Wheel Python version 3.6 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page