trollius2asyncio
A tool based on lib2to3 for converting code using trollius to use asyncio. After installation, run trollius2asyncio. It works in the same way as 2to3.
For example, it will transform this:
import trollius
from trollius import From, Return
@trollius.coroutine
def double_future(future):
value = yield From(future)
raise Return(2 * value)
into
import asyncio
async def double_future(future):
value = await future
return 2 * value
Usage
After installation, run trollius2asyncio as you would 2to3. It takes the
same command-line arguments, including -h for help.
Limitations
It recognises From, trollius.From, Return and trollius.Return, without
taking the imports into consideration. Thus, importing trollius as a different
name will confuse it, and from tornado.gen import Return will cause the
returns from Tornado to also be rewritten (which should still be a legal
transformation).
It recognises @trollius.coroutine, again without taking imports into
consideration. If the decorator is omitted, it won't turn the function into a
coroutine, which will lead to syntax errors if it ends up containing await
statements. It also won't apply the transformation if there are additional
decorators inside (i.e., between @trollius.coroutine and the definition)
since that would alter the semantics.
The resulting code is not necessarily well-styled e.g., the extra blank line in the example above. These are limitations of lib2to3 and won't be easy to fix without risking breaking code in corner cases.
Release history
0.2
- Drop Python 3.4 support (output code uses async and await).
0.1.1
- Add licence.
0.1
- Initial release.
Metadata
Release files for trollius-fixers 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| trollius-fixers-0.2.tar.gz | 4.6 kB | Without provenance | Details for trollius-fixers-0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| trollius_fixers-0.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for trollius_fixers-0.2-py2.py3-none-any.whl |
Total release size: 14.7 kB
Release files / trollius-fixers-0.2.tar.gz
| Download URL | trollius-fixers-0.2.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
85d8230dc137fbe43031a5c695a42d22c17e92b26a4bfc0582132f251f78acf9
|
|
BLAKE2b-256 checksum How to use checksums |
ef3c4aac6cc24b2fbcaabd269c5634f91956756668384f59a64f50b69620edc2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.14.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.7
|
Release files / trollius_fixers-0.2-py2.py3-none-any.whl
| Download URL | trollius_fixers-0.2-py2.py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
b67c5218b5f25e888a7eb4b204631192cd6264bf91b2a9a9e0cae77c80b4ab5d
|
|
BLAKE2b-256 checksum How to use checksums |
4880ab43f03268aa23c61d6592b4e69ea6f4c922685e137bc8781e346f1ddd7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.14.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.7
|
Security for trollius-fixers 0.2
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.