From 97d56cea64aad46d2fc236adc5c7db79bb41a148 Mon Sep 17 00:00:00 2001 From: elhoim Date: Mon, 31 Aug 2026 00:02:33 +0000 Subject: [PATCH] Remove dead sort in guess_attribute_types The initial 'sorted()' call over best.items() was immediately overwritten by 'ranked.sort()' with a finer-grained key (which also considers supported_input_types). Since the second sort is a total order, the first sort's result never survives - it was pure wasted work. Fixed by sorting once with the final key. --- bin/cli.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bin/cli.py b/bin/cli.py index 92267b1..f721c1d 100644 --- a/bin/cli.py +++ b/bin/cli.py @@ -302,11 +302,9 @@ def add(t: str, reason: str, score: int) -> None: ranked = sorted( [(t, reason, score) for t, (reason, score) in best.items()], - key=lambda x: (-x[2], x[0]) + key=lambda x: (x[0] not in supported_input_types, -x[2], x[0]) ) - ranked.sort(key=lambda x: (x[0] not in supported_input_types, -x[2], x[0])) - return [(t, reason) for t, reason, _score in ranked]