Use reprlib

This commit is contained in:
Alex Hall 2019-04-28 11:34:53 +02:00 committed by Ram Rachum
parent fbc3f98aa1
commit 7de345f5cc

View file

@ -6,6 +6,10 @@ import re
import collections
import datetime as datetime_module
import itertools
try:
import repr as reprlib
except ImportError:
import reprlib
from .third_party import six
@ -15,7 +19,7 @@ ipython_filename_pattern = re.compile('^<ipython-input-([0-9]+)-.*>$')
def get_shortish_repr(item):
try:
r = repr(item)
r = reprlib.repr(item)
except Exception:
r = 'REPR FAILED'
r = r.replace('\r', '').replace('\n', '')