From ba3d76078aa88c7d1bb730c251dc36e29e94065b Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Sat, 12 Oct 2024 20:50:22 +0700 Subject: [PATCH] #4378 don't quote strings if we don't have to --- xpra/client/base/command.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xpra/client/base/command.py b/xpra/client/base/command.py index 6e38fe9c71..0851e3e99e 100644 --- a/xpra/client/base/command.py +++ b/xpra/client/base/command.py @@ -228,7 +228,9 @@ def prettify(k, v): if len(eltypes) == 1 and tuple(eltypes)[0] in (int, bool, float): return str(v) return type(v)(prettify(k, x) for x in v) - return v + elif isinstance(v, str) and v.isprintable(): + return v + return repr(v) def print_dict(d: dict, path=""): for k in sorted_nicely(d.keys()): @@ -238,8 +240,8 @@ def print_dict(d: dict, path=""): if isinstance(v, dict): print_dict(v, kpath) continue - fv = str(prettify(k, v)) - print_fn(f"{kpath}={repr(fv)}") + fv = prettify(k, v) + print_fn(f"{kpath}={fv}") exit_code = ExitCode.OK try: