Skip to content

Commit

Permalink
update remaining lib2to3 references to fissix
Browse files Browse the repository at this point in the history
these were missed because sometimes lib2to3 is referred to as 2to3
  • Loading branch information
graingert committed Sep 3, 2020
1 parent e6f9e97 commit 0c893bc
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 57 deletions.
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ This library is a very thin wrapper around `fissix
to make Python 2 code more modern with the intention of eventually
porting it over to Python 3.

The ``python -m modernize`` command works like `2to3
<https://docs.python.org/3/library/2to3.html>`_. Here's how you'd rewrite a
The ``python -m modernize`` command works like `fissix
<https://github.com/jreese/fissix>`_. Here's how you'd rewrite a
single file::

python -m modernize -w example.py
Expand Down
98 changes: 49 additions & 49 deletions docs/fixers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ Some fixers rely on the latest release of the `six project`_ to work
If you wish to turn off these fixers to avoid an external dependency on ``six``,
then use the ``--no-six`` flag.

Fixers use the API defined by 2to3. For details of how this works, and how to
implement your own fixers, see `Extending 2to3 with your own fixers, at
python3porting.com <http://python3porting.com/fixers.html>`_.
Fixers use the API defined by fissix. For details of how this works, and how to
implement your own fixers, see `Creating a fixer, at
python3porting.com <http://python3porting.com/fixers.html#creating-a-fixer>`_.
``python -m modernize`` will try to load fixers whose full dotted-path is specified
as a ``-f`` argument, but will fail if they are not found. By default, fixers
will not be found in the current directory; use ``--fixers-here`` to make
Expand Down Expand Up @@ -55,13 +55,13 @@ The `six project`_ provides the ``six`` module which contains various tidbits in
helping to support Python 2/3 code. All ``six``-related fixers assume the latest
version of ``six`` is installed.

.. 2to3fixer:: basestring
.. fissix_fixer:: basestring

Replaces all references to :func:`basestring` with :data:`six.string_types`.

.. versionadded:: 0.4

.. 2to3fixer:: dict_six
.. fissix_fixer:: dict_six

Fixes various methods on the ``dict`` type for getting all keys, values, or
items. E.g.::
Expand All @@ -79,13 +79,13 @@ version of ``six`` is installed.
Care is taken to only call ``list()`` when not in an iterating context
(e.g. not the iterable for a ``for`` loop).

.. 2to3fixer:: filter
.. fissix_fixer:: filter

When a call to :func:`filter <python2:filter>` is discovered, ``from six.moves import filter`` is
added to the module. Wrapping the use in a call to ``list()`` is done when
necessary.

.. 2to3fixer:: imports_six
.. fissix_fixer:: imports_six

Uses :mod:`six.moves` to fix various renamed modules, e.g.::

Expand Down Expand Up @@ -139,7 +139,7 @@ version of ``six`` is installed.

.. versionadded:: 0.4

.. 2to3fixer:: input_six
.. fissix_fixer:: input_six

Changes::

Expand All @@ -154,18 +154,18 @@ version of ``six`` is installed.

.. versionadded:: 0.4

.. 2to3fixer:: int_long_tuple
.. fissix_fixer:: int_long_tuple

Changes ``(int, long)`` or ``(long, int)`` to :data:`six.integer_types`.

.. versionadded:: 0.4

.. 2to3fixer:: map
.. fissix_fixer:: map

If a call to :func:`map <python2:map>` is discovered, ``from six.moves import map`` is added to
the module. Wrapping the use in a call to ``list()`` is done when necessary.

.. 2to3fixer:: metaclass
.. fissix_fixer:: metaclass

Changes::

Expand All @@ -181,16 +181,16 @@ version of ``six`` is installed.
.. seealso::
:func:`six.with_metaclass`

.. 2to3fixer:: raise_six
.. fissix_fixer:: raise_six

Changes ``raise E, V, T`` to ``six.reraise(E, V, T)``.

.. 2to3fixer:: unicode_type
.. fissix_fixer:: unicode_type

Changes all reference of :func:`unicode <python2:unicode>` to
:data:`six.text_type`.

.. 2to3fixer:: urllib_six
.. fissix_fixer:: urllib_six

Changes::

Expand All @@ -202,12 +202,12 @@ version of ``six`` is installed.
from six.moves.urllib.parse import quote_plus
quote_plus('hello world')

.. 2to3fixer:: unichr
.. fissix_fixer:: unichr

Changes all reference of :func:`unichr <python2:unichr>` to
:data:`six.unichr`.

.. 2to3fixer:: xrange_six
.. fissix_fixer:: xrange_six

Changes::

Expand All @@ -223,70 +223,70 @@ version of ``six`` is installed.
Care is taken not to call ``list()`` when ``range()`` is used in an iterating
context.

.. 2to3fixer:: zip
.. fissix_fixer:: zip

If :func:`zip <python2:zip>` is called, ``from six.moves import zip`` is added to the module.
Wrapping the use in a call to ``list()`` is done when necessary.


``2to3`` fixers
``fissix`` fixers
+++++++++++++++

Some `fixers from fissix <https://docs.python.org/3/library/2to3.html#fixers>`_
in Python's standard library are run by default unmodified as their
transformations are Python 2 compatible.

