saferepr: Remove dead SafeRepr.repr_unicode

This function is not called anywhere directly, and cannot be called by
the dynamic `repr_<type>()` dispatch mechanism because unicode is no
longer a type in Python 3.
This commit is contained in:
Ran Benita 2019-07-14 21:42:53 +03:00
parent 0f8b462677
commit 0225be53a2
1 changed files with 0 additions and 18 deletions

View File

@ -25,24 +25,6 @@ class SafeRepr(reprlib.Repr):
def repr(self, x):
return self._callhelper(reprlib.Repr.repr, self, x)
def repr_unicode(self, x, level):
# Strictly speaking wrong on narrow builds
def repr(u):
if "'" not in u:
return "'%s'" % u
elif '"' not in u:
return '"%s"' % u
else:
return "'%s'" % u.replace("'", r"\'")
s = repr(x[: self.maxstring])
if len(s) > self.maxstring:
i = max(0, (self.maxstring - 3) // 2)
j = max(0, self.maxstring - 3 - i)
s = repr(x[:i] + x[len(x) - j :])
s = s[:i] + "..." + s[len(s) - j :]
return s
def repr_instance(self, x, level):
return self._callhelper(repr, x)