nicer symbol for cut parts

This commit is contained in:
2021-10-24 12:43:25 +02:00
parent 597dfca483
commit 2c8bae6fe1

View File

@ -11,7 +11,9 @@ FOOTER = '</td></tr></table></div>'
SEP = '</td></tr><tr><td>'
LINE = '{0}</td><td>{1}</td><td>{2}</td><td>{3}'
IGNORE = ["In", "Out", "exit", "quit", "get_ipython"]
IGNORE = ("In", "Out", "exit", "quit", "get_ipython")
SNIP = " ...✀... "
RE_DIGITS = re.compile("([0-9]+)")
@ -105,11 +107,11 @@ def format_value(obj): #TODO: make magic numbers configurable
# try if separate lines can be used to shorten
splitted = res.split("\n")
if len(splitted) > 4:
res = splitted[0] + " ... " + splitted[-1]
res = splitted[0] + SNIP + splitted[-1]
# if still too long (or no lines), cut the middle part
if len(res) < 120:
return res
res = res[:50] + " ... " + res[-50:]
res = res[:50] + SNIP + res[-50:]
return res
def format_type(obj):