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
Close
Hashes for tornado-async-transformer-0.1.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b8665f6856e38b142d73a3dd5e6bd8e9600ba5cae0b99f2955b480d67c2692d |
|
MD5 | 2e4058cbc53f9be77223cf85a5cfa56d |
|
BLAKE2b-256 | 93d10354c9c5dc9e33a0ff6e2b087d4f74964ca8266584e548123a9dc634dfb7 |
Close
Hashes for tornado_async_transformer-0.1.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4a8b6fa0bceb805835e18b25453ecb6a88e7777c8494352d746d20857f99872 |
|
MD5 | e94fae64bfad78324963b8ec52f304dc |
|
BLAKE2b-256 | 9ab5017249ac57137da93e7f024250d86ff2f708e8a7314f7fcdfdc6c5dea3e9 |