diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-04-21 20:25:35 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-04-21 20:25:35 -0700 |
commit | ee19043127784e579a45ceb2f02ff350ec8b6019 (patch) | |
tree | c5444ffc894d43d314ec2026ced8723c577ffc44 /numpy/compat/py3k.py | |
parent | 56e806abb78ac03a5f45090a3b9bf7a6c9964026 (diff) | |
parent | 211154eb336f5314b33e2486fa79953c90be8a11 (diff) | |
download | numpy-ee19043127784e579a45ceb2f02ff350ec8b6019.tar.gz |
Merge pull request #3257 from charris/2to3-apply-unicode-fixer
2to3: Apply unicode fixer.
Diffstat (limited to 'numpy/compat/py3k.py')
-rw-r--r-- | numpy/compat/py3k.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/numpy/compat/py3k.py b/numpy/compat/py3k.py index ce79edde8..e7ab9bf0f 100644 --- a/numpy/compat/py3k.py +++ b/numpy/compat/py3k.py @@ -6,7 +6,7 @@ from __future__ import division, absolute_import, print_function __all__ = ['bytes', 'asbytes', 'isfileobj', 'getexception', 'strchar', 'unicode', 'asunicode', 'asbytes_nested', 'asunicode_nested', - 'asstr', 'open_latin1', 'long', 'basestring'] + 'asstr', 'open_latin1', 'long', 'basestring', 'sixu'] import sys @@ -16,8 +16,8 @@ if sys.version_info[0] >= 3: long = int integer_types = (int,) basestring = str - bytes = bytes unicode = str + bytes = bytes def asunicode(s): if isinstance(s, bytes): @@ -40,14 +40,17 @@ if sys.version_info[0] >= 3: def open_latin1(filename, mode='r'): return open(filename, mode=mode, encoding='iso-8859-1') + def sixu(s): + return s + strchar = 'U' else: bytes = str - unicode = unicode long = long basestring = basestring + unicode = unicode integer_types = (int, long) asbytes = str asstr = str @@ -65,6 +68,9 @@ else: def open_latin1(filename, mode='r'): return open(filename, mode=mode) + def sixu(s): + return unicode(s, 'unicode_escape') + def getexception(): return sys.exc_info()[1] |