Lines Matching refs:to3
3 2to3 - Automated Python 2 to 3 code translation
8 2to3 is a Python program that reads Python 2.x source code and applies a series
10 contains a rich set of fixers that will handle almost all code. 2to3 supporting
12 possible to write your own fixers for 2to3. :mod:`lib2to3` could also be
19 Using 2to3
22 2to3 will usually be installed with the Python interpreter as a script. It is
25 2to3's basic arguments are a list of files or directories to transform. The
36 It can be converted to Python 3.x code via 2to3 on the command line:
40 $ 2to3 example.py
42 A diff against the original source file is printed. 2to3 can also write the
49 $ 2to3 -w example.py
61 By default, 2to3 runs a set of :ref:`predefined fixers <2to3-fixers>`. The
68 $ 2to3 -f imports -f has_key example.py
74 $ 2to3 -x apply example.py
82 $ 2to3 -f all -f idioms example.py
86 Sometimes 2to3 will find a place in your source code that needs to be changed,
87 but 2to3 cannot fix automatically. In this case, 2to3 will print a warning
91 2to3 can also refactor doctests. To enable this mode, use the :option:`!-d`
99 Since some print statements can be parsed as function calls or statements, 2to3
100 cannot always read files containing the print function. When 2to3 detects the
115 The :option:`!-W` or :option:`!--write-unchanged-files` flag tells 2to3 to always
130 $ 2to3 -n -W --add-suffix=3 example.py
141 $ 2to3 --output-dir=python3-version/mycode -W -n python2-version/mycode
149 Each step of transforming code is encapsulated in a fixer. The command ``2to3
150 -l`` lists them. As :ref:`documented above <2to3-using>`, each can be turned on
455 :mod:`lib2to3` - 2to3's library
459 :synopsis: the 2to3 library