From 2c8bae6fe1946629a919a92d90ea33ac2c9087b2 Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Sun, 24 Oct 2021 12:43:25 +0200 Subject: [PATCH] nicer symbol for cut parts --- inspector.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/inspector.py b/inspector.py index 4c6e970..6074c9d 100644 --- a/inspector.py +++ b/inspector.py @@ -11,7 +11,9 @@ FOOTER = '' SEP = '' LINE = '{0}{1}{2}{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):