selectable_int: make SelectableInt.__repr__ more flexible
authorDmitry Selyutin <dmitry.selyutin@3mdeb.com>
Tue, 19 Apr 2022 12:47:24 +0000 (12:47 +0000)
committerDmitry Selyutin <dmitry.selyutin@3mdeb.com>
Tue, 19 Apr 2022 12:47:24 +0000 (12:47 +0000)
src/openpower/decoder/selectable_int.py

index c5e48f9fde86cca66782e3240677cc049ad57b7d..9e1495d5a0fe5369a60ca185c7cc26012710bc57 100644 (file)
@@ -420,8 +420,8 @@ class SelectableInt:
         return self.value != 0
 
     def __repr__(self):
-        return "SelectableInt(value=0x{:x}, bits={})".format(self.value,
-                                                             self.bits)
+        value = f"value=0x{self.value:x}, bits={self.bits}"
+        return f"{self.__class__.__name__}({value})"
 
     def __len__(self):
         return self.bits