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.2.0.tar.gz (5.0 kB view details)

Uploaded Source

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

Hashes for tornado-async-transformer-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9916199c61d46f08e9cce20b24921492b20e136fa3af72db5adc68d54975db0a
MD5 079c94855de6c1c7e1e518869ff3da13
BLAKE2b-256 d8b2d3112af1139924e9ddb27ca2dd006967976b84b17c7f98f983b288f29f2b

See more details on using hashes here.

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

Hashes for tornado_async_transformer-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 595bde245be4f2ea05f5a0f82dffab7395e99fbf0343c542c8bc8844fba70009
MD5 78f4ac9041a96d73ae578b2ad271d45d
BLAKE2b-256 69fc5383cd9690219b4ddf84631359dad863dbef1be07a358f9b4e0ffb02d903

See more details on using hashes here.

Supported by

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