refactor: Manually improve f-string formatting
This commit is contained in:
parent
4e6361429e
commit
6f613b17c7
|
@ -475,9 +475,9 @@ class NamedInts:
|
||||||
raise TypeError("name must be a string")
|
raise TypeError("name must be a string")
|
||||||
|
|
||||||
if str(value) in self.__dict__:
|
if str(value) in self.__dict__:
|
||||||
raise ValueError(f"{value} ({int(int(value))}) already known")
|
raise ValueError(f"{value} ({int(value)}) already known")
|
||||||
if int(value) in self._indexed:
|
if int(value) in self._indexed:
|
||||||
raise ValueError(f"{int(int(value))} ({value}) already known")
|
raise ValueError(f"{int(value)} ({value}) already known")
|
||||||
|
|
||||||
self._values.append(value)
|
self._values.append(value)
|
||||||
self._is_sorted = False
|
self._is_sorted = False
|
||||||
|
|
|
@ -773,7 +773,10 @@ class DpiSlidingXY(_RawXYProcessing):
|
||||||
|
|
||||||
def displayNewDpi(self, newDpiIdx):
|
def displayNewDpi(self, newDpiIdx):
|
||||||
if _notify.available:
|
if _notify.available:
|
||||||
reason = f"DPI {int(self.dpiChoices[newDpiIdx])} [min {int(self.dpiChoices[0])}, max {int(self.dpiChoices[-1])}]"
|
selected_dpi = self.dpiChoices[newDpiIdx]
|
||||||
|
min_dpi = self.dpiChoices[0]
|
||||||
|
max_dpi = self.dpiChoices[-1]
|
||||||
|
reason = f"DPI {selected_dpi} [min {min_dpi}, max {max_dpi}]"
|
||||||
_notify.show(self.device, reason)
|
_notify.show(self.device, reason)
|
||||||
|
|
||||||
def press_action(self, key): # start tracking
|
def press_action(self, key): # start tracking
|
||||||
|
|
|
@ -64,7 +64,7 @@ def _print_receiver(receiver):
|
||||||
print(" Device activity counters:", activity_text or "(empty)")
|
print(" Device activity counters:", activity_text or "(empty)")
|
||||||
|
|
||||||
|
|
||||||
def _battery_text(level):
|
def _battery_text(level) -> str:
|
||||||
if level is None:
|
if level is None:
|
||||||
return "N/A"
|
return "N/A"
|
||||||
elif isinstance(level, _NamedInt):
|
elif isinstance(level, _NamedInt):
|
||||||
|
|
Loading…
Reference in New Issue