跳转到主要内容

在fissix(lib2to3分支)的基础上进行改进,用于现代化混合代码库的代码。

项目描述

Python           _              _
   _ __  ___  __| |___ _ _ _ _ (_)______
  | '  \/ _ \/ _` / -_) '_| ' \| |_ / -_)
  |_|_|_\___/\__,_\___|_| |_||_|_/__\___|

这个库是对fissix的一个薄包装,fissix是lib2to3的一个分支,利用它使Python 2代码更现代化,目的是最终将其迁移到Python 3。

python -m modernize命令的功能类似于python -m fissix,请参阅fissix。以下是重写单个文件的方法:

python -m modernize -w example.py

它不保证,但尝试输出与Python 2.6+或Python 3兼容的代码库。除非使用--no-six选项,否则生成的代码对six有运行时依赖。建议使用1.9.0或更高版本的six。一些修复器输出的代码与Python 2.5或更低版本不兼容。

文档: modernize.readthedocs.io

有关modernize的许可信息,请参阅LICENSE文件。使用此工具不会影响现代化代码的许可。

Documentation Status https://api.travis-ci.org/pycqa/modernize.svg?branch=master https://coveralls.io/repos/pycqa/modernize/badge.png?branch=master

支持者:

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面