[Numpy-svn] [numpy/numpy] 3a5c54: 2to3: Apply unicode fixer.

GitHub noreply at github.com
Sun Apr 21 23:25:37 EDT 2013


  Branch: refs/heads/master
  Home:   https://github.com/numpy/numpy
  Commit: 3a5c5475b5c2043dbe6791d3a5100a45d491546e
      https://github.com/numpy/numpy/commit/3a5c5475b5c2043dbe6791d3a5100a45d491546e
  Author: Charles Harris <charlesr.harris at gmail.com>
  Date:   2013-04-21 (Sun, 21 Apr 2013)

  Changed paths:
    M doc/sphinxext/numpydoc/docscrape_sphinx.py
    M doc/sphinxext/numpydoc/numpydoc.py
    M doc/sphinxext/numpydoc/tests/test_docscrape.py
    M numpy/__init__.py
    M numpy/compat/py3k.py
    M numpy/core/numerictypes.py
    M numpy/core/tests/test_arrayprint.py
    M numpy/core/tests/test_defchararray.py
    M numpy/core/tests/test_multiarray.py
    M numpy/core/tests/test_nditer.py
    M numpy/core/tests/test_regression.py
    M numpy/core/tests/test_unicode.py
    M numpy/lib/_iotools.py
    M numpy/lib/npyio.py
    M numpy/lib/tests/test_regression.py
    M numpy/ma/tests/test_regression.py
    M tools/py3tool.py

  Log Message:
  -----------
  2to3: Apply unicode fixer.

The unicode fixer strips the u from u'hi' and converts the unicode type
to str. The first won't work for Python 2 and instead we replace the u
prefix with the sixu function borrowed from the six compatibility
package. That function calls the unicode constructor with the
'unicode_escape' encoder so that the many tests using escaped unicode
characters like u'\u0900' will be handled correctly. That makes the
sixu function a bit different from the asunicode function currently in
numpy.compat and also provides a target that can be converted back to
the u prefix when support for Python 3.2 is dropped. Python 3.3
reintroduced the u prefix for compatibility.

The unicode fixer also replaces 'unicode' with 'str' as 'unicode' is no
longer a builtin in Python 3. For code compatibility, 'unicode' is
defined either as 'str' or 'unicode' in numpy.compat so that checks like

    if isinstance(x, unicode):
  ...

will work properly for all python versions.

Closes #3089.


  Commit: 211154eb336f5314b33e2486fa79953c90be8a11
      https://github.com/numpy/numpy/commit/211154eb336f5314b33e2486fa79953c90be8a11
  Author: Charles Harris <charlesr.harris at gmail.com>
  Date:   2013-04-21 (Sun, 21 Apr 2013)

  Changed paths:
    M doc/sphinxext/numpydoc/docscrape_sphinx.py

  Log Message:
  -----------
  BUG: Fix typo in docscrape_sphinx.py import.


  Commit: ee19043127784e579a45ceb2f02ff350ec8b6019
      https://github.com/numpy/numpy/commit/ee19043127784e579a45ceb2f02ff350ec8b6019
  Author: Charles Harris <charlesr.harris at gmail.com>
  Date:   2013-04-21 (Sun, 21 Apr 2013)

  Changed paths:
    M doc/sphinxext/numpydoc/docscrape_sphinx.py
    M doc/sphinxext/numpydoc/numpydoc.py
    M doc/sphinxext/numpydoc/tests/test_docscrape.py
    M numpy/__init__.py
    M numpy/compat/py3k.py
    M numpy/core/numerictypes.py
    M numpy/core/tests/test_arrayprint.py
    M numpy/core/tests/test_defchararray.py
    M numpy/core/tests/test_multiarray.py
    M numpy/core/tests/test_nditer.py
    M numpy/core/tests/test_regression.py
    M numpy/core/tests/test_unicode.py
    M numpy/lib/_iotools.py
    M numpy/lib/npyio.py
    M numpy/lib/tests/test_regression.py
    M numpy/ma/tests/test_regression.py
    M tools/py3tool.py

  Log Message:
  -----------
  Merge pull request #3257 from charris/2to3-apply-unicode-fixer

2to3: Apply unicode fixer.


Compare: https://github.com/numpy/numpy/compare/56e806abb78a...ee1904312778


More information about the Numpy-svn mailing list