MutaFix run: more-itertools-011

ranker nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B · patcher nvidia/nemotron-3-super-120b-a12b · via Nebius Token Factory

fixedoutcome
38swall time
2model calls
$0.0006API cost
Benchmark ground truth (hidden from the agent)
more_itertools/more.py:4853 · operator NEGCOND · function more_itertools/more.py::classify_unique
- if not (k not in seen_list):   (injected bug)+ if k not in seen_list:   (original)
retriever rank 1 of 20 · ranker position 1 · patched the right function yes · exact restore yes

Trace

reproduce
+12.6s
4 failing test(s) · 4 failed, 764 passed · 12.6s
failing tests and errors
tests/test_more.py::ClassifyUniqueTests::test_key_non_hashable
tests/test_more.py::ClassifyUniqueTests::test_key_partially_hashable
tests/test_more.py::ClassifyUniqueTests::test_non_hashable
tests/test_more.py::ClassifyUniqueTests::test_partially_hashable
tests/test_more.py::ClassifyUniqueTests::test_key_non_hashable
E   AssertionError: Lists differ: [([1, 2], True, False), ([3, 0], True, False), ([5, -2], [54 chars]lse)] != [([1, 2], True, True), ([3, 0], True, True), ([5, -2], Tr[50 chars]lse)]
E   
E   First differing element 0:
E   ([1, 2], True, False)
E   ([1, 2], True, True)
E   
E   - [([1, 2], True, False),
E   ?                 ^^^^
E   
E   + [([1, 2], True, True),
E   ?                 ^^^
E   
E   -  ([3, 0], True, False),
E   ?                 ^^^^
E   
tests/test_more.py::ClassifyUniqueTests::test_key_partially_hashable
E   AssertionError: Lists differ: [([1, 2], True, False), ((1, 2), True, True), ([1, 2], Tr[52 chars]lse)] != [([1, 2], True, True), ((1, 2), True, True), ([1, 2], Tru[50 chars]lse)]
E   
E   First differing element 0:
E   ([1, 2], True, False)
E   ([1, 2], True, True)
E   
E   - [([1, 2], True, False),
E   ?                 ^^^^
E   
E   + [([1, 2], True, True),
E   ?                 ^^^
E   
E      ((1, 2), True, True),
E      ([1, 2], True, False),
E   -  ([5, 6], True, False),
trace
+18.75s
re-ran 1 test file(s) with the trace plugin: 4 failing and 616 passing tests, 1 library functions ran in a failing test · 6.06s
tests/test_more.py
retrieve
+18.75s
280 functions indexed, 1 reachable from tests/test_more.py::ClassifyUniqueTests::test_key_non_hashable in the static call graph. Kept 20 candidates, ranked by spectrum score (Ochiai), call graph and BM25 break ties.
candidates in retriever order
  1. more_itertools/more.py::classify_unique call depth 1 · Ochiai 0.54 (failing 4, passing 10)
  2. more_itertools/more.py::all_unique call depth - · Ochiai 0.00 (failing 0, passing 5)
  3. more_itertools/recipes.py::unique_everseen call depth - · Ochiai 0.00 (failing 0, passing 5)
  4. more_itertools/more.py::is_sorted call depth - · Ochiai 0.00 (failing 0, passing 1)
  5. more_itertools/recipes.py::unique call depth - · Ochiai 0.00 (failing 0, passing 0)
  6. more_itertools/more.py::duplicates_everseen call depth - · Ochiai 0.00 (failing 0, passing 8)
  7. more_itertools/more.py::unique_in_window call depth - · Ochiai 0.00 (failing 0, passing 3)
  8. more_itertools/more.py::distinct_combinations call depth - · Ochiai 0.00 (failing 0, passing 3)
  9. more_itertools/more.py::combination_with_replacement_index call depth - · Ochiai 0.00 (failing 0, passing 10)
  10. more_itertools/recipes.py::all_equal call depth - · Ochiai 0.00 (failing 0, passing 12)
  11. more_itertools/more.py::substrings call depth - · Ochiai 0.00 (failing 0, passing 4)
  12. more_itertools/more.py::unique_to_each call depth - · Ochiai 0.00 (failing 0, passing 3)
  13. more_itertools/more.py::duplicates_justseen call depth - · Ochiai 0.00 (failing 0, passing 9)
  14. more_itertools/recipes.py::unique_justseen call depth - · Ochiai 0.00 (failing 0, passing 3)
  15. more_itertools/recipes.py::iter_except call depth - · Ochiai 0.00 (failing 0, passing 0)
  16. more_itertools/more.py::chunked_even call depth - · Ochiai 0.00 (failing 0, passing 8)
  17. more_itertools/more.py::join_mappings call depth - · Ochiai 0.00 (failing 0, passing 2)
  18. more_itertools/more.py::_sample_weighted call depth - · Ochiai 0.00 (failing 0, passing 5)
  19. more_itertools/more.py::combination_index call depth - · Ochiai 0.00 (failing 0, passing 8)
  20. more_itertools/more.py::permutation_index call depth - · Ochiai 0.00 (failing 0, passing 7)
rank
+18.75s
spectrum order kept (no model call)
  1. more_itertools/more.py::classify_unique
  2. more_itertools/more.py::all_unique
  3. more_itertools/recipes.py::unique_everseen
  4. more_itertools/more.py::is_sorted
  5. more_itertools/recipes.py::unique
read
+21.25s
turn 1 · NVIDIA-Nemotron-3-Nano-30B-A3B · 4188 in / 90 out · 2.48s · $0.00027

read more_itertools/more.py::classify_unique

The failing tests indicate that the third tuple element (is_unique_everseen) is incorrectly reported as False when it should be True for first occurrences. The classify_unique function's logic for tracking ever-unique elements appears to have a bug in the exception handling path where it uses seen_list instead of properly initializing is_unique_everseen.

patch
+37.93s
turn 2 · NVIDIA-Nemotron-3-Nano-30B-A3B · 4934 in / 277 out · 4.02s · $0.00036

The bug is in the exception handler condition. The original code uses `if not (k not in seen_list)` which incorrectly sets is_unique_everseen = True only when k IS in seen_list (i.e., when it's a duplicate). This causes first occurrences of unhashable items to be marked as not ever-unique. The fix removes the `not` so that is_unique_everseen = True when k is NOT in seen_list (i.e., when it's a new element).

--- a/more_itertools/more.py+++ b/more_itertools/more.py@@ -4851,5 +4851,5 @@                 is_unique_everseen = True         except TypeError:-            if not (k not in seen_list):+            if k not in seen_list:                 seen_list.append(k)                 is_unique_everseen = True

tests: all tests pass 768 passed

Final patch

--- a/more_itertools/more.py+++ b/more_itertools/more.py@@ -4851,5 +4851,5 @@                 is_unique_everseen = True         except TypeError:-            if not (k not in seen_list):+            if k not in seen_list:                 seen_list.append(k)                 is_unique_everseen = True