Skip to content

Commit

Permalink
fix: fix string dump
Browse files Browse the repository at this point in the history
  • Loading branch information
yconst committed Dec 8, 2024
1 parent 76c651a commit 595e381
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions avlos/definitions/remote_attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

0 comments on commit 595e381

Please sign in to comment.