libcst transformer and codemod for updating tornado @gen.coroutine syntax to python3.5+ native async/await
Project description
Tornado Async Transformer
A libcst transformer for updating tornado @gen.coroutine syntax to python3.5+ native async/await.
Usage
You can either:
- Add
tornado_async_transformer.TornadoAsyncTransformer
to your existing libcst codemod. - Or run
python -m tornado_async_transformer.tool my_project/
from the commandline.
Example
"""
A simple coroutine.
"""
from tornado import gen
-@gen.coroutine
-def call_api():
- response = yield fetch()
+async def call_api():
+ response = await fetch()
if response.status != 200:
raise BadStatusError()
- raise gen.Return(response.data)
+ return response.data
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file tornado-async-transformer-0.2.0.tar.gz
.
File metadata
- Download URL: tornado-async-transformer-0.2.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9916199c61d46f08e9cce20b24921492b20e136fa3af72db5adc68d54975db0a |
|
MD5 | 079c94855de6c1c7e1e518869ff3da13 |
|
BLAKE2b-256 | d8b2d3112af1139924e9ddb27ca2dd006967976b84b17c7f98f983b288f29f2b |
File details
Details for the file tornado_async_transformer-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: tornado_async_transformer-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 595bde245be4f2ea05f5a0f82dffab7395e99fbf0343c542c8bc8844fba70009 |
|
MD5 | 78f4ac9041a96d73ae578b2ad271d45d |
|
BLAKE2b-256 | 69fc5383cd9690219b4ddf84631359dad863dbef1be07a358f9b4e0ffb02d903 |