зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1547730 - Don't try to py3-ize indented_repr yet. r=#build
Differential Revision: https://phabricator.services.mozilla.com/D28103 --HG-- extra : rebase_source : 24becfbcc9f81dbe69dda1d70323cdda7cfb14b6 extra : intermediate-source : c5a11615d8c9fcc88ce13af85c744a1a8a615f03 extra : source : 66be9d18d40334332e8f6a45798701e440bc6b0a
This commit is contained in:
Родитель
8d0a1c56b3
Коммит
588f2cd51c
|
@ -1227,17 +1227,18 @@ def _escape_char(c):
|
||||||
return six.text_type(c.encode('unicode_escape'))
|
return six.text_type(c.encode('unicode_escape'))
|
||||||
|
|
||||||
|
|
||||||
# Mapping table between raw characters below \x80 and their escaped
|
if six.PY2: # Not supported for py3 yet
|
||||||
# counterpart, when they differ
|
# Mapping table between raw characters below \x80 and their escaped
|
||||||
_INDENTED_REPR_TABLE = {
|
# counterpart, when they differ
|
||||||
c: e
|
_INDENTED_REPR_TABLE = {
|
||||||
for c, e in map(lambda x: (x, _escape_char(x)),
|
c: e
|
||||||
map(unichr, range(128)))
|
for c, e in map(lambda x: (x, _escape_char(x)),
|
||||||
if c != e
|
map(unichr, range(128)))
|
||||||
}
|
if c != e
|
||||||
# Regexp matching all characters to escape.
|
}
|
||||||
_INDENTED_REPR_RE = re.compile(
|
# Regexp matching all characters to escape.
|
||||||
'([' + ''.join(_INDENTED_REPR_TABLE.values()) + ']+)')
|
_INDENTED_REPR_RE = re.compile(
|
||||||
|
'([' + ''.join(_INDENTED_REPR_TABLE.values()) + ']+)')
|
||||||
|
|
||||||
|
|
||||||
def indented_repr(o, indent=4):
|
def indented_repr(o, indent=4):
|
||||||
|
@ -1246,6 +1247,8 @@ def indented_repr(o, indent=4):
|
||||||
One notable difference with repr is that the returned representation
|
One notable difference with repr is that the returned representation
|
||||||
assumes `from __future__ import unicode_literals`.
|
assumes `from __future__ import unicode_literals`.
|
||||||
'''
|
'''
|
||||||
|
if six.PY3:
|
||||||
|
raise NotImplementedError("indented_repr is not yet supported on py3")
|
||||||
one_indent = ' ' * indent
|
one_indent = ' ' * indent
|
||||||
|
|
||||||
def recurse_indented_repr(o, level):
|
def recurse_indented_repr(o, level):
|
||||||
|
|
Загрузка…
Ссылка в новой задаче