Skip to content

Commit f3b656a

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 9ae47a8 + af958fa commit f3b656a

File tree

14 files changed

+452
-360
lines changed

14 files changed

+452
-360
lines changed

CHANGELOG.rst

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,45 @@
1-
Unreleased
2-
==========
1+
Version 0.4
2+
===========
33

44
Changes since 0.3:
55

6+
* `Documentation`_ has been added.
7+
* All fixers are now idempotent, which allows modernize to safely be applied
8+
more than once to the same source code.
9+
* The option to include default fixers when ``-f`` options are used is now
10+
spelled ``-f default``, rather than ``-f all``.
11+
* Added a ``--version`` option to the modernize command.
12+
* Calls to ``zip``, ``map``, and ``filter`` are now wrapped with ``list()``
13+
in non-iterator contexts, to preserve Python 2 semantics.
14+
* Improved fixer for ``xrange`` using ``six.moves.range``.
15+
* Simplified use of ``six.with_metaclass`` for classes with more than
16+
one base class.
17+
* New fixer for imports of renamed standard library modules, using
18+
``six.moves``.
19+
* New fixer to add ``from __future__ import absolute_import`` to all
20+
files with imports, and change any implicit relative imports to explicit
21+
(see PEP 328).
22+
* New fixer for ``input()`` and ``raw_input()``, changed to ``eval(input())``
23+
and ``input()`` respectively.
24+
* New fixer for ``file()``, changed to ``open()``. There is also an
25+
opt-in fixer that changes both of these to ``io.open()``.
26+
* New fixer for ``(int, long)`` or ``(long, int)``, changed to
27+
``six.integer_types``. Other references to ``long`` are changed to ``int``.
28+
* New fixer for ``basestring``, changed to ``six.string_types``.
29+
* New fixer for ``unicode``, changed to ``six.text_type``.
30+
* The ``fix_next`` fixer uses the ``next()`` builtin rather than
31+
``six.advance_iterator``.
32+
* There is test coverage for all ``libmodernize`` fixers.
33+
* Simplified the implementation of many ``libmodernize`` fixers by extending
34+
similar fixers from ``lib2to3``.
35+
* Fixed a bug where ``fix_raise_six`` was adding an incorrect import
36+
statement.
637
* Support for targetting Python 2.5 or lower has been officially dropped.
738
(Previously some fixers did output constructs that were only added in
839
Python 2.6, such as the ``except ... as`` construct, but this was not
940
documented.)
10-
* The ``fix_next`` fixer uses the ``next()`` builtin rather than
11-
``six.advance_iterator``.
41+
42+
.. _Documentation: http://python-modernize.readthedocs.org/en/latest/
1243

1344

1445
Version 0.3

README.rst

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,15 @@ dependency on `six <https://pypi.python.org/pypi/six>`_, unless the
2222
recommended. Some of the fixers output code that is not compatible with
2323
Python 2.5 or lower.
2424

25+
**Documentation:** `python-modernize.rtfd.org
26+
<http://python-modernize.readthedocs.org/en/latest/>`_.
27+
2528
See the ``LICENSE`` file for the license of ``python-modernize``.
2629
Using this tool does not affect licensing of the modernized code.
2730

28-
29-
Unicode Literal Control:
30-
------------------------
31-
32-
- By default modernize does not change Unicode literals at all, which means that
33-
you can take advantage of `PEP 414 <http://legacy.python.org/dev/peps/pep-0414/>`_.
34-
This is the simplest option if you only want to support Python 3.3 and above
35-
along with Python 2.
36-
- Alternatively, there is the ``--six-unicode`` flag which will wrap Unicode
37-
literals with the six helper function ``six.u()``. This is useful if you want
38-
to support Python 3.1 and Python 3.2 without bigger changes.
39-
- The last alternative is the ``--future-unicode`` flag which
40-
imports the ``unicode_literals`` from the ``__future__`` module.
41-
This requires Python 2.6 and later, and will require that you
42-
mark bytestrings with ``b''`` and native strings in ``str('')``
43-
or something similar that survives the transformation.
44-
31+
.. image:: https://readthedocs.org/projects/python-modernize/badge/?version=latest
32+
:target: https://readthedocs.org/projects/python-modernize/?badge=latest
33+
:alt: Documentation Status
4534

4635
.. image:: https://travis-ci.org/python-modernize/python-modernize.svg?branch=master
4736
:target: https://travis-ci.org/python-modernize/python-modernize

docs/conf.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# If extensions (or modules to document with autodoc) are in another directory,
1919
# add these directories to sys.path here. If the directory is relative to the
2020
# documentation root, use os.path.abspath to make it absolute, like shown here.
21-
#sys.path.insert(0, os.path.abspath('.'))
21+
sys.path.insert(0, os.path.abspath('sphinxext'))
2222

2323
# -- General configuration ------------------------------------------------
2424

@@ -28,7 +28,7 @@
2828
# Add any Sphinx extension module names here, as strings. They can be
2929
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3030
# ones.
31-
extensions = []
31+
extensions = ['extra_types', 'sphinx.ext.intersphinx']
3232

3333
# Add any paths that contain templates here, relative to this directory.
3434
templates_path = ['_templates']
@@ -93,6 +93,10 @@
9393
# If true, keep warnings as "system message" paragraphs in the built documents.
9494
#keep_warnings = False
9595

96+
intersphinx_mapping = {'python': ('http://docs.python.org/3', None),
97+
'python2': ('http://docs.python.org/2', None),
98+
'six': ('http://pythonhosted.org/six/', None)}
99+
96100

97101
# -- Options for HTML output ----------------------------------------------
98102

0 commit comments

Comments
 (0)