yield2await
Transform your python code from old syntax with yield from to use async/await (PEP 492).
Usage
$ pip install yield2await
$ yield2await <path> [-i <ignore-path>]
Before
@asyncio.coroutine
def handler(request):
session = yield from get_session(request)
session['last_visit'] = time.time()
with (yield from self.dbengine) as conn:
ret = yield from conn.execute(query)
user = yield from ret.fetchone()
return web.Response(body=b'OK')
After
async def handler(request):
session = await get_session(request)
session['last_visit'] = time.time()
async with self.dbengine as conn:
ret = await conn.execute(query)
user = await ret.fetchone()
return web.Response(body=b'OK')
Contribution
Feel free to contribute. Just do RP.
Caution
This is a very alpha, check the changes manually before commit.
Metadata
Release files for yield2await 0.0.1
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 |
|---|---|---|---|---|
| yield2await-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for yield2await-0.0.1-py3-none-any.whl |
Release files / yield2await-0.0.1-py3-none-any.whl
| Download URL | yield2await-0.0.1-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e453a5ba05b3e5e7272e96d8708954acf159a1335c571d0d5aafb74057d72ae4
|
|
BLAKE2b-256 checksum How to use checksums |
4b15117f577ff8c84ec9959f91a70671a3082fcb925ed3656ead29afe87b956b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for yield2await 0.0.1
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.