A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://pypi.python.org/pypi/sixer below:

sixer · PyPI

sixer is a tool adding Python 3 support to a Python 2 project. It was written to produces patches to port OpenStack to Python 3. It is focused on supporting Python 2.7 and 3.4.

It uses basic regular expressions to find code which needs to be modified. It emits warnings when code was not patched or looks suspicious.

See also the six module documentation.

Usage
sixer.py [--write] [options] <all|operation1[,operation2,...]> <directories or filenames>

sixer.py displays the name of patched files. It displays warnings for suspicious code which may have to be ported manually.

The first parameter can be a list of operations separated by commas. Use "all" to apply all operations. Operation prefixed by - are excluded. For example, "all,-iteritems" applies all operations except iteritems.

For directories, sixer.py searchs for .py files in all subdirectories.

By default, sixer uses a dry run: files are not modified. Add --write (or -w) option to modify files in place. It’s better to use sixer in a project managed by a source control manager (ex: git) to see differences and revert unwanted changes. The original files are not kept.

Use --help to see all available options.

See below for the list of available operations.

Operations Installation

To install sixer, type:

pip3 install sixer

sixer requires Python 3, it doesn’t work on Python 2.

Adding the six import

When an operation uses six, import six may be added. sixer repects OpenStack coding style rules to add the import: imports grouped by standard library, third party and application imports; and imports must be are sorted.

Limitations

Since the project is implemented with regular expressions, it can produce false positives (invalid changes). For example, some operations replace patterns in strings, comments or function names even if it doesn’t make sense.

Try also the 2to6 project which may be more reliable.

Tests

To run tests, type tox. Type pip install -U tox to install or update the tox program.

Or run tests manually: type python3 tests.py.

Resources to port code to Python 3 Changelog

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4