зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1547730 - Don't try to py3-ize indented_repr yet. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D28103 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
c1cc1ca1dc
Коммит
865e39b01a
|
@ -1227,17 +1227,18 @@ def _escape_char(c):
|
|||
return six.text_type(c.encode('unicode_escape'))
|
||||
|
||||
|
||||
# Mapping table between raw characters below \x80 and their escaped
|
||||
# counterpart, when they differ
|
||||
_INDENTED_REPR_TABLE = {
|
||||
c: e
|
||||
for c, e in map(lambda x: (x, _escape_char(x)),
|
||||
map(unichr, range(128)))
|
||||
if c != e
|
||||
}
|
||||
# Regexp matching all characters to escape.
|
||||
_INDENTED_REPR_RE = re.compile(
|
||||
'([' + ''.join(_INDENTED_REPR_TABLE.values()) + ']+)')
|
||||
if six.PY2: # Not supported for py3 yet
|
||||
# Mapping table between raw characters below \x80 and their escaped
|
||||
# counterpart, when they differ
|
||||
_INDENTED_REPR_TABLE = {
|
||||
c: e
|
||||
for c, e in map(lambda x: (x, _escape_char(x)),
|
||||
map(unichr, range(128)))
|
||||
if c != e
|
||||
}
|
||||
# Regexp matching all characters to escape.
|
||||
_INDENTED_REPR_RE = re.compile(
|
||||
'([' + ''.join(_INDENTED_REPR_TABLE.values()) + ']+)')
|
||||
|
||||
|
||||
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
|
||||
assumes `from __future__ import unicode_literals`.
|
||||
'''
|
||||
if six.PY3:
|
||||
raise NotImplementedError("indented_repr is not yet supported on py3")
|
||||
one_indent = ' ' * indent
|
||||
|
||||
def recurse_indented_repr(o, level):
|
||||
|
|
Загрузка…
Ссылка в новой задаче