Skip to main content

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.

Check out the demo.

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

tornado-async-transformer-0.1.5.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tornado_async_transformer-0.1.5-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file tornado-async-transformer-0.1.5.tar.gz.

File metadata

  • Download URL: tornado-async-transformer-0.1.5.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.3

File hashes

Hashes for tornado-async-transformer-0.1.5.tar.gz
Algorithm Hash digest
SHA256 399dcac39cc73fd86fc1e338350cf80039b4ff59fbf7bb46a7e3203784eb6165
MD5 51ff1b051fb3a7d13eec72b9132d0c08
BLAKE2b-256 2d7a9f1c02ce467692a4f8f6a7ad20cb14d5c8a802547e11b8183d5405bfc11f

See more details on using hashes here.

File details

Details for the file tornado_async_transformer-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: tornado_async_transformer-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.3

File hashes

Hashes for tornado_async_transformer-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f80dd9a613aa900b2c88342bd52cf66e07881b9d2bf5a468a4d9611fb7c7c627
MD5 04a1bf304ae086258500d2450267dae5
BLAKE2b-256 925d67c25486fd90b63d62c2251902bc143eb0832ad5a3eb316342c6916adb3e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page