From 225e377130aebe785a871c849443a3a2742c6621 Mon Sep 17 00:00:00 2001 From: udf Date: Sat, 3 Nov 2018 04:58:51 +0200 Subject: [PATCH] truncate really long byte sequences --- stdplugins/info.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stdplugins/info.py b/stdplugins/info.py index 02816b5..e039abf 100644 --- a/stdplugins/info.py +++ b/stdplugins/info.py @@ -63,7 +63,10 @@ def yaml_format(obj, indent=0): if all(c in PRINTABLE_SET for c in obj): result.append(repr(obj)) else: - result.append(' '.join(f'{b:02X}' for b in obj)) + if len(obj) > 64: + result.append('<…>') + else: + result.append(' '.join(f'{b:02X}' for b in obj)) elif isinstance(obj, datetime.datetime): # ISO-8601 without timezone offset (telethon dates are always UTC) result.append(obj.strftime('%Y-%m-%d %H:%M:%S'))