# 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
or
pipenv install aioshim
## Development
Just clone the repo and run:
pipenv install --dev
This project uses [yapf](https://github.com/google/yapf) formatter.
<br/>
# Library Documentation
* [builtins](#builtins)
* [aenumerate](#aenumerate)
* [itertools](#itertools)
* [chain](#itertoolschainiterables)
* [chain_from_iterable](#itertoolschain_from_iterableiterable)
## builtins
### `aenumerate`
Async version of: [enumerate](https://docs.python.org/3.6/library/functions.html#enumerate)
Example:
```python
async for i in aenumerate(chain(a_gen, range(10))):
print(i)
```
## itertools
### `itertools.chain(*iterables)`
Async version of: [itertools.chain](https://docs.python.org/3.6/library/itertools.html#itertools.chain)
This function can handle `AsyncGeneratorType`.
Example:
```python
# Use with async_generator:
async for i in chain(my_async_gen1, my_async_gen2):
print(i)
# Allows for mixing normal generators with async generators:
async for i in chain(my_async_gen, range(10)):
print(i)
```
### `itertools.chain_from_iterable(iterable)`
Async version of: [itertools.chain.from_iterable](https://docs.python.org/3.6/library/itertools.html#itertools.chain.from_iterable)
This function can handle `AsyncGeneratorType`.
Example:
```python
# Use with async_generator:
async for i in chain_from_iterable(my_async_generator):
print(i)
# Works with normal items as well:
async for i in chain_from_iterable([range(10)]):
print(i)tertoolschain_from_iterableiterable
```
## More items to come
Pull requests appreciated!
Metadata
Release files for aioshim 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aioshim-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for aioshim-0.0.3-py3-none-any.whl |
Release files / aioshim-0.0.3-py3-none-any.whl
| Download URL | aioshim-0.0.3-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c46cf571bfbccef1f39cdd53d6e42c417839511e151aa89fbfd61a3e5dcd3ab0
|
|
BLAKE2b-256 checksum How to use checksums |
58183155422a6f9ea3f8c0d0898f247e7b6c2e5f114987c8fa53f60b98582d3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for aioshim 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.