- :2to3fixer:`apply <python:apply>`
- :2to3fixer:`except <python:except>`
- :2to3fixer:`exec <python:exec>`
- :2to3fixer:`execfile <python:execfile>`
- :2to3fixer:`exitfunc <python:exitfunc>`
- :2to3fixer:`funcattrs <python:funcattrs>`
- :2to3fixer:`has_key <python:has_key>`
- :2to3fixer:`idioms <python:idioms>`
- :2to3fixer:`long <python:long>`
- :2to3fixer:`methodattrs <python:methodattrs>`
- :2to3fixer:`ne <python:ne>`
- :2to3fixer:`numliterals <python:numliterals>`
- :2to3fixer:`operator <python:operator>`
- :2to3fixer:`paren <python:paren>`
- :2to3fixer:`reduce <python:reduce>`
- :2to3fixer:`repr <python:repr>`
- :2to3fixer:`set_literal <python:set_literal>`
- :2to3fixer:`standarderror <python:standarderror>`
- :2to3fixer:`sys_exc <python:sys_exc>`
- :2to3fixer:`throw <python:throw>`
- :2to3fixer:`tuple_params <python:tuple_params>`
- :2to3fixer:`types <python:types>`
- :2to3fixer:`ws_comma <python:ws_comma>`
- :2to3fixer:`xreadlines <python:xreadlines>`
- :fissix_fixer:`apply <python:apply>`
- :fissix_fixer:`except <python:except>`
- :fissix_fixer:`exec <python:exec>`
- :fissix_fixer:`execfile <python:execfile>`
- :fissix_fixer:`exitfunc <python:exitfunc>`
- :fissix_fixer:`funcattrs <python:funcattrs>`
- :fissix_fixer:`has_key <python:has_key>`
- :fissix_fixer:`idioms <python:idioms>`
- :fissix_fixer:`long <python:long>`
- :fissix_fixer:`methodattrs <python:methodattrs>`
- :fissix_fixer:`ne <python:ne>`
- :fissix_fixer:`numliterals <python:numliterals>`
- :fissix_fixer:`operator <python:operator>`
- :fissix_fixer:`paren <python:paren>`
- :fissix_fixer:`reduce <python:reduce>`
- :fissix_fixer:`repr <python:repr>`
- :fissix_fixer:`set_literal <python:set_literal>`
- :fissix_fixer:`standarderror <python:standarderror>`
- :fissix_fixer:`sys_exc <python:sys_exc>`
- :fissix_fixer:`throw <python:throw>`
- :fissix_fixer:`tuple_params <python:tuple_params>`
- :fissix_fixer:`types <python:types>`
- :fissix_fixer:`ws_comma <python:ws_comma>`
- :fissix_fixer:`xreadlines <python:xreadlines>`

Fixers with no dependencies
+++++++++++++++++++++++++++

.. 2to3fixer:: file
.. fissix_fixer:: file

Changes all calls to :func:`file <python2:file>` to :func:`open <python2:open>`.

.. versionadded:: 0.4

.. 2to3fixer:: import
.. fissix_fixer:: import

Changes implicit relative imports to explicit relative imports and adds
``from __future__ import absolute_import``.

.. versionadded:: 0.4

.. 2to3fixer:: next
.. fissix_fixer:: next

Changes all method calls from ``x.next()`` to ``next(x)``.

.. 2to3fixer:: print
.. fissix_fixer:: print

Changes all usage of the ``print`` statement to use the :func:`print` function
and adds ``from __future__ import print_function``.

.. 2to3fixer:: raise
.. fissix_fixer:: raise

Changes comma-based ``raise`` statements from::

Expand All @@ -307,7 +307,7 @@ to specify the ``-f default`` or ``--fix=default`` option, e.g.::

python -m modernize -f default -f libmodernize.fixes.fix_open

.. 2to3fixer:: classic_division
.. fissix_fixer:: classic_division

When a use of the division operator -- ``/`` -- is found, add
``from __future__ import division`` and change the operator to ``//``.
Expand All @@ -328,7 +328,7 @@ to specify the ``-f default`` or ``--fix=default`` option, e.g.::

.. versionadded:: 1.0

.. 2to3fixer:: open
.. fissix_fixer:: open

When a call to :func:`open <python2:open>` is discovered, add ``from io import open`` at the top
of the module so as to use :func:`io.open` instead. This fixer is opt-in because it
Expand Down
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ This library is a very thin wrapper around ``fissix`` to utilize it
to make Python 2 code more modern with the intention of eventually
porting it over to Python 3.

The ``python -m modernize`` command works like `2to3
<https://docs.python.org/3/library/2to3.html>`_. Here's how you'd rewrite a
The ``python -m modernize`` command works like `fissix
<https://github.com/jreese/fissix>`_. Here's how you'd rewrite a
single file::

python -m modernize -w example.py
Expand Down
2 changes: 1 addition & 1 deletion docs/sphinxext/extra_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


def setup(app):
app.add_description_unit("2to3fixer", "2to3fixer", "%s (2to3 fixer)")
app.add_description_unit("fissix_fixer", "fissix_fixer", "%s (fissix fixer)")
2 changes: 1 addition & 1 deletion libmodernize/fixes/fix_dict_six.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ def transform(self, node, results):

def in_special_context(self, node, isiter):
# Redefined from parent class to make "for x in d.items()" count as
# in special context; 2to3 only counts for loops as special context
# in special context; fissix only counts for loops as special context
# for the iter* methods.
return super().in_special_context(node, True)
2 changes: 1 addition & 1 deletion libmodernize/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def main(args=None):
action="store",
default=1,
type="int",
help="Run 2to3 concurrently.",
help="Run fissix concurrently.",
)
parser.add_option(
"-x",
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ author_email = armin.ronacher@active-4.com
maintainer = PyCQA
maintainer_email = code-quality@python.org
url = https://github.com/PyCQA/modernize
description = A hack on top of fissix (2to3 fork) for modernizing code for hybrid codebases.
description = A hack on top of fissix (lib2to3 fork) for modernizing code for hybrid codebases.
long_description = file: README.rst
classifiers =
License :: OSI Approved :: BSD License
Expand Down

0 comments on commit 0c893bc

Please sign in to comment.