From 046c52d41e5cd8074f6f9d5b505c22c1028daa1c Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Fri, 14 Feb 2025 12:18:31 +0200 Subject: [PATCH] Ensures that alpha symbols are always rendered to the right of the value. --- bittensor/utils/balance.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bittensor/utils/balance.py b/bittensor/utils/balance.py index 29ce2faeaa..33d56be13c 100644 --- a/bittensor/utils/balance.py +++ b/bittensor/utils/balance.py @@ -53,8 +53,13 @@ def __float__(self): return self.tao def __str__(self): - """Returns the Balance object as a string in the format "symbolvalue", where the value is in tao.""" - return f"{self.unit}{float(self.tao):,.9f}" + """ + Returns the Balance object as a string in the format "symbolvalue", where the value is in tao. + """ + if self.unit == units[0]: + return f"{self.unit}{float(self.tao):,.9f}" + else: + return f"\u200e{float(self.tao):,.9f}{self.unit}\u200e" def __rich__(self): int_tao, fract_tao = format(float(self.tao), "f").split(".")