Skip to content

Commit 694cea5

Browse files
committed
Set txt = stnum to prevent unbound variable instead
1 parent 72cb5f2 commit 694cea5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

adafruit_ht16k33/segments.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,13 +289,13 @@ def _number(self, number: float, decimal: int = 0) -> str:
289289
places += 1
290290

291291
# Set decimal places, if number of decimal places is specified (decimal > 0)
292-
txt = None
292+
txt = stnum
293293
if places > 0 < decimal < len(stnum[places:]) and dot > 0:
294294
txt = stnum[: dot + decimal + 1]
295295
elif places > 0:
296296
txt = stnum[:places]
297297

298-
if txt is None or len(txt) > self._chars + 1:
298+
if len(txt) > self._chars + 1:
299299
self._auto_write = auto_write
300300
raise ValueError("Output string ('{0}') is too long!".format(txt))
301301

0 commit comments

Comments
 (0)