Tool to convert Python code to work with older versions
Project description
Python3.11などの新しいバージョンのコードを、古いバージョンで動作するように変換するツールです。
あくまでも動作するように小手先の変換を施すだけであって、複雑なパターンの変換や厳密な等価性が必要な場合には使用できません。 また、当然ですが可読性はある程度失われます。
具体的には、以下のような変換を行います。
- 代入や関数定義の型アノテーションを文字列リテラルに置き換える
- 旧バージョンに存在しない要素の
from typing import
を削除する alias: TypeAlias = SomeType
という形のTypeAlias
の定義をする代入文の右辺を文字列リテラルに置き換える- (ToDo: match文をif文に変換する)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
compatibilityer-0.1.0.tar.gz
(3.8 kB
view hashes)
Built Distribution
Close
Hashes for compatibilityer-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad05a6d431447da6f7ea43d56e7c19ee097ba9754f10c5495df1684a2e98d52f |
|
MD5 | 35ae12a71076ba0ed62a4395fc440943 |
|
BLAKE2b-256 | 7c4fa29c120c98aa86c222e8ebc84e312e5cebc3ed382da06486ef2c56e99d28 |