From 0f6ec041eb1865b00df392eb40c208d4337f2a4e Mon Sep 17 00:00:00 2001 From: Blai Peidro Date: Mon, 14 Sep 2026 00:05:16 +0200 Subject: [PATCH] refactor: drop the dead initialiser in gen_utf_char `b = 'b'` is never read. `is_char` starts False, so the loop below always runs at least once and rebinds `b` to the integer `chr()` is given, on every path that reaches the return. It was not harmless. It is the only reason the type checker believed `chr()` could be handed a string, reporting `Expected SupportsIndex, found Literal["b"] | int` for a call that cannot receive one. Behaviour is unchanged: 2000 draws still return a single printable character in the range the randint call specifies. --- ascenderkit/utils/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ascenderkit/utils/__init__.py b/ascenderkit/utils/__init__.py index a603372..21203da 100644 --- a/ascenderkit/utils/__init__.py +++ b/ascenderkit/utils/__init__.py @@ -231,7 +231,6 @@ def poll_until(function, interval=5, timeout=0): def gen_utf_char(): is_char = False - b = 'b' while not is_char: b = random.randint(32, 0x10FFFF) is_char = chr(b).isprintable()