From 595e38194afadf6efd02096118bea0f628876fb6 Mon Sep 17 00:00:00 2001 From: Yannis Chatzikonstantinou Date: Sun, 8 Dec 2024 02:42:31 +0200 Subject: [PATCH] fix: fix string dump --- avlos/definitions/remote_attribute.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/avlos/definitions/remote_attribute.py b/avlos/definitions/remote_attribute.py index 37204d2..e56a26f 100644 --- a/avlos/definitions/remote_attribute.py +++ b/avlos/definitions/remote_attribute.py @@ -58,9 +58,14 @@ def set_value(self, __value): def set_value_with_string(self, __str_value): self.set_value(get_registry()(__str_value)) - def str_dump(self): - return "{0} [{1}]: {2:.6g}".format( - self.name, - self.dtype.nickname, - self.get_value(), - ) + def str_dump(self): + value = self.get_value() + if isinstance(value, (int, float)): + format_str = "{0} [{1}]: {2:.6g}" + else: + format_str = "{0} [{1}]: {2}" + return format_str.format( + self.name, + self.dtype.nickname, + value + )