diff --git "a/data/tasks.jsonl" "b/data/tasks.jsonl" new file mode 100644--- /dev/null +++ "b/data/tasks.jsonl" @@ -0,0 +1,100 @@ +{"task_id": "swe-next-10b016d0ada18d073879", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:418c2edc0c9b768b36d361d12cb9e9be37477740ca1a91ba2fb5b5e447dc55d2", "task_path": "tasks/swe-next-10b016d0ada18d073879", "instruction": "## `more_itertools.pairwise` missing from public API\n\nAfter upgrading to `more_itertools` 11.0.0, calling `mi.pairwise(...)` raises an `AttributeError` because the function was removed from the `more_itertools` namespace.\n\n### Reproduction\n\n```python\nimport more_itertools as mi\nfrom statistics import mean\n\ndata = list(range(10))\nresult = list(map(mean, mi.pairwise(data)))\nprint(result)\n```\n\nThis raises:\n\n```\nAttributeError: module 'more_itertools' has no attribute 'pairwise'\n```\n\nA more concrete example from the running median use-case:\n\n```python\nimport more_itertools as mi\nfrom statistics import mean\nfrom itertools import islice\n\ndata = list(range(1, 11))\n# Window size of 2 should be equivalent to a moving average of consecutive pairs\nexpected = list(map(mean, mi.pairwise(data)))\nactual = list(islice(mi.running_median(data, maxlen=2), 1, None))\nprint(expected) # AttributeError raised here\n```\n\n### Expected behavior\n\n`mi.pairwise` should be accessible as part of the `more_itertools` public API (ideally as a deprecated wrapper around `itertools.pairwise`). The call above should return `[(1, 2), (2, 3), ...]` pairs and the mean computation should succeed.\n\n### Actual behavior\n\n```\nAttributeError: module 'more_itertools' has no attribute 'pairwise'\n```\n\n`pairwise` was dropped from `more_itertools.__all__` and is no longer exported, breaking any code that relied on `mi.pairwise`.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `more_itertools`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Independent standalone pair not established by this audit; retained or recipe-native evidence is separate\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": null, \"retained\": true}", "diagnostics": []} +{"task_id": "swe-next-153a33e0c1f8b53360e1", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:2c969cd6fa9dc4cabd44ef8d7d04f95105bad4aa74c1cdc736d09c98bfe59605", "task_path": "tasks/swe-next-153a33e0c1f8b53360e1", "instruction": "## `iter_index` raises `ValueError` with negative `start`/`stop` for general iterables\n\n### Description\n\n`iter_index` has two internal code paths: a fast path for objects that have an `.index` method (like `str` and `list`), and a slow path for general iterables that uses `islice`. The fast path handles negative `start`/`stop` correctly with from-the-end semantics, but the slow path passes negative values directly to `islice()`, which does not accept them.\n\nThis means the behavior of `iter_index` is inconsistent depending on whether you pass a sequence or a general iterable:\n\n```python\nfrom more_itertools import iter_index\n\niterable = 'AABCADEAF' # 'A' at indices 0, 1, 4, 7\n\n# Fast path (str has .index) — works fine\nprint(list(iter_index(iterable, 'A', start=-3))) # [7]\nprint(list(iter_index(list(iterable), 'A', start=-3))) # [7]\n\n# Slow path (general iterable) — crashes\nprint(list(iter_index(iter(iterable), 'A', start=-3))) # ValueError!\n```\n\nThe error thrown on the slow path:\n\n```\nValueError: Indices for islice() must be None or an integer: 0 <= x <= sys.maxsize.\n```\n\nThis affects all combinations of negative `start` and/or `stop`:\n\n```python\nfor wrapper in (list, iter):\n for kwargs in [\n {'start': -3},\n {'start': -9},\n {'stop': -2},\n {'start': -5, 'stop': -1},\n ]:\n result = list(iter_index(wrapper('AABCADEAF'), 'A', **kwargs))\n # Should produce the same result for both list and iter wrappers\n```\n\nWhen `wrapper=iter`, all four cases above raise `ValueError` instead of returning the expected list of indices.\n\n### Expected behavior\n\nNegative `start` and `stop` should work the same way for general iterables as they do for sequences, using from-the-end semantics. For example:\n- `iter_index(iter('AABCADEAF'), 'A', start=-3)` should return `[7]`\n- `iter_index(iter('AABCADEAF'), 'A', stop=-2)` should return `[0, 1, 4]`\n- `iter_index(iter('AABCADEAF'), 'A', start=-5, stop=-1)` should return `[4, 7]`\n\n### Actual behavior\n\nAll of the above raise:\n```\nValueError: Indices for islice() must be None or an integer: 0 <= x <= sys.maxsize.\n```\n\n### Fix\n\nWhen `start` or `stop` is negative on the slow path (general iterable without `.index`), materialize the iterable into a tuple and use its `.index` method, so both paths agree on from-the-end semantics. The common non-negative slow path should remain fully lazy and untouched.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `more_itertools`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Independent standalone pair not established by this audit; retained or recipe-native evidence is separate\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": null, \"retained\": true}", "diagnostics": []} +{"task_id": "swe-next-35c6db5532547741de60", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:d52da84663409ceb3294703848ae96222cd0a5e0638a346a0d777ae2f1f6f68c", "task_path": "tasks/swe-next-35c6db5532547741de60", "instruction": "## `value_chain` silently swallows `TypeError` raised during iteration\n\nWhen an iterable passed to `value_chain` raises `TypeError` partway through iteration, the error is swallowed instead of propagating to the caller. The partially-consumed iterator is then emitted as a scalar value, which is both surprising and data-lossy.\n\n### Reproducer\n\n```python\nimport more_itertools as mi\n\ndef gen():\n yield 1\n yield 2\n raise TypeError('failure inside the iterable')\n\nresult = list(mi.value_chain(map(len, ['ab', 'cde', 5])))\nprint(result)\n# Expected: TypeError to propagate\n# Actual: [2, 3, ]\n```\n\nThe `TypeError: object of type 'int' has no len()` is never raised; instead the exhausted map object itself is appended to the output.\n\nA more minimal example showing the same issue:\n\n```python\nit = mi.value_chain(gen(), 3)\nnext(it) # returns 1\nnext(it) # returns 2\nnext(it) # should raise TypeError, but doesn't\n```\n\nOn the third `next()` call, the `TypeError` raised inside `gen()` is silently caught and the generator object is yielded as a scalar item rather than letting the error propagate.\n\n### Root cause\n\nThe current implementation wraps `yield from value` inside a `try/except TypeError`. Because `yield from` is lazy, the `except` clause stays active for the entire duration of consuming the argument — not just during the initial check of whether the argument is iterable. Any `TypeError` raised from *within* the iterable (e.g., from a buggy mapping function or a generator that raises) gets caught and misclassified as \"this value is not iterable\".\n\n### Expected behavior\n\nA `TypeError` raised **during iteration** of an argument should propagate to the caller, just as it would with `itertools.chain` or `always_iterable`. Only a `TypeError` raised when first trying to iterate the argument (i.e., it is not iterable at all) should cause the argument to be emitted as a scalar.\n\nArguments that cannot be iterated at all should still be emitted as-is — that documented behavior should remain unchanged.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `more_itertools`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Independent standalone pair not established by this audit; retained or recipe-native evidence is separate\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": null, \"retained\": true}", "diagnostics": []} +{"task_id": "swe-next-3bd2144ea1e70890c796", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:a123f82acdbbbd31bf0842a8f53e2c342affa9efbe2a21a9f4adbb9ca9939c11", "task_path": "tasks/swe-next-3bd2144ea1e70890c796", "instruction": "## `random_ordered_range` not accessible from the `more_itertools` module\n\nThe new `random_ordered_range` function is not accessible through the `more_itertools` module, even though it was recently added. Trying to use it raises an `AttributeError`.\n\n### Reproduction\n\n```python\nimport more_itertools as mi\n\n# Trying to use random_ordered_range raises AttributeError\nresult = sorted(mi.random_ordered_range(10))\nprint(result)\n```\n\nThis raises:\n```\nAttributeError: module 'more_itertools' has no attribute 'random_ordered_range'\n```\n\nThe same error occurs for all valid call signatures, e.g.:\n\n```python\nmi.random_ordered_range(100, 200) # two-arg form\nmi.random_ordered_range(1000, 2000, 10) # three-arg form\nset(tuple(mi.random_ordered_range(6)) for _ in range(10**5)) # permutation coverage check\n```\n\n### Expected behavior\n\n`random_ordered_range` should be accessible as `mi.random_ordered_range` and should behave like `range` in terms of which values it produces, but yield them in a randomly shuffled order. For example, `sorted(mi.random_ordered_range(10))` should equal `list(range(10))`, and calling it many times with a small argument like `6` should eventually produce all `6! = 720` distinct permutations.\n\n### Actual behavior\n\nAccessing `mi.random_ordered_range` raises `AttributeError: module 'more_itertools' has no attribute 'random_ordered_range'`, indicating the function is not exported from the package's public namespace. The function needs to be added to the package's `__init__.py` (or equivalent export mechanism) so it is importable at the top level.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `more_itertools`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Independent standalone pair not established by this audit; retained or recipe-native evidence is separate\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": null, \"retained\": true}", "diagnostics": []} +{"task_id": "swe-next-4d85779d48424cc78938", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:09b3add880b2ec3621a223e6a4bf249ab92d28103dc96b3289d5822a3b8083c9", "task_path": "tasks/swe-next-4d85779d48424cc78938", "instruction": "## `interleave_evenly` crashes with `IndexError` when given an empty list of iterables\n\n### Description\n\nCalling `interleave_evenly` with an empty list of iterables raises an `IndexError` instead of returning an empty iterator.\n\n```python\nimport more_itertools as mi\n\n# Both of these crash:\nresult = list(mi.interleave_evenly([]))\nresult = list(mi.interleave_evenly([], lengths=[]))\n```\n\nThe error occurs because the function tries to index into `lengths_desc` to find the primary iterable, but when no iterables are provided, `lengths_desc` is empty and `lengths_desc[0]` raises:\n\n```\nIndexError: list index out of range\n```\n\nThe traceback points to the line in `interleave_evenly` that does:\n```python\ndelta_primary, deltas_secondary = lengths_desc[0], lengths_desc[1:]\n```\n\nwhen `dims == 0`.\n\n### Expected behavior\n\nPassing an empty list of iterables (either inferred or with an explicit `lengths=[]`) should return an empty iterator, producing `[]` when consumed.\n\n### Actual behavior\n\n```\nIndexError: list index out of range\n```\n\nThe function should detect that no iterables were provided and return immediately before attempting to index into the sorted lengths list.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `more_itertools`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Independent standalone pair not established by this audit; retained or recipe-native evidence is separate\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": null, \"retained\": true}", "diagnostics": []} +{"task_id": "swe-next-511eb56b5464ff51169c", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:6c8746a5de263cfae4f61d10405cd3ed20610d9ccf01b6c771f9897140fdd419", "task_path": "tasks/swe-next-511eb56b5464ff51169c", "instruction": "## `tail()` silently returns empty result for negative `n` on sized iterables\n\nWhen calling `tail()` with a negative `n` value on a sized iterable (like a string or list), no error is raised — it just returns an empty iterator. However, when the same negative `n` is passed with a non-sized iterator, a `ValueError` is raised.\n\nThis inconsistency makes the behavior of `tail(-1, ...)` depend on whether the iterable has a `__len__` method, which is surprising and hard to debug.\n\n### Example\n\n```python\nimport more_itertools as mi\n\n# This raises ValueError as expected\ntry:\n list(mi.tail(-1, iter('ABCDEFG')))\nexcept ValueError as e:\n print(f\"Iterator raised: {e}\")\n\n# This silently returns [] instead of raising\nresult = list(mi.tail(-1, 'ABCDEFG'))\nprint(f\"Sized iterable returned: {result}\") # prints []\n```\n\nRunning the above, the non-sized iterator path raises `ValueError`, but the sized iterable path (`'ABCDEFG'` is a string with `__len__`) just returns an empty list with no error.\n\n### Expected behavior\n\nPassing a negative `n` to `tail()` should always raise a `ValueError`, regardless of whether the iterable is sized or not. Both `tail(-1, iter('ABCDEFG'))` and `tail(-1, 'ABCDEFG')` should raise `ValueError`.\n\n### Actual behavior\n\n`tail(-1, 'ABCDEFG')` returns an empty list `[]` silently instead of raising `ValueError`.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `more_itertools`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Independent standalone pair not established by this audit; retained or recipe-native evidence is separate\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": null, \"retained\": true}", "diagnostics": []} +{"task_id": "swe-next-53c4002d7c95f0dc4bbd", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:9efa574a1bdfe3831bd59d0169c748f670306f723e321ad4a77483b74876d0c9", "task_path": "tasks/swe-next-53c4002d7c95f0dc4bbd", "instruction": "## `iequals` incorrectly returns `True` when comparing iterables of different lengths with equality-wildcard objects\n\n### Description\n\nWhen using `iequals` to compare two iterables of different lengths, it can incorrectly return `True` if one of the iterables contains an object that compares equal to everything (such as `unittest.mock.ANY`).\n\nHere's a minimal reproduction:\n\n```python\nfrom unittest import mock\nimport more_itertools as mi\n\n# An empty list vs a list containing mock.ANY\nresult = mi.iequals([], [mock.ANY])\nprint(result) # prints True, but should be False\n```\n\nThe two iterables clearly have different lengths (0 vs 1), so `iequals` should return `False`. But it returns `True`.\n\n### Root cause\n\nThe current implementation uses `zip_longest` with a private sentinel `fillvalue=object()` to detect length mismatches:\n\n```python\nreturn all(map(all_equal, zip_longest(*iterables, fillvalue=object())))\n```\n\nThe idea is that the sentinel won't compare equal to real values. However, `mock.ANY` (and any object that overrides `__eq__` to always return `True`) compares equal to the sentinel too, so the length mismatch goes undetected and `iequals` returns `True` instead of `False`.\n\n### Expected behavior\n\n`mi.iequals([], [mock.ANY])` should return `False`, since the two iterables have different lengths and cannot be considered equal regardless of the values they contain.\n\n### Actual behavior\n\n`mi.iequals([], [mock.ANY])` returns `True`.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `more_itertools`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Independent standalone pair not established by this audit; retained or recipe-native evidence is separate\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": null, \"retained\": true}", "diagnostics": []} +{"task_id": "swe-next-5b258a93a37c35a60533", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:b7fcd0bcf14346509c9d1a16bedece2bae235a5cbbace35dec2ae5857a1ed42c", "task_path": "tasks/swe-next-5b258a93a37c35a60533", "instruction": "## Bug: `reversed()` on an empty `numeric_range` raises `IndexError`\n\nCalling `reversed()` on an empty `numeric_range` (e.g., `numeric_range(0)`) raises an `IndexError` instead of returning an empty iterator.\n\n### Reproduction\n\n```python\nimport more_itertools as mi\n\n# This should produce an empty list, but instead raises IndexError\nresult = list(reversed(mi.numeric_range(0)))\nprint(result) # Expected: []\n```\n\n### Error\n\n```\nIndexError: numeric range object index out of range\n```\n\nThe traceback points to `numeric_range.__reversed__`, which tries to access the last element of the range via `_get_by_index(-1)` before building the reversed range. When the range is empty, there is no last element, so `_get_by_index(-1)` raises `IndexError` rather than gracefully returning an empty iterator.\n\n### Expected behavior\n\n`reversed(mi.numeric_range(0))` should return an empty iterator, so `list(reversed(mi.numeric_range(0)))` should equal `[]`, consistent with how `reversed(range(0))` behaves for the built-in `range`.\n\n### Actual behavior\n\nAn `IndexError: numeric range object index out of range` is raised when `__reversed__` tries to retrieve the last element of the empty range. The fix should check for an empty range before attempting to access the last element and return an empty iterator in that case.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `more_itertools`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Independent standalone pair not established by this audit; retained or recipe-native evidence is separate\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": null, \"retained\": true}", "diagnostics": []} +{"task_id": "swe-next-71c56b192b2a29a2b70c", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:b9acd4d1737e1b93e466e30509808bc103ea1b065e430943561e12bcfa56e712", "task_path": "tasks/swe-next-71c56b192b2a29a2b70c", "instruction": "## `concurrent_tee` is missing from `more_itertools`\n\n### Description\n\nThere is no `concurrent_tee` function available in `more_itertools`, even though it is expected to exist as a thread-safe variant of `itertools.tee`. When trying to use it, you get an `AttributeError`.\n\nHere's a minimal example that reproduces the issue:\n\n```python\nimport more_itertools as mi\nfrom threading import Thread, Lock\n\ndef producer(limit):\n for x in range(limit):\n yield x\n\nlimit = 10**5\nnum_threads = 100\nnon_concurrent_source = producer(limit)\ntees = mi.concurrent_tee(non_concurrent_source, n=num_threads)\n```\n\nThis raises:\n\n```\nAttributeError: module 'more_itertools' has no attribute 'concurrent_tee'\n```\n\n### Expected behavior\n\n`concurrent_tee` should take a non-thread-safe iterable and return `n` independent iterator copies that can each be safely consumed in separate threads. All returned iterators should share a single lock so that concurrent calls to `__next__` on different tee objects are properly serialized against the underlying source.\n\nAdditionally:\n- Passing `n=0` should return an empty tuple `()`.\n- Passing a negative `n` should raise a `ValueError`.\n\nThe function should guarantee that each consumer thread receives the complete, correct sequence of values from the source (no duplicates, no dropped items), even when 100 threads consume their copies concurrently.\n\n### Actual behavior\n\nCalling `mi.concurrent_tee(...)` raises `AttributeError: module 'more_itertools' has no attribute 'concurrent_tee'` because the function has not been implemented and exported from the module.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `more_itertools`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Independent standalone pair not established by this audit; retained or recipe-native evidence is separate\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": null, \"retained\": true}", "diagnostics": []} +{"task_id": "swe-next-82ae55eeacd375fd11b9", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:f4611db598cf9f6b61a18dbe98ffd5a25fb2048f8f85dfec513ca6e5a3114481", "task_path": "tasks/swe-next-82ae55eeacd375fd11b9", "instruction": "## `constrained_batches` silently accepts `max_count=0` and negative values\n\nPassing `max_count=0` or a negative integer to `constrained_batches` should be invalid — a batch can't hold zero or fewer items. However, the function currently accepts these values without complaint and just produces unexpected results.\n\nFor example:\n\n```python\nimport more_itertools as mi\n\n# max_count=0 should be rejected, but instead it yields all items together\nresult = list(mi.constrained_batches(['a', 'b', 'c'], 10, max_count=0))\nprint(result) # prints [('a', 'b', 'c')] instead of raising ValueError\n\n# Same problem with negative counts\nresult = list(mi.constrained_batches(['a', 'b'], 10, max_count=-1))\nprint(result) # no error raised\n```\n\nThe same issue occurs when the iterable is empty — no error is raised even though the argument is clearly invalid:\n\n```python\nsource = iter(['a', 'b'])\ntry:\n list(mi.constrained_batches(source, 10, max_count=0))\nexcept ValueError:\n print('got expected error')\nelse:\n print('no error raised!') # this is what actually happens\n\n# Because no error was raised early, the source iterator may have been partially consumed\nprint(list(source)) # may not equal ['a', 'b']\n```\n\n### Expected behavior\n\nWhen `max_count` is `0` or negative, `constrained_batches` should immediately raise a `ValueError` with a message like `'maximum count must be greater than zero'`, before consuming any items from the input. This is consistent with how `max_size <= 0` is already handled. `None` should continue to mean \"no limit\".\n\n### Actual behavior\n\nNo exception is raised. The function silently proceeds as if `max_count` were not set (or behaves incorrectly), and the input iterator may be partially consumed before the caller realizes something went wrong.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `more_itertools`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Independent standalone pair not established by this audit; retained or recipe-native evidence is separate\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": null, \"retained\": true}", "diagnostics": []} +{"task_id": "swe-next-858ba86c2cb375406148", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:cd8acec830c1a4b37f81851a4eba2ea81a40c539a8943284181822e15a693a74", "task_path": "tasks/swe-next-858ba86c2cb375406148", "instruction": "## Add `subfactorial()` function to `more_itertools`\n\n### Description\n\nThe `more_itertools` library provides `derangements()` for generating all permutations of a sequence where no element appears in its original position. However, there's no direct way to compute the *count* of such derangements without actually iterating through them all.\n\nFor comparison, the `math` module provides `math.comb` for `combinations`, `math.perm` for `permutations`, and `math.prod` for `product`. Similarly, `more_itertools` should provide a `subfactorial` function as a companion to `derangements`.\n\nCurrently, calling `mi.subfactorial(n)` raises an `AttributeError`:\n\n```python\nimport more_itertools as mi\n\n# Trying to get the number of derangements of 7 elements\nresult = mi.subfactorial(7) # AttributeError: module 'more_itertools' has no attribute 'subfactorial'\n```\n\nThe expected behavior is that `subfactorial(n)` returns the number of permutations of `n` elements with no fixed points. For example:\n\n```python\nimport more_itertools as mi\n\n# subfactorial should match the count from derangements\ncount_via_iter = mi.ilen(mi.derangements('.' * 7)) # 1854\ncount_via_subfactorial = mi.subfactorial(7) # should also be 1854\n```\n\nThe function should also:\n- Return correct values matching the OEIS A000166 sequence: `1, 0, 1, 2, 9, 44, 265, 1854, 14833, 133496, ...` for n = 0, 1, 2, 3, ...\n- Raise `ValueError` for negative inputs like `subfactorial(-1)`\n- Raise `TypeError` for non-integer inputs like `subfactorial(5.0)` or `subfactorial('5')`\n\n### Expected behavior\n\n`mi.subfactorial(n)` should return an integer equal to the number of derangements of `n` distinct elements, consistent with the OEIS A000166 sequence, and should raise appropriate errors for invalid inputs.\n\n### Actual behavior\n\n```\nAttributeError: module 'more_itertools' has no attribute 'subfactorial'\n```\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `more_itertools`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Independent standalone pair not established by this audit; retained or recipe-native evidence is separate\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": null, \"retained\": true}", "diagnostics": []} +{"task_id": "swe-next-8b05c71e48fd71cc41f1", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:9858ef8ae6432b46fe138c7d4a288784636943f672ad9eb15ad9482e8003a436", "task_path": "tasks/swe-next-8b05c71e48fd71cc41f1", "instruction": "## `combination_with_replacement_index` gives wrong results and doesn't raise errors when `None` is involved\n\n### Description\n\nThe `combination_with_replacement_index` function produces incorrect indices when `None` appears in the pool iterable. Additionally, it fails to raise a `ValueError` when an element contains `None` but `None` is not a valid member of the combination (i.e., not in the iterable or appearing out of order).\n\n### Wrong index returned for valid `None`-containing combinations\n\nWhen the pool contains `None`, the function returns wrong indices:\n\n```python\nimport more_itertools as mi\nfrom itertools import combinations_with_replacement\n\niterable = [1, None, 2]\n\n# Enumerate all combinations to see the expected indices\nfor idx, combo in enumerate(combinations_with_replacement(iterable, 1)):\n print(idx, combo)\n# 0 (1,)\n# 1 (None,)\n# 2 (2,)\n\n# But the function returns the wrong index for None-containing elements\nprint(mi.combination_with_replacement_index((None,), [1, None, 2])) # Returns 2, expected 1\nprint(mi.combination_with_replacement_index((None, None), [1, None, 2])) # Returns 5, expected 3\n```\n\n### Missing `ValueError` for invalid combinations with `None`\n\nWhen the element contains `None` but `None` is not in the iterable, no error is raised:\n\n```python\nimport more_itertools as mi\n\n# None is not in [1, 2], so this should raise ValueError\nmi.combination_with_replacement_index((None,), [1, 2]) # No error raised!\n\n# None appears before 1 in the element, but pool is [None, 1] — so (1, None) is invalid\nmi.combination_with_replacement_index((1, None), [None, 1]) # No error raised!\n```\n\n### Expected behavior\n\n- When `None` is a valid element in the pool and appears in the combination, `combination_with_replacement_index` should return the correct index (matching what you'd get by enumerating `combinations_with_replacement`).\n- When the element is not a valid combination with replacement of the iterable (e.g., `None` is not in the pool, or elements are out of order), a `ValueError` should be raised.\n\n### Actual behavior\n\n- Wrong indices are returned for combinations containing `None` when `None` is in the pool.\n- No `ValueError` is raised when the element contains `None` that isn't a valid member of the combination.\n\nThe root cause appears to be that the implementation uses `None` as a sentinel value to detect end-of-iteration, which conflicts with `None` being a legitimate data value in the pool.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `more_itertools`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Independent standalone pair not established by this audit; retained or recipe-native evidence is separate\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": null, \"retained\": true}", "diagnostics": []} +{"task_id": "swe-next-92c87db3d5ad13434534", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:40603f9493b4630a4e79197e2df88b853f28add7535632701cc53df894c9dc4f", "task_path": "tasks/swe-next-92c87db3d5ad13434534", "instruction": "## `numeric_range` membership and `len()` are inconsistent with iteration for float steps\n\nWhen using `numeric_range` with a float step that has no exact binary representation (like `0.1`), items produced by iterating the range are not recognized as members of the range by `in`, `index()`, or `count()`. Additionally, `len()` can disagree with the actual number of items iteration produces.\n\n### Membership check fails for items the range itself yields\n\n```python\nimport more_itertools as mi\n\nr = mi.numeric_range(0.0, 1.0, 0.1)\nfor i, v in enumerate(r):\n print(i, v, v in r) # some items show False!\n```\n\nAt index 3, the range yields `0.30000000000000004` (due to floating-point multiplication), but checking `0.30000000000000004 in r` returns `False`. The `__contains__` implementation uses remainder/division arithmetic which gives a different result than the multiplication used during iteration, so the two disagree.\n\nSimilarly, `r.index(v)` raises `ValueError` for items that `r` itself produces, and `r.count(v)` returns 0.\n\n### `len()` disagrees with the number of items iteration produces\n\n```python\nimport more_itertools as mi\n\nr = mi.numeric_range(-8.732, -13.532, -2.4)\nprint(len(list(r))) # 2\nprint(len(r)) # 3 <-- wrong!\n```\n\nHere `len(r)` reports 3 but iterating only yields 2 items. The length calculation uses division to estimate the count, which can land one over (counting a phantom item past the stop) or one under (missing an item that iteration actually yields).\n\n### Expected behavior\n\n- Every value produced by iterating `numeric_range(...)` should be found by `in`, `index()`, and `count()`.\n- `len(r)` should always equal `len(list(r))`.\n- `r[len(r) - 1]` should equal the last item produced by iteration.\n\n### Actual behavior\n\n- `AssertionError: 0.30000000000000004 not found in numeric_range(0.0, 1.0, 0.1)`\n- `AssertionError: 2 != 3` when comparing `len(list(r))` to `len(r)` for `numeric_range(-8.732, -13.532, -2.4)`\n\nThe issue affects any `numeric_range` with a float step that cannot be represented exactly in binary floating point (e.g., `0.1`, `0.7`, `2.4`, `0.255`). Exact types like `int`, `Decimal`, and `Fraction` are unaffected.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `more_itertools`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Independent standalone pair not established by this audit; retained or recipe-native evidence is separate\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": null, \"retained\": true}", "diagnostics": []} +{"task_id": "swe-next-9bd0fd7bbe785ac41994", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:70f254f0b11f0ecdf55097d9aa63e31a71055eba25e98feeffa70a19cc2e13b1", "task_path": "tasks/swe-next-9bd0fd7bbe785ac41994", "instruction": "## `peekable` is not subscriptable as a generic type\n\nTrying to use `peekable` with a type parameter like `peekable[str]` raises a `TypeError`, even though similar classes in Python's standard library (e.g., `list[str]`, `functools.partial[str]`) support this syntax.\n\n### Example\n\n```python\nimport types\nimport more_itertools as mi\n\n# This raises TypeError: type 'peekable' is not subscriptable\nalias = mi.peekable[str]\n\n# What we'd expect:\n# alias should be a types.GenericAlias\n# alias.__origin__ should be mi.peekable\n# alias.__args__ should be (str,)\nprint(isinstance(alias, types.GenericAlias)) # should be True\nprint(alias.__origin__ is mi.peekable) # should be True\nprint(alias.__args__) # should be (str,)\n```\n\n### Expected behavior\n\n`peekable[str]` should return a `types.GenericAlias` object, matching the behavior of `list[str]` and other standard Python generic classes. This allows `peekable` to be used in runtime generic type annotations.\n\n### Actual behavior\n\n```\nTypeError: type 'peekable' is not subscriptable\n```\n\nThe `peekable` class does not define `__class_getitem__`, so subscripting it with a type argument fails at runtime. Other iterator wrappers in the standard library (like `functools.partial`) support this via `__class_getitem__ = classmethod(types.GenericAlias)`, but `peekable` is missing this.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `more_itertools`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Independent standalone pair not established by this audit; retained or recipe-native evidence is separate\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": null, \"retained\": true}", "diagnostics": []} +{"task_id": "swe-next-9be39cbb00d55a837a52", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:883a1d5ee3a86879c7e5c1a21f68e2cc21c11566bd8f72729e86fd9839dffc29", "task_path": "tasks/swe-next-9be39cbb00d55a837a52", "instruction": "## `split_before` / `split_after` / `split_when` return `[[]]` for an empty iterable when `maxsplit=0`\n\nWhen calling `split_before`, `split_after`, or `split_when` on an empty iterable with `maxsplit=0`, the result is `[[]]` (a list containing one empty list) instead of `[]` (an empty list). Every other value of `maxsplit` correctly returns `[]`.\n\n### Steps to reproduce\n\n```python\nimport more_itertools as mi\n\nprint({ms: list(mi.split_before([], lambda x: x == 0, maxsplit=ms)) for ms in (-1, 0, 1, 2)})\n# {-1: [], 0: [[]], 1: [], 2: []}\n\nprint({ms: list(mi.split_after([], lambda x: x == 0, maxsplit=ms)) for ms in (-1, 0, 1, 2)})\n# {-1: [], 0: [[]], 1: [], 2: []}\n\nprint({ms: list(mi.split_when('', lambda a, b: a != b, maxsplit=ms)) for ms in (-1, 0, 1, 2)})\n# {-1: [], 0: [[]], 1: [], 2: []}\n```\n\n### Expected behavior\n\nAll three functions should return `[]` for an empty iterable regardless of the `maxsplit` value, including `maxsplit=0`.\n\n### Actual behavior\n\nWith `maxsplit=0`, all three functions return `[[]]` — a list containing a single empty list — even though the input iterable has no elements. Any other `maxsplit` value (including `-1`, `1`, `2`, etc.) correctly returns `[]`.\n\nThe inconsistency is due to a `maxsplit == 0` fast path that unconditionally yields `list(iterable)` without first checking whether the collected list is non-empty.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `more_itertools`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Independent standalone pair not established by this audit; retained or recipe-native evidence is separate\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": null, \"retained\": true}", "diagnostics": []} +{"task_id": "swe-next-a02b68f4069ec94d8949", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:8e5ddb9f45686ab10738b24bbbdec3c2efe6752289d40167787ffbe86b49aa1f", "task_path": "tasks/swe-next-a02b68f4069ec94d8949", "instruction": "## `sliced()` silently returns wrong results for negative `n`\n\nPassing a negative slice size to `sliced()` doesn't raise an error — it quietly returns a truncated, incorrect result that looks plausible but is meaningless.\n\n```python\nfrom more_itertools import sliced\n\n# Expected: ValueError (negative n makes no sense)\n# Actual: ['ABCDEF'] — wrong, no error\nprint(list(sliced('ABCDEFG', -1)))\n\n# Expected: ValueError\n# Actual: [[1, 2, 3]] — wrong, no error\nprint(list(sliced([1, 2, 3, 4, 5], -2)))\n```\n\nThe root cause is that `sliced` builds slices via:\n\n```python\niterator = takewhile(len, (seq[i : i + n] for i in count(0, n)))\n```\n\nWhen `n` is negative, `count(0, n)` steps downward. The very first slice is `seq[0 : 0 + n]` — for `n = -1` that's `seq[0:-1]`, which is a non-empty prefix. The next index is negative, so `seq[i : i + n]` becomes empty and `takewhile` stops. The result is a single truncated slice that looks like valid output but is wrong.\n\nWith `strict=True` the situation is slightly better in that an error is raised, but it's the wrong error:\n\n```python\nlist(sliced('ABCDEFG', -1, strict=True))\n# Raises: ValueError: seq is not divisible by n.\n# Should raise: ValueError about n being negative\n```\n\nThe related function `chunked()` already rejects negative `n` with a clear error. `sliced()` should do the same.\n\n**Expected behavior:** `sliced(seq, n)` with `n < 0` should raise a `ValueError` with a clear message (e.g. `'n must be at least 0'`), both with and without `strict=True`.\n\n**Actual behavior:** With default `strict=False`, a wrong result is returned silently. With `strict=True`, a misleading `ValueError: seq is not divisible by n.` is raised instead of an error pointing at the real problem (negative `n`).\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `more_itertools`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Independent standalone pair not established by this audit; retained or recipe-native evidence is separate\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": null, \"retained\": true}", "diagnostics": []} +{"task_id": "swe-next-a4662751faa27c11ba5f", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:684b339fa08318719287fee1924eceec10509ecf0872b7334b807e54553af055", "task_path": "tasks/swe-next-a4662751faa27c11ba5f", "instruction": "## `running_min` and `running_max` are not stable when values are equal\n\nPython's built-in `min(x, y)` and `max(x, y)` are **stable**: when `x == y`, they return `x` (the first/oldest value). The `running_min` and `running_max` functions from `more-itertools` don't respect this — when multiple equal values appear in the sliding window, the *newest* one wins instead of the oldest.\n\nThis can be observed by passing values that compare equal but have different types:\n\n```python\nfrom fractions import Fraction\nimport more_itertools as mi\n\ndata = [0, 0.0, Fraction(0)] # all equal to zero, different types\n\nresult_min = list(map(type, mi.running_min(data, maxlen=2)))\nresult_max = list(map(type, mi.running_max(data, maxlen=2)))\n\nprint(result_min) # actual: [int, float, Fraction]\nprint(result_max) # actual: [int, float, Fraction]\n```\n\n### Expected behavior\n\nSince `min(x, y)` returns `x` when `x == y`, the running minimum/maximum should keep the oldest equal value in the window. For the input above with `maxlen=2`:\n\n- Window `[0]` → `int`\n- Window `[0, 0.0]` → `int` (oldest wins, same as `min(0, 0.0)` which is `0`, an `int`)\n- Window `[0.0, Fraction(0)]` → `float` (oldest wins)\n\nSo the expected types are `[int, int, float]` for both `running_min` and `running_max`.\n\n### Actual behavior\n\nBoth functions return `[int, float, Fraction]`, meaning the newest equal value replaces the current minimum/maximum instead of being discarded. The internal deque-based sliding window uses `not x < y` (for min) and `not x > y` (for max) as the removal condition, which incorrectly evicts the existing candidate when values are equal, letting the newer value take over.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `more_itertools`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Independent standalone pair not established by this audit; retained or recipe-native evidence is separate\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": null, \"retained\": true}", "diagnostics": []} +{"task_id": "swe-next-bdbcbf9106cf5d36ad63", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:3861342eae2cd4fd29988264a4802844517e8299d4d711ffb46700f34b2b0657", "task_path": "tasks/swe-next-bdbcbf9106cf5d36ad63", "instruction": "## `serialize` does not support generator methods (`send`, `throw`, `close`)\n\nWhen wrapping a generator with `mi.serialize()`, calling generator-specific methods like `send()`, `throw()`, or `close()` raises an `AttributeError` because `serialize` only implements `__next__` and does not expose these methods.\n\n### Reproducer\n\n```python\nimport more_itertools as mi\n\ndef echo():\n try:\n while True:\n val = yield \"ready\"\n yield f\"received {val}\"\n except ValueError:\n yield \"caught\"\n\nit = mi.serialize(echo())\nprint(next(it)) # prints \"ready\"\nprint(it.send(\"hello\")) # AttributeError: 'serialize' object has no attribute 'send'\n```\n\nSimilarly, `it.throw(ValueError)` and `it.close()` both fail with the same `AttributeError`.\n\n### Expected behavior\n\n`serialize` should proxy generator methods (`send`, `throw`, `close`) to the underlying iterator, acquiring the lock before each call. This allows `serialize` to be used as a thread-safe wrapper around generators, not just plain iterators.\n\nAdditionally, the internal attributes of `serialize` should be private (`_iterator` and `_lock` instead of `iterator` and `lock`) to avoid accidental external access.\n\n### Actual behavior\n\n```\nAttributeError: 'serialize' object has no attribute 'send'\n```\n\nAnd when trying to inspect the internal lock via `it._lock`:\n\n```\nAttributeError: 'serialize' object has no attribute '_lock'\n```\n\nbecause the lock is currently stored as the public attribute `lock`.\n\n### Fix needed\n\n- Add `send(value)`, `throw(*args)`, and `close()` methods to `serialize`, each acquiring the lock before delegating to the underlying iterator.\n- Rename internal attributes from `iterator`/`lock` to `_iterator`/`_lock` to make them private.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `more_itertools`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Independent standalone pair not established by this audit; retained or recipe-native evidence is separate\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": null, \"retained\": true}", "diagnostics": []} +{"task_id": "swe-next-c256b3744c88373661d9", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:cf70d8b1c6d3c290586cccc16dc46090eebbbe9c7447130c85c4230d7f7ba7a3", "task_path": "tasks/swe-next-c256b3744c88373661d9", "instruction": "## `numeric_range` equality doesn't match built-in `range` semantics for single-element ranges\n\nSince Python 3.3, `range` objects are compared based on the sequence of values they define, not their internal parameters. For example:\n\n```python\n>>> range(2, 3, 1) == range(2, 3, 5)\nTrue\n```\n\nBoth `range(2, 3, 1)` and `range(2, 3, 5)` produce the single-element sequence `[2]`, so they're equal.\n\nHowever, `numeric_range` does not follow this behavior:\n\n```python\nfrom more_itertools import numeric_range\n\nr1 = numeric_range(2, 3, 1) # produces [2]\nr2 = numeric_range(2, 3, 5) # also produces [2]\n\nprint(list(r1)) # [2]\nprint(list(r2)) # [2]\nprint(r1 == r2) # False <-- should be True\nprint(hash(r1) == hash(r2)) # False <-- should be True since equal objects must have equal hashes\n```\n\nThe two ranges define the same sequence of values, so they should be equal and have the same hash. The current `__eq__` implementation compares the step even for single-element ranges, where the step is irrelevant.\n\nThe same issue applies to `__hash__`: equal objects must have equal hashes, but since `__eq__` incorrectly returns `False` for these cases, the hashes are also inconsistent.\n\n**Expected behavior:** `numeric_range` equality and hashing should match the built-in `range` semantics — two `numeric_range` objects are equal if and only if they define the same sequence of values.\n\n**Actual behavior:** `numeric_range(2, 3, 1) != numeric_range(2, 3, 5)` even though both represent `[2]`.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `more_itertools`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Independent standalone pair not established by this audit; retained or recipe-native evidence is separate\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": null, \"retained\": true}", "diagnostics": []} +{"task_id": "swe-next-ea3e518d6dbb7bbca2a7", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:87487dda30f9e0f4d370b8ab487079c2d5aec0027e1e37fbb6472cf686969609", "task_path": "tasks/swe-next-ea3e518d6dbb7bbca2a7", "instruction": "## `chunked()` raises a confusing `ValueError` for negative `n`\n\nWhen calling `chunked()` with a negative chunk size, instead of getting a clear error message, you get an internal `islice` error that leaks implementation details.\n\n```python\nimport more_itertools as mi\n\n# This raises:\n# ValueError: Stop argument for islice() must be None or an integer: 0 <= x <= sys.maxsize.\nlist(mi.chunked('ABCDE', -1))\n```\n\nThe error message comes from Python's `itertools.islice` internals and is not helpful for users.\n\nFor comparison, `sliced()` and `tail()` already validate their `n` argument up front and raise:\n```\nValueError: n must be at least 0\n```\n\n**Expected behavior:** `chunked()` should raise `ValueError('n must be at least 0')` when `n` is negative, consistent with `sliced()` and `tail()`.\n\n**Actual behavior:** A confusing `ValueError` is raised with the message `'Stop argument for islice() must be None or an integer: 0 <= x <= sys.maxsize.'`, which exposes internal implementation details rather than giving a clear diagnostic.\n\nNote that `n=None` (return a single chunk) and `n=0` (return an empty iterator) should remain valid and unchanged.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `more_itertools`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Independent standalone pair not established by this audit; retained or recipe-native evidence is separate\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": null, \"retained\": true}", "diagnostics": []} +{"task_id": "swe-next-001cfe3eecfafbd157e8", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:219d1a9d677f1152cc33b6045521fc4a1abf8c40c85599fc6405b01c11c7229a", "task_path": "tasks/swe-next-001cfe3eecfafbd157e8", "instruction": "## Header injection / `HeaderWriteError` when metadata values contain non-`\\n` line boundaries\n\n### Problem\n\nWhen writing RFC 822 metadata, the `RFC822Policy` only folds `\\n` into continuation lines. Python's `str.splitlines()` (which the email generator uses internally) recognizes several other line boundary characters: bare `\\r`, vertical tab (`\\v` / `\\x0b`), form feed (`\\f` / `\\x0c`), `\\x1c`–`\\x1e`, `\\x85`, U+2028, and U+2029. If a header value contains one of these characters, two bad things can happen:\n\n1. **`HeaderWriteError` on patched CPython**: A bare `\\r` in a header value causes the email generator to raise `email.errors.HeaderWriteError: folded header contains newline`.\n2. **Header injection on unpatched CPython**: Other boundary characters (e.g. `\\x0b`, `\\u2028`) allow content after the boundary to be interpreted as a new header line, enabling injection of arbitrary headers like `Requires-Dist`.\n\nAdditionally, the `Summary` field validator only rejects values containing `\\n`, so a summary with `\\r` or U+2028 passes validation even though it would break the single-line guarantee.\n\n### Reproducing the `HeaderWriteError`\n\n```python\nfrom packaging import metadata\n\nmeta = metadata.Metadata.from_raw(\n {\n \"version\": \"1.2.3\",\n \"name\": \"packaging\",\n \"author\": \"Hello\\rWorld\",\n \"metadata_version\": \"2.3\",\n }\n)\n# Raises email.errors.HeaderWriteError on patched CPython:\nwritten = meta.as_rfc822().as_string()\n```\n\n### Reproducing the header injection\n\n```python\nimport email\nfrom packaging.metadata import RFC822Message\n\nmessage = RFC822Message()\nmessage[\"ItemA\"] = \"ValueA\\x0bRequires-Dist: injected\"\n\n# Currently the parsed message contains TWO headers instead of one:\nprint(email.message_from_string(str(message)).items())\n# Expected: [(\"ItemA\", \"ValueA\\n Requires-Dist: injected\")]\n# Actual: [(\"ItemA\", \"ValueA\"), (\"Requires-Dist\", \"injected\")]\n```\n\nThe same injection is possible with `\\r`, `\\f`, `\\x1c`, `\\x1d`, `\\x1e`, `\\x85`, `\\u2028`, and `\\u2029`.\n\n### Reproducing the summary validation gap\n\n```python\nfrom packaging import metadata\n\n# Should raise InvalidMetadata, but currently does not:\nmeta = metadata.Metadata.from_raw({\"summary\": \"Hello\\rAgain\"}, validate=False)\nprint(meta.summary) # Expected: raises InvalidMetadata\n\nmeta2 = metadata.Metadata.from_raw({\"summary\": \"Hello\\u2028Again\"}, validate=False)\nprint(meta2.summary) # Expected: raises InvalidMetadata\n```\n\n### Expected behavior\n\n- All line boundary characters recognized by `str.splitlines()` should be folded into continuation lines when writing header values, so the output is a single logical header and no `HeaderWriteError` is raised.\n- The `Summary` field validator should reject any value containing a line boundary character (not just `\\n`).\n\n### Actual behavior\n\n- Only `\\n` is replaced with a continuation; all other boundary characters pass through unmodified.\n- Writing a value with a bare `\\r` raises `email.errors.HeaderWriteError`.\n- Writing a value with `\\x0b`, `\\u2028`, etc. silently produces multiple headers in the output.\n- `Summary` values with `\\r` or `\\u2028` are not flagged as invalid.\n\n### Fix\n\nThe `header_store_parse` method in `RFC822Policy` should replace all `str.splitlines()` boundaries (not just `\\n`) with `\\n` + the appropriate number of spaces. The `_process_summary` validator should use the same boundary set to check for invalid multi-line summaries.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/packaging`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-07e2af63e004fa70f534", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:4b5e4bf5dbe42643603482f07338f32db0567b0df57fb27b77c0a0c20a577e84", "task_path": "tasks/swe-next-07e2af63e004fa70f534", "instruction": "## `Signer` and `Serializer` should support a list of secret keys for key rotation\n\n### Problem\n\nCurrently, `Signer` and `Serializer` only accept a single secret key. There's no built-in way to rotate keys — that is, to accept tokens signed with an old key while signing new tokens with a new key.\n\nWhen you try to pass a list of secret keys to `Signer` or `Serializer`, it fails with a `TypeError` because the list is passed directly into HMAC or concatenated with bytes, neither of which accepts a list.\n\n### Example\n\n```python\nfrom itsdangerous.signer import Signer\n\n# Sign with the old key\nsigner = Signer(\"a\")\nsigned = signer.sign(\"my string\")\n\n# Now try to verify with a new signer that knows about both old and new keys\nsigner = Signer([\"a\", \"b\"])\nvalid = signer.validate(signed) # TypeError: can't concat list to bytes\nout = signer.unsign(signed)\n```\n\nSimilarly for `JSONWebSignatureSerializer`:\n\n```python\nfrom itsdangerous.jws import JSONWebSignatureSerializer\n\nserializer = JSONWebSignatureSerializer(\"a\")\ndumped = serializer.dumps(\"value\")\n\nserializer = JSONWebSignatureSerializer([\"a\", \"b\"])\nresult = serializer.loads(dumped) # TypeError: key: expected bytes or bytearray, but got 'list'\n```\n\n### Expected behavior\n\n`Signer([\"a\", \"b\"])` should accept a list of secret keys. When verifying a signature, it should try each key in the list (from newest to oldest) until one succeeds. When signing, it should use the last (newest) key. This enables a key rotation workflow where old tokens remain valid while new tokens are signed with the latest key.\n\n### Actual behavior\n\nPassing a list of keys causes a `TypeError`:\n- In `Signer.derive_key`: `TypeError: can't concat list to bytes`\n- In `JSONWebSignatureSerializer`: `TypeError: key: expected bytes or bytearray, but got 'list'`\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/itsdangerous`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-0b7e94cc943dd1cb3ac8", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:9b4c375f9ec624f36486f59d4d63a73ab48c88fa88113a4fd5b8d52212f62ae2", "task_path": "tasks/swe-next-0b7e94cc943dd1cb3ac8", "instruction": "## Bug: Malformed `Description-Content-Type` values cause `IndexError` or are silently accepted\n\nWhen a `Description-Content-Type` metadata field contains a malformed parameter value, two different bad things happen depending on the specific malformation:\n\n### Case 1: `IndexError` leaks for truncated parameters like `text/plain; x*`\n\nIf the parameter is malformed in a way that confuses the RFC 2231 parser (e.g., a parameter name followed by `*` but no `=value`), Python's internal email header parser raises a bare `IndexError` that propagates all the way out:\n\n```python\nfrom packaging import metadata\n\nmeta = metadata.Metadata.from_raw(\n {\"description_content_type\": \"text/plain; x*\"}, validate=False\n)\nmeta.description_content_type # raises IndexError, not InvalidMetadata\n```\n\nThis crashes with:\n```\nIndexError: string index out of range\n```\ndeep inside `email._header_value_parser.get_parameter`, instead of raising `packaging.metadata.InvalidMetadata`.\n\n### Case 2: Parameters with invalid characters are silently accepted\n\nValues like `text/plain; {b}` or `text/plain; a}b` contain characters that are invalid in MIME parameter names. The email parser marks these as defects but does not raise an exception, so `_process_description_content_type` silently accepts them and returns without raising `InvalidMetadata`:\n\n```python\nfrom packaging import metadata\n\nfor bad in [\"text/plain; {b}\", \"text/plain; a}b\"]:\n meta = metadata.Metadata.from_raw(\n {\"description_content_type\": bad}, validate=False\n )\n meta.description_content_type # should raise InvalidMetadata, but doesn't\n```\n\n### Case 3: `from_email` path also fails for folded/unterminated values\n\nWhen parsing metadata from an email-style string, values like `text/plain\\n folded` or `text/plain; charset=\"unterminated` should surface as `InvalidMetadata` inside an `ExceptionGroup`. Currently they do not:\n\n```python\nfrom packaging import metadata\n\nmetadata.Metadata.from_email(\n \"Metadata-Version: 2.6\\n\"\n \"Name: packaging\\n\"\n \"Version: 1.0\\n\"\n \"Description-Content-Type: text/plain; x*\\n\"\n)\n# Should raise ExceptionGroup containing InvalidMetadata with\n# 'is not a valid content type' in the message\n```\n\n### Expected behavior\n\nAll malformed `Description-Content-Type` values — whether they cause a parse exception or result in header defects — should raise `InvalidMetadata` with a message that includes the offending value and says it is not a valid content type (e.g., `\"'text/plain; x*' is not a valid content type for 'Description-Content-Type'\"`). The `IndexError` from the email parser internals should never be visible to callers.\n\n### Actual behavior\n\n- `text/plain; x*` → `IndexError: string index out of range` (leaks from email parser internals)\n- `text/plain; {b}`, `text/plain; a}b` → no exception raised at all (silently accepted)\n- Folded/unterminated values via `from_email` → no `InvalidMetadata` raised\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/packaging`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-10728e9f6e0201cf6078", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:6fad48fb7db7b4ea68447cf7b216756a62adc146ac6398379c6923a38c4c6014", "task_path": "tasks/swe-next-10728e9f6e0201cf6078", "instruction": "## Bug: `strip_comments=True` leaves the last comment when a query contains only comments\n\n### Description\n\nWhen formatting a SQL string that consists entirely of single-line comments (e.g., `--A;\\n--B;`), using `strip_comments=True` should return an empty string. Instead, the last comment is left in the output.\n\nFor example:\n\n```python\nimport sqlparse\n\n# Two single-line comments separated by a newline\nquery = '--A;\\n--B;'\nresult = sqlparse.format(query, strip_comments=True)\nprint(repr(result)) # prints '--B;' but should print ''\n\n# Two single-line comments on the same line\nquery2 = '--A;--B;'\nresult2 = sqlparse.format(query2, strip_comments=True)\nprint(repr(result2)) # also prints '--B;' instead of ''\n```\n\nThe same issue appears with block comments:\n\n```python\nquery = '/* sql starts here */'\nresult = sqlparse.format(query, strip_comments=True)\nprint(repr(result)) # should be '' but isn't\n\nquery = '/* sql starts here */\\n/* or here */'\nresult = sqlparse.format(query, strip_comments=True, strip_whitespace=True)\nprint(repr(result)) # should be '' but isn't\n```\n\n### Expected behavior\n\nWhen `strip_comments=True` is passed and the entire SQL string is made up of comments (no actual SQL tokens), the result should be an empty string `''`.\n\n### Actual behavior\n\nThe last comment in the query is not stripped and appears in the output. For `'--A;\\n--B;'`, the result is `'--B;'` instead of `''`.\n\nThis appears to be a bug in `StripCommentsFilter` inside `sqlparse/filters/others.py`. When a comment token is removed and a replacement token is inserted, the internal index tracking gets out of sync, causing the loop to skip the next token (which may itself be another comment).\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `sqlparse`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-1236b72c7044ed54392e", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:c3375105803ba46759dd661f482b8b4a83172261329f2980a833b41dff092c47", "task_path": "tasks/swe-next-1236b72c7044ed54392e", "instruction": "## `IntervalError` message for weekday properties is not descriptive enough\n\nWhen you try to use a weekday property (like `.monday`, `.tuesday`, etc.) on a job that has an interval greater than 1, an `IntervalError` is raised. However, the current error message is very terse and not particularly helpful:\n\n```\nschedule.IntervalError: Use mondays instead of monday\n```\n\nHere's a minimal example that demonstrates the issue:\n\n```python\nimport schedule\nfrom schedule import IntervalError\n\njob_instance = schedule.Job(interval=2)\n\ntry:\n job_instance.monday\nexcept IntervalError as e:\n print(str(e)) # prints: Use mondays instead of monday\n```\n\nThe same problem exists for all weekday properties: `.tuesday`, `.wednesday`, `.thursday`, `.friday`, `.saturday`, and `.sunday`.\n\n## Expected behavior\n\nThe error message should clearly explain *why* the error occurred and what the constraint is. For example, accessing `.monday` on a job with `interval=2` should raise an `IntervalError` with a message like:\n\n```\nScheduling .monday() jobs is only allowed for weekly jobs. Using .monday() on a job scheduled to run every 2 or more weeks is not supported.\n```\n\nSimilarly for all other weekday properties (e.g., `.tuesday()`, `.wednesday()`, etc.).\n\n## Actual behavior\n\nThe current messages are short and cryptic (e.g., `\"Use mondays instead of monday\"`), which doesn't explain the actual constraint — that these day-specific properties are only valid when the job interval is exactly 1 week.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `schedule`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-139ba1ca95d2f8786e80", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:fa464539a858ca1eece4e8d7a234798a3ef9719e08a13f932e5e815bf2a7eb36", "task_path": "tasks/swe-next-139ba1ca95d2f8786e80", "instruction": "## `get_real_name()` returns wrong component for fully-qualified names with 3+ parts\n\n### Description\n\nWhen calling `get_real_name()` on an identifier with more than two dotted parts (e.g. `db.schema.tbl.col`), the method returns an intermediate component instead of the actual object name (the last component).\n\n```python\nimport sqlparse\n\nident = sqlparse.parse(\"db.schema.tbl.col\")[0].tokens[0]\nprint(ident.get_real_name()) # prints 'schema', should be 'col'\nprint(ident.get_name()) # prints 'schema', should be 'col'\n```\n\nMore examples that demonstrate the wrong behavior:\n\n```python\n# Three parts: a.b.c\nident = sqlparse.parse(\"a.b.c\")[0].tokens[0]\nprint(ident.get_real_name()) # 'b', should be 'c'\n\n# With alias: x.y.z AS w\naliased = sqlparse.parse(\"x.y.z AS w\")[0].tokens[0]\nprint(aliased.get_real_name()) # 'y', should be 'z'\nprint(aliased.get_alias()) # 'w' (correct)\n\n# Function call: mydb.sch.func(1)\nfunc_ident = sqlparse.parse(\"mydb.sch.func(1)\")[0].tokens[0]\nprint(func_ident.get_real_name()) # 'sch', should be 'func'\n```\n\nNote that two-part names work correctly — `a.b` correctly returns `'b'` — because in that case the first dot is also the last dot.\n\n### Root cause\n\n`NameAliasMixin.get_real_name` in `sqlparse/sql.py` currently anchors on the **first** dot it finds:\n\n```python\ndef get_real_name(self):\n \"\"\"Returns the real name (object name) of this identifier.\"\"\"\n # a.b\n dot_idx, _ = self.token_next_by(m=(T.Punctuation, '.'))\n return self._get_first_name(dot_idx, real_name=True)\n```\n\n`token_next_by` returns the index of the first dot, so `_get_first_name` picks up the component right after it — the second part of the name. For a 2-part name this is accidentally correct, but for 3+ parts it stops at the wrong position.\n\nThe object name is unambiguously the component after the **last** dot. The method should iterate through all tokens to find the last dot, then use that index to retrieve the name. `get_parent_name` (which correctly uses the first dot, as documented) should remain unchanged.\n\n### Expected behavior\n\n- `db.schema.tbl.col` → `get_real_name()` returns `'col'`\n- `a.b.c` → `get_real_name()` returns `'c'`\n- `x.y.z AS w` → `get_real_name()` returns `'z'`, `get_alias()` returns `'w'`\n- `mydb.sch.func(1)` → `get_real_name()` returns `'func'`\n- `a.b` → `get_real_name()` still returns `'b'` (unchanged)\n- `get_parent_name()` behavior is unchanged (still anchors on first dot)\n\n### Actual behavior\n\nFor any identifier with 3 or more dotted parts, `get_real_name()` returns the second component (the one immediately after the first dot) instead of the last component.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `sqlparse`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-154533d82be47f4fc189", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:1bca7ad62013688e15d4b8294b68d7fb2a6ab239f420513aba5cccda1d880d28", "task_path": "tasks/swe-next-154533d82be47f4fc189", "instruction": "## `ALTER TABLE ... ROW_FORMAT=Dynamic` parses the table name incorrectly\n\nWhen parsing an `ALTER TABLE` statement that uses the `ROW_FORMAT` option, sqlparse incorrectly absorbs `ROW_FORMAT` into the table name as if it were an alias.\n\n```python\nimport sqlparse\n\np = sqlparse.parse(\"ALTER TABLE mytable ROW_FORMAT=Dynamic\")[0]\nprint([str(t) for t in p.tokens])\n# Output: ['ALTER', ' ', 'TABLE', ' ', 'mytable ROW_FORMAT', '=', 'Dynamic']\n# ^^^^^^^^^^^^^^^^^^ table name absorbs the option\n```\n\nYou can also verify by checking the identifier directly:\n\n```python\nimport sqlparse\nfrom sqlparse import sql, tokens as T\n\np = sqlparse.parse('ALTER TABLE mytable ROW_FORMAT=Dynamic')[0]\n# ROW_FORMAT should be a keyword token, but it is None\nrow_format = p.token_next_by(m=(T.Keyword, 'ROW_FORMAT'))[1]\nprint(row_format) # prints None\n\n# The table identifier has absorbed ROW_FORMAT as an alias\nident = p.tokens[4]\nprint(ident.get_real_name()) # 'mytable'\nprint(ident.get_alias()) # 'ROW_FORMAT' instead of None\n```\n\nFor comparison, `ENGINE=InnoDB` works correctly because `ENGINE` is already listed as a keyword:\n\n```python\ne = sqlparse.parse('ALTER TABLE mytable ENGINE=InnoDB')[0]\nprint(e.tokens[4].get_real_name()) # 'mytable'\nprint(e.tokens[4].get_alias()) # None (correct)\n```\n\n## Expected behavior\n\n`ROW_FORMAT` should be recognized as a keyword (like `ENGINE`, `AUTO_INCREMENT`, etc.), so `mytable` is parsed as a standalone identifier with no alias, and `ROW_FORMAT` appears as its own keyword token:\n\n```\n['ALTER', ' ', 'TABLE', ' ', 'mytable', ' ', 'ROW_FORMAT', '=', 'Dynamic']\n```\n\n## Actual behavior\n\nBecause `ROW_FORMAT` is not in the keywords list, it gets tokenized as a `Name` and the identifier grouper treats it as an alias of `mytable`, producing `mytable ROW_FORMAT` as a single identifier token. The `ROW_FORMAT` keyword token is not found (returns `None`).\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `sqlparse`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-159a25db393017cefba9", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:08c3e02cc46798ac9012c88a06c87ecd96486fd51ab374f1d2cadf05de709887", "task_path": "tasks/swe-next-159a25db393017cefba9", "instruction": "## `parse_tag()` raises `ValueError` instead of `InvalidTag` for tags with wrong number of components\n\n### Description\n\nCalling `parse_tag()` with a tag string that doesn't have exactly three hyphen-separated components (interpreter, ABI, platform) raises a raw `ValueError` from Python's tuple unpacking instead of the documented `InvalidTag` exception.\n\nFor example:\n\n```python\nfrom packaging import tags\n\n# Tag with only two components (missing platform)\ntags.parse_tag(\"py3-none\")\n\n# Tag with four components (extra field)\ntags.parse_tag(\"py3-none-any-extra\")\n```\n\nRunning either of these raises:\n\n```\nValueError: not enough values to unpack (expected 3, got 2)\n```\n\nor\n\n```\nValueError: too many values to unpack (expected 3)\n```\n\nThe error originates from the internal tuple unpacking `interpreters, abis, platforms = component_parts` in `parse_tag()` in `src/packaging/tags.py`.\n\n### Expected behavior\n\nBoth inputs should raise `tags.InvalidTag` (a subclass of `ValueError`) with a message indicating the tag must have exactly three components, consistent with how empty tag components are already handled. Code that catches `InvalidTag` to handle malformed tags should not need to also catch the bare `ValueError`.\n\n### Actual behavior\n\nA plain `ValueError` is raised directly from the tuple unpacking, bypassing the `InvalidTag` public error contract. Any caller that catches `tags.InvalidTag` to validate tag strings will miss these malformed inputs.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/packaging`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-1a113b4bab7fa544fc2b", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:87d2c484aca94d01d3db48043a0844ae7bd6157b11b5bec15b6ce54eae662cfb", "task_path": "tasks/swe-next-1a113b4bab7fa544fc2b", "instruction": "## Bug: Wheel filename with `\\n` in distribution name is incorrectly accepted as valid\n\n### Description\n\nWhen parsing a wheel filename where the distribution name ends with a newline character (`\\n`), `parse_wheel_filename` does not raise `InvalidWheelFilename` as expected. Instead, it silently accepts the filename as valid.\n\nFor example:\n\n```python\nfrom packaging.utils import parse_wheel_filename, InvalidWheelFilename\n\n# This should raise InvalidWheelFilename because 'foo\\n' is not a valid distribution name\ntry:\n result = parse_wheel_filename(\"foo\\n-1.0-py3-none-any.whl\")\n print(\"No exception raised! Got:\", result)\nexcept InvalidWheelFilename:\n print(\"Correctly rejected invalid filename\")\n```\n\nRunning this prints `No exception raised!` — the filename is accepted without error.\n\n### Expected behavior\n\nA wheel filename containing a newline character (`\\n`) in the distribution name part (e.g., `\"foo\\n-1.0-py3-none-any.whl\"`) should be rejected with an `InvalidWheelFilename` exception, just like other filenames with invalid characters (e.g., `foo#bar-1.0-py3-none-any.whl` or `foo__bar-1.0-py3-none-any.whl`).\n\n### Actual behavior\n\nNo exception is raised. The filename is accepted as valid.\n\n### Root cause\n\nThe regex used to validate the wheel distribution name is `^[\\w._]+$` with `re.UNICODE`. In Python's `re` module, `$` matches at the end of the string **or** just before a trailing newline — so `foo\\n` incorrectly passes the pattern. The anchor should be `\\Z` instead of `$`, which matches strictly at the end of the string with no exceptions for trailing newlines.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/packaging`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-222c94194355d5edd3ec", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:85400572d84c21613a9b0676df91f29e9ab3ac025dc25bae068b63be1ff24653", "task_path": "tasks/swe-next-222c94194355d5edd3ec", "instruction": "## `IndexedSet.update()` adds iterables as members instead of their elements when called with multiple arguments\n\nWhen calling `IndexedSet.update()` with more than one iterable argument, the method incorrectly treats each iterable as an item to insert rather than iterating through its contents.\n\nFor example:\n\n```python\nfrom boltons.setutils import IndexedSet\n\nitems = IndexedSet([1])\nitems.update([2, 1, 3], [], [3, 4, 2])\nprint(list(items)) # Expected: [1, 2, 3, 4]\n```\n\nThis raises `TypeError: unhashable type: 'list'` because the lists themselves are being passed to `self.add()` instead of their individual elements.\n\nWith tuple arguments the error is silent but wrong:\n\n```python\nitems = IndexedSet([1])\nitems.update((2, 1, 3), (), (3, 4, 2))\nprint(list(items)) # Prints: [1, (2, 1, 3), (), (3, 4, 2)] — tuples added as members!\n```\n\nSimilarly, when the *elements* of the iterables happen to be tuples (hashable), but the outer containers are lists:\n\n```python\nitems = IndexedSet()\nitems.update([(1, 2)], [(3, 4), (1, 2)]) # TypeError: unhashable type: 'list'\n```\n\nThis is inconsistent with the documented behavior (and Python's built-in `set.update()`) which should iterate through each argument and add its elements.\n\n**Expected behavior:** `IndexedSet([1]).update([2, 1, 3], [], [3, 4, 2])` should result in `[1, 2, 3, 4]` — duplicates removed, insertion order preserved, all arguments treated as iterables to consume.\n\n**Actual behavior:** When multiple arguments are passed, the multi-argument branch uses `chain(others)` which iterates over the list of iterables (yielding each iterable object), rather than flattening them. This causes either a `TypeError` for unhashable iterables (lists) or silently inserts the iterable objects themselves (tuples, iterators).\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-22e12aa353c65ac78c26", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:06b8c08d8fd9bd5731ae6867176af0bedc6c906c36f88a98551a86183a5026b2", "task_path": "tasks/swe-next-22e12aa353c65ac78c26", "instruction": "## `JSONLIterator` raises `TypeError` when using `rel_seek` with a binary file stream\n\nWhen opening a JSONL file in binary mode (`'rb'`) and passing it to `JSONLIterator` with a `rel_seek` argument, a `TypeError` is raised immediately on construction. The same file opened in text mode works fine.\n\n### Reproducer\n\n```python\nfrom boltons.jsonutils import JSONLIterator\nimport tempfile, pathlib\n\ntmp = pathlib.Path(tempfile.mkdtemp()) / 'records.jsonl'\ntmp.write_bytes(b'{\"n\": 1}\\n{\"n\": 2}\\n{\"n\": 3}\\n')\n\n# text mode works\nwith tmp.open() as text:\n print(list(JSONLIterator(text, rel_seek=0.4))) # [{'n': 2}, {'n': 3}]\n\n# binary mode raises TypeError\nwith tmp.open('rb') as binary:\n print(list(JSONLIterator(binary, rel_seek=0.4)))\n```\n\n### Error\n\n```\nboltons/jsonutils.py in _align_to_newline\n while '\\n' not in cur:\n ^^^^^^^^^^^^^^^\nTypeError: a bytes-like object is required, not 'str'\n```\n\n### What's happening\n\nInside `_align_to_newline`, the code initializes `cur` as an empty string `''` and searches for the string `'\\n'` in whatever is read from the file. When the file is opened in binary mode, `fo.read()` returns `bytes`, so checking for a `str` newline inside `bytes` raises a `TypeError`.\n\n### Expected behavior\n\nPassing a binary-mode file to `JSONLIterator` with `rel_seek` should work the same as passing a text-mode file — the iterator should seek to the appropriate position and yield the same records regardless of whether the stream is binary or text.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-27bbcd47961fcac7932c", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:27d6858a39a407060ccc38c52d8a9ad89987b04f25bc5333f45fd85b14efa076", "task_path": "tasks/swe-next-27bbcd47961fcac7932c", "instruction": "## `SpecifierSet` is missing `is_subset`, `is_superset`, and `is_disjoint` methods\n\nIt would be useful to be able to compare two `SpecifierSet` objects to determine their set-theoretic relationship — specifically whether one is a subset, superset, or disjoint from the other in terms of the versions they accept.\n\nCurrently, `SpecifierSet` has no such methods, so any attempt to call them fails immediately:\n\n```python\nfrom packaging.specifiers import SpecifierSet\n\nspec = SpecifierSet(\">=3.12,<3.13\")\nother = SpecifierSet(\">=3.12\")\n\n# All of these raise AttributeError\nspec.is_subset(other)\nspec.is_superset(other)\nspec.is_disjoint(other)\n```\n\nThis raises:\n```\nAttributeError: 'SpecifierSet' object has no attribute 'is_subset'\n```\n\n### Expected behavior\n\nThese three methods should be available on `SpecifierSet` and compare the *sets of accepted versions* (not the specifier strings themselves):\n\n- `SpecifierSet(\">=3.12,<3.13\").is_subset(SpecifierSet(\">=3.12\"))` → `True` (every version matching `>=3.12,<3.13` also matches `>=3.12`)\n- `SpecifierSet(\">=3.12\").is_subset(SpecifierSet(\">=3.12,<3.13\"))` → `False`\n- `SpecifierSet(\">=3.12\").is_superset(SpecifierSet(\">=3.12,<3.13\"))` → `True`\n- `SpecifierSet(\"<3.12\").is_disjoint(SpecifierSet(\">=3.12\"))` → `True`\n- `SpecifierSet(\"<3.12\").is_disjoint(SpecifierSet(\">=3.11\"))` → `False`\n\nAdditionally, the methods should:\n- Raise `TypeError` (mentioning `SpecifierSet`) if the argument is not a `SpecifierSet` (e.g. a plain string like `\">=1.0\"`)\n- Raise `ValueError` (mentioning `===`) if either specifier set contains an arbitrary-equality (`===`) specifier\n- Raise `ValueError` (mentioning `pre-release`) if the two sets have mismatched explicit `prereleases` settings\n\nThese methods should delegate to the existing `VersionRange` helpers via `to_range()` internally.\n\n### Steps to reproduce\n\n```python\nfrom packaging.specifiers import SpecifierSet\n\nspec = SpecifierSet(\">=1.0\")\nother = SpecifierSet(\">=1.0\")\n\n# TypeError: argument must be a SpecifierSet, not a string\nspec.is_subset(\">=1.0\") # should raise TypeError\n\n# ValueError: === not supported\nSpecifierSet(\"===1.0\").is_subset(SpecifierSet(\"==1.0\")) # should raise ValueError\n\n# ValueError: pre-release policy mismatch\nSpecifierSet(\">=1.0\", prereleases=True).is_disjoint(SpecifierSet(\">=1.0\", prereleases=False)) # should raise ValueError\n```\n\nPlease add `is_subset`, `is_superset`, and `is_disjoint` methods to `SpecifierSet`.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/packaging`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-2d3bdefc7598cf5d56d3", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:7760a7e664392740685f353b38e62ddf9681f301e042320801121107062bb146", "task_path": "tasks/swe-next-2d3bdefc7598cf5d56d3", "instruction": "## `pluralize()` returns wrong plural for words ending in \"x\" (e.g. \"boxs\" instead of \"boxes\")\n\nThe `pluralize()` function in `boltons.strutils` correctly handles words ending in `s`, `ch`, and `sh` by appending `-es`, but it misses words ending in `x`. This means common words like `box`, `fox`, `tax`, and `prefix` get an incorrect bare `s` appended instead.\n\n```python\nfrom boltons import strutils\n\nprint(strutils.pluralize('box')) # prints 'boxs' (expected 'boxes')\nprint(strutils.pluralize('fox')) # prints 'foxs' (expected 'foxes')\nprint(strutils.pluralize('tax')) # prints 'taxs' (expected 'taxes')\nprint(strutils.pluralize('prefix')) # prints 'prefixs' (expected 'prefixes')\n```\n\nThe same issue applies to capitalized and uppercase variants — `pluralize('Box')` gives `'Boxs'` and `pluralize('FOX')` gives `'FOXS'`.\n\nNote that irregular `-x` words like `ox` (which pluralizes to `oxen`) should remain unaffected since they are resolved from the irregular map before any suffix rule runs.\n\n**Expected behavior:** Words ending in `x` should follow the same `-es` pluralization rule as words ending in `s`, `ch`, or `sh`.\n\n**Actual behavior:** Words ending in `x` get a bare `s` appended, producing invalid plurals like `boxs`, `foxs`, `taxes` → `taxs`.\n\nThe bug is in the condition inside `pluralize()` that checks for these special endings — `x` is simply not included in the check.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-3313d502576d93c95e4d", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:da0144e397e06eaca30692b5e1e8ecc0aba65abb43a8839a9d0c8ad6888cacc9", "task_path": "tasks/swe-next-3313d502576d93c95e4d", "instruction": "## `every().hour.at('MM:SS')` format not parsed correctly\n\nWhen scheduling a job using `every().hour.at()` with the `MM:SS` format (minutes:seconds), the library does not parse the time string correctly. Instead of treating the first component as minutes and the second as seconds, it appears to only pick up the seconds portion and schedule the job incorrectly.\n\n### Steps to reproduce\n\nAssume the current time is `2010-01-06 12:20:00`.\n\n```python\nimport schedule\nfrom schedule import every\n\njob = every().hour.at('30:05').do(lambda: None)\nprint(job.next_run) # Expected: 2010-01-06 12:30:05, Actual: 2010-01-06 13:05:00\nprint(job.next_run.hour) # Expected: 12, Actual: 13\nprint(job.next_run.minute) # Expected: 30, Actual: 5\nprint(job.next_run.second) # Expected: 5, Actual: 0\n```\n\nThe job is shown internally as `Every 1 hour at 00:05:00`, meaning the `30` (minutes) from `'30:05'` is silently dropped and only `05` is used as the seconds value.\n\n### Expected behavior\n\nCalling `every().hour.at('30:05')` should schedule the job to run at 30 minutes and 5 seconds past each hour. Given a current time of 12:20:00, the next run should be `12:30:05`.\n\nSimilarly:\n- `every().hour.at('10:25')` at 12:20 → next run at `13:10:25`\n- `every().hour.at('00:40')` at 12:20 → next run at `13:00:40`\n\n### Actual behavior\n\nThe minute component from the `MM:SS` string is ignored. The scheduler only picks up the second component, resulting in wrong `next_run` values. For example, `every().hour.at('30:05')` produces a next run at `13:05:00` instead of `12:30:05`.\n\nNote: the existing `:MM` format (e.g., `every().hour.at(':30')`) continues to work correctly and should not be broken by any fix.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `schedule`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-34bf5cbb2efdd5377ebd", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:a0de46b6f3f1d5050b49cdff7b2d9bc772b935161d0fe0f7a7bfaf769955655e", "task_path": "tasks/swe-next-34bf5cbb2efdd5377ebd", "instruction": "## `cache.invalidate()` raises `KeyError` when the key is not in the cache\n\nCalling `.invalidate()` on a `@cache`-decorated function raises a `KeyError` if the key being invalidated is not currently in the cache. This makes the method non-idempotent and fragile to use in practice.\n\nFor example, calling `.invalidate()` twice for the same argument crashes on the second call:\n\n```python\nfrom funcy.calc import cache\n\n@cache(timeout=60)\ndef inc(x):\n return x + 1\n\ninc(0) # populates cache\ninc.invalidate(0) # works fine\ninc.invalidate(0) # raises KeyError!\n```\n\nThis also happens when the cache entry has already expired due to a timeout, or when two concurrent threads both try to invalidate the same key and one of them wins the race — the other gets a `KeyError`.\n\nCurrently the error is:\n```\nKeyError: (0,)\n```\n\n**Expected behavior:** `invalidate()` should silently do nothing if the key is not present in the cache, making it safe to call multiple times or in concurrent contexts.\n\n**Actual behavior:** `invalidate()` raises `KeyError` if the key is missing, forcing callers to wrap every invalidation in a `try/except KeyError: pass` block.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `funcy`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-3c14370f74d576f0994a", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:06c24b0460d333079d7dbb502cde322cc9828f77821ba9e97db81167574d3de9", "task_path": "tasks/swe-next-3c14370f74d576f0994a", "instruction": "## `args2sh` and `args2cmd` ignore the `sep` argument\n\nBoth `args2sh` and `args2cmd` accept a `sep` parameter that is documented as the separator placed between arguments. However, both functions hardcode a space as the separator and never actually use the `sep` argument that was passed in.\n\n### Reproduction\n\n```python\nfrom boltons import strutils\n\n# Both return 'aa bb' instead of 'aa|bb'\nprint(strutils.args2sh(['aa', 'bb'], sep='|')) # expected: 'aa|bb'\nprint(strutils.args2cmd(['aa', 'bb'], sep='|')) # expected: 'aa|bb'\n\n# Quoting should still work around the custom separator\nprint(strutils.args2sh(['a a', 'bb'], sep='|')) # expected: \"'a a'|bb\"\nprint(strutils.args2cmd(['a a', 'bb'], sep='|')) # expected: '\"a a\"|bb'\n```\n\n### Expected behavior\n\nWhen `sep='|'` is passed, the arguments should be joined with `|` as the separator. The default (`sep=' '`) should still produce a space-separated string. Quoting and escaping of individual arguments should be unaffected by the separator choice.\n\n### Actual behavior\n\nRegardless of what `sep` is set to, both functions always produce space-separated output. `args2sh` ends with `' '.join(ret_list)` (ignoring `sep`), and `args2cmd` appends a literal `' '` string between arguments instead of using `sep`. The `sep` parameter is effectively dead code in both functions.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-3c14ba03c4e19e46c58e", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:a62df65ed7324a73736703bf0c74d2ae5686984d8fb292f87c8c4f1aa9bf0b5a", "task_path": "tasks/swe-next-3c14ba03c4e19e46c58e", "instruction": "## Bug: Passing `platforms=[]` falls back to host platform tags instead of yielding nothing\n\nWhen explicitly passing an empty list as `platforms` to `cpython_tags()`, `generic_tags()`, or `compatible_tags()`, the functions silently ignore it and substitute the running host's platform tags. This is because the internal check uses `platforms or platform_tags()`, which treats an empty list the same as `None`.\n\n### Reproduction\n\n```python\nfrom packaging import tags\n\n# Expect no tags when platforms is explicitly empty\nresult = list(tags.cpython_tags((3, 11), abis=[\"whatever\"], platforms=[]))\nprint(len(result)) # Prints 492 instead of 0\n\nresult = list(tags.generic_tags(\"sillywalk\", [\"abi\"], []))\nprint(len(result)) # Prints 82 instead of 0\n\n# For compatible_tags, only the platform-independent *-none-any tags should appear\nresult = list(tags.compatible_tags((3,), \"cp3\", []))\nprint(result) # Prints many platform-specific tags, should only contain cp3-none-any and py3-none-any\n```\n\n### Expected behavior\n\n- `cpython_tags(..., platforms=[])` should return an empty iterator, since there are no platforms to generate tags for.\n- `generic_tags(..., platforms=[])` should similarly return an empty iterator.\n- `compatible_tags(..., platforms=[])` should only yield the platform-independent `*-none-any` tags (`cp3-none-any` and `py3-none-any`), not any platform-specific tags.\n\n### Actual behavior\n\nAll three functions treat `platforms=[]` as equivalent to `platforms=None` and fall back to calling `platform_tags()` internally, producing tags for the current host's platform. The distinction between \"no platforms specified\" and \"explicitly no platforms\" is lost.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/packaging`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-3c920dd5ccac243d2b04", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:cd05576fcf12106caf13e3997fd30176d052cc611ec872f996ee8eee9202e482", "task_path": "tasks/swe-next-3c920dd5ccac243d2b04", "instruction": "## `Bits` with zero length serializes as `'0'` instead of `''`\n\nWhen creating an empty `Bits` object (length 0) and calling `as_bin()`, the result is `'0'` instead of an empty string `''`. This means empty `Bits` values don't round-trip correctly through binary, hex, or byte conversions.\n\nHere's a minimal example that demonstrates the problem:\n\n```python\nfrom boltons.mathutils import Bits\n\nbits = Bits('') # empty Bits, length 0\nprint(len(bits)) # 0\nprint(repr(bits.as_bin())) # prints '0', expected ''\nprint(repr(bits.as_hex())) # also broken\nprint(repr(bits.as_bytes())) # also broken\n```\n\nThe same issue occurs regardless of how the empty `Bits` is constructed:\n\n```python\nfor bits in (Bits(''), Bits([]), Bits('101')[:0], Bits(0, 0)):\n print(len(bits)) # all 0\n print(bits.as_bin()) # should be '', but gets '0'\n print(bits.as_hex()) # should be ''\n print(bits.as_bytes()) # should be b''\n # round-trip via from_hex('') also fails\n print(Bits.from_hex(bits.as_hex())) # raises or returns wrong value\n```\n\n**Expected behavior:** An empty `Bits` (length 0) should serialize to `''` from `as_bin()`, `''` from `as_hex()`, and `b''` from `as_bytes()`. Round-tripping through `from_bin('')`, `from_hex('')`, and `from_bytes(b'')` should return an equal empty `Bits`.\n\n**Actual behavior:** `as_bin()` returns `'0'` instead of `''` for a zero-length `Bits`. The `as_hex()` and `as_bytes()` methods similarly fail to handle the empty case, and `from_hex('')` raises an error when trying to parse an empty hex string.\n\nThe fix should add early-return guards in `as_bin`, `as_hex`, and `from_hex` (and any related methods) for the zero-length case.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-3f3b18abb70458ce0d66", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:9779385cdb7dc9f9c2b092988470a6b678fdfb37fbd616fad35ae0e3186b228f", "task_path": "tasks/swe-next-3f3b18abb70458ce0d66", "instruction": "## `reraise` does not support callable as `into` argument\n\nWhen passing a callable (e.g., a lambda) as the `into` argument to `reraise`, a `TypeError` is raised instead of the expected exception. The callable should be invoked with the caught exception to produce the exception to re-raise.\n\n### Example\n\n```python\nfrom funcy.flow import reraise\n\nclass MyError(Exception):\n pass\n\n# Using a lambda as the `into` argument\nwith reraise(ValueError, lambda _: MyError):\n raise ValueError\n```\n\n### Expected behavior\n\nThe lambda is called with the caught `ValueError` instance, returns `MyError`, and `MyError` is raised — so the block should raise `MyError`.\n\n### Actual behavior\n\nInstead of calling the lambda and raising `MyError`, the code attempts to raise the lambda itself, resulting in:\n\n```\nTypeError: exceptions must derive from BaseException\n```\n\nThe `into` argument should support callables so users can transform exceptions before re-raising without needing extra helper functions or nested `try/except` blocks.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `funcy`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-4171c9efed7199b76427", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:bddffdafdbe3fd8d73018bb4fbe736f750e775a91cca0f58eefaff83cacbbd6c", "task_path": "tasks/swe-next-4171c9efed7199b76427", "instruction": "## `Description-Content-Type` with lowercase `charset=utf-8` is incorrectly rejected\n\nWhen parsing package metadata that includes a `Description-Content-Type` header with a lowercase or mixed-case UTF-8 charset (e.g. `charset=utf-8` or `charset=Utf-8`), the `packaging` library raises an `InvalidMetadata` error even though these values are semantically equivalent to `charset=UTF-8`.\n\n### Example\n\n```python\nfrom packaging import metadata\n\n# This raises InvalidMetadata even though charset=utf-8 is valid\nmeta = metadata.Metadata.from_email(\n \"Metadata-Version: 2.6\\n\"\n \"Name: packaging\\n\"\n \"Version: 1.0\\n\"\n \"Description-Content-Type: text/plain; charset=utf-8\\n\"\n)\nprint(meta.description_content_type) # Should print: text/plain; charset=utf-8\n```\n\nThis raises:\n```\nExceptionGroup: invalid or unparsed metadata (1 sub-exception)\n packaging.metadata.InvalidMetadata: 'description-content-type' can only specify the UTF-8 charset, not 'utf-8'\n```\n\nSimilarly, accessing `description_content_type` on metadata constructed with `charset=utf-8` or `charset=Utf-8` also fails:\n\n```python\nmeta = metadata.Metadata.from_raw(\n {\"description_content_type\": \"text/plain; charset=utf-8\"}, validate=False\n)\nprint(meta.description_content_type) # Raises InvalidMetadata\n```\n\n### Expected behavior\n\nCharset comparisons for `Description-Content-Type` should be case-insensitive. `charset=utf-8`, `charset=Utf-8`, and `charset=UTF-8` should all be accepted as valid, since charset names are case-insensitive by the MIME standard.\n\n### Actual behavior\n\nOnly the exact uppercase form `charset=UTF-8` is accepted. Any other casing (e.g. `utf-8`, `Utf-8`) causes `InvalidMetadata` to be raised with the message: `'description-content-type' can only specify the UTF-8 charset, not 'utf-8'`.\n\nThe fix is to compare the charset value case-insensitively in `_Validator._process_description_content_type` inside `src/packaging/metadata.py` — change the strict equality check `charset != \"UTF-8\"` to a case-insensitive check such as `charset.lower() != \"utf-8\"`.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/packaging`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-43f0bb60fa39009c9cf3", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:9df9453b26d04d39e1f311e1acd9169add8c8b822c747534abc9c500441ff7e4", "task_path": "tasks/swe-next-43f0bb60fa39009c9cf3", "instruction": "## `packaging.tags` is missing a `pure_python_tags()` function\n\n### Description\n\nThe `packaging.tags` module does not expose a `pure_python_tags()` function, but one is needed to generate pure-Python compatibility tags (`py*-none-any`) without having to query the running platform. Currently, the only way to get those tags is through `compatible_tags()`, which bundles them with platform-specific and ABI-specific tags.\n\nWhen trying to call `tags.pure_python_tags(...)`, you get:\n\n```\nAttributeError: module 'packaging.tags' has no attribute 'pure_python_tags'. Did you mean: 'cpython_tags'?\n```\n\nHere is a minimal reproduction:\n\n```python\nfrom packaging import tags\n\n# Should yield: py33-none-any, py3-none-any, py32-none-any, py31-none-any, py30-none-any\nresult = list(tags.pure_python_tags((3, 3)))\n\n# Should yield a single tag: py3-none-any\nsingle = list(tags.pure_python_tags((3,)))\n\n# Should raise ValueError\ntry:\n list(tags.pure_python_tags(()))\nexcept ValueError as e:\n print(e) # expected: \"must contain at least one item\"\n\n# Should default to sys.version_info[:2] when called with no arguments\ndefault = list(tags.pure_python_tags())\n```\n\nAdditionally, `pure_python_tags()` should **not** call `platform_tags()` internally — the whole point is that it works without inspecting the running platform:\n\n```python\nfrom packaging import tags\n\n# Patching platform_tags to detect if it gets called\noriginal = tags.platform_tags\ntags.platform_tags = lambda: (_ for _ in ()).throw(AssertionError(\"platform queried!\"))\n\n# This should work fine without triggering platform detection\nresult = list(tags.pure_python_tags((3,)))\nprint(result) # []\n\ntags.platform_tags = original\n```\n\n### Expected behavior\n\n- `tags.pure_python_tags((3, 3))` returns an iterator of `Tag` objects: `py33-none-any`, `py3-none-any`, `py32-none-any`, `py31-none-any`, `py30-none-any`.\n- `tags.pure_python_tags((3,))` returns `[Tag(\"py3\", \"none\", \"any\")]`.\n- `tags.pure_python_tags(())` raises `ValueError` with a message like `\"must contain at least one item\"`.\n- `tags.pure_python_tags()` (no args) defaults to `sys.version_info[:2]`.\n- The function never queries the running platform.\n\n### Actual behavior\n\nCalling `tags.pure_python_tags(...)` raises:\n\n```\nAttributeError: module 'packaging.tags' has no attribute 'pure_python_tags'. Did you mean: 'cpython_tags'?\n```\n\nThe function simply does not exist in the module.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/packaging`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-4820778e75de86be60f1", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:8acfbaa32593da55fb3aa0c000f98fd6d15c329e3d992e767520480dfe542bf6", "task_path": "tasks/swe-next-4820778e75de86be60f1", "instruction": "## `schedule.next_run()` does not support filtering by tag\n\nCurrently, calling `schedule.next_run()` with a tag argument raises a `TypeError` because the function doesn't accept any parameters. There is no way to ask \"when is the next run for jobs with a specific tag?\"\n\n### Reproduction\n\n```python\nimport schedule\nfrom schedule import every\n\ndef job(): pass\n\nevery(5).seconds.do(job).tag(\"tag1\")\nevery(2).hours.do(job).tag(\"tag1\", \"tag2\")\nevery(1).minutes.do(job).tag(\"tag1\", \"tag3\", \"tag2\")\n\n# Trying to get the next run time for jobs tagged \"tag1\"\nprint(schedule.next_run(\"tag1\"))\n```\n\nThis raises:\n```\nTypeError: next_run() takes 0 positional arguments but 1 was given\n```\n\nSimilarly, `schedule.default_scheduler.next_run` (a property) cannot be called with a tag to filter results, and there is no `get_next_run(tag)` method on the `Scheduler` class.\n\n### Expected behavior\n\n- `schedule.next_run(\"tag1\")` should return the `next_run` datetime of the earliest-scheduled job that has the tag `\"tag1\"`.\n- `schedule.next_run(\"tag4\")` should return `None` if no jobs have that tag.\n- `schedule.default_scheduler.get_next_run(\"tag2\")` should return the earliest next run among jobs tagged `\"tag2\"`.\n- Calling `schedule.next_run()` with no arguments should continue to work as before (returning the global next run across all jobs).\n\n### Actual behavior\n\nPassing any tag argument to `schedule.next_run()` raises `TypeError: next_run() takes 0 positional arguments but 1 was given`. There is no tag-aware method available on the `Scheduler` class either.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `schedule`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-4d4ba5eb3310787bdb56", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:ba12d128cf1b76e8054e420259d2941da1ec84a695fbcd8eab9a513d2b928511", "task_path": "tasks/swe-next-4d4ba5eb3310787bdb56", "instruction": "## `BETWEEN` keyword misidentified as a Name when followed by a leading-dot float literal\n\n### Description\n\nWhen parsing a SQL statement that uses `BETWEEN` with float literals written without a leading zero (e.g. `.03`, `.06`), sqlparse incorrectly demotes `BETWEEN` from a keyword token to a `Name` token. The float bounds are also no longer recognized as standalone number tokens.\n\nThis can be reproduced as follows:\n\n```python\nimport sqlparse\nfrom sqlparse import tokens as T\n\nsql = \"a BETWEEN .03 AND .06\"\np = sqlparse.parse(sql)[0]\n\n# Check that BETWEEN is recognized as a keyword\nkw = p.token_next_by(m=(T.Keyword, 'BETWEEN'))[1]\nprint(\"BETWEEN token:\", kw) # prints None — BETWEEN is not found as a keyword!\n\n# Check that the float literals are recognized\nfloats = [t for t in p.flatten() if t.ttype is T.Number.Float]\nprint(\"Float tokens:\", [t.value for t in floats]) # prints [] — no floats found!\n```\n\nThe same issue occurs with lowercase: `a between .03 and .06`.\n\n### Expected behavior\n\n- `BETWEEN` (and `between`) should be recognized as a `T.Keyword` token.\n- `.03` and `.06` should each be recognized as `T.Number.Float` tokens.\n- `AND` should remain a keyword token.\n\n### Actual behavior\n\n`BETWEEN` is classified as a `Name` token (not a keyword), the float bounds `.03` and `.06` are not identified as standalone float tokens, and the overall statement is grouped incorrectly. The `BETWEEN` keyword lookup returns `None`.\n\n### Root cause\n\nThe lexer rule for `schema.name` member access — which matches a word followed by a period — also fires when `BETWEEN` appears before a float literal like `.03`. The period at the start of `.03` is mistakenly treated as a member-access operator, causing `BETWEEN` to be reclassified as a `Name`.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `sqlparse`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-4d757714271528211886", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:563cd80c81c22092384cc16bbffc6b225106d9ff05a6fd7034c23a49581b6a34", "task_path": "tasks/swe-next-4d757714271528211886", "instruction": "## `USTimeZone` ignores `datetime.fold` during US DST fall-back transitions\n\nThe `Eastern` (and other `USTimeZone`) timezone objects from `boltons.timeutils` do not respect PEP 495's `fold` attribute during the ambiguous fall-back hour. During the US fall DST transition, the local clock repeats the hour from 2:00 AM back to 1:00 AM. Any wall time in that repeated hour is ambiguous — `fold=0` should mean the first occurrence (still in daylight time, EDT, UTC-4) and `fold=1` should mean the second occurrence (standard time, EST, UTC-5). Currently, both always resolve to EST.\n\n### Reproducing the fold-awareness bug\n\n```python\nfrom datetime import timedelta, datetime\nfrom boltons.timeutils import Eastern\n\n# 2011-11-06 01:30 is ambiguous: occurs twice during fall-back\nunfolded = datetime(2011, 11, 6, 1, 30, tzinfo=Eastern, fold=0) # should be EDT (UTC-4)\nfolded = datetime(2011, 11, 6, 1, 30, tzinfo=Eastern, fold=1) # should be EST (UTC-5)\n\nprint(unfolded.utcoffset()) # prints -1 day, 68400s (i.e. -5h) — wrong, expected -4h\nprint(unfolded.tzname()) # prints 'EST' — wrong, expected 'EDT'\nprint(folded.utcoffset()) # prints -5h — correct\nprint(folded.tzname()) # prints 'EST' — correct\n```\n\n`unfolded.utcoffset()` returns `-05:00` instead of the expected `-04:00`, and `unfolded.tzname()` returns `'EST'` instead of `'EDT'`.\n\n### Reproducing the `fromutc` / round-trip bug\n\nConverting two distinct UTC instants that both map to local `01:30` on the same fall-back day produces indistinguishable results:\n\n```python\nfrom datetime import datetime, timezone\nfrom boltons.timeutils import Eastern\n\n# 05:30 UTC = 01:30 EDT (first occurrence, fold=0)\nfirst = datetime(2011, 11, 6, 5, 30, tzinfo=timezone.utc).astimezone(Eastern)\n# 06:30 UTC = 01:30 EST (second occurrence, fold=1)\nsecond = datetime(2011, 11, 6, 6, 30, tzinfo=timezone.utc).astimezone(Eastern)\n\nprint(first.tzname()) # prints 'EST' — wrong, expected 'EDT'\nprint(first.fold) # should be 0\nprint(second.tzname()) # prints 'EST' — correct\nprint(second.fold) # should be 1\n```\n\n`first.tzname()` returns `'EST'` instead of `'EDT'`, and `second.fold` is not set to `1`, making the two distinct UTC instants indistinguishable after conversion to local time.\n\n### Expected behavior\n\n- For ambiguous wall times in the fall-back hour, `fold=0` should give the daylight-time interpretation (EDT, UTC-4) and `fold=1` should give the standard-time interpretation (EST, UTC-5).\n- `fromutc()` should correctly mark the second occurrence of a repeated local time with `fold=1` and return the appropriate timezone name for each occurrence.\n\n### Actual behavior\n\n- `USTimeZone.dst()` always returns `ZERO` (standard time) for the entire repeated fall-back hour, ignoring `fold`.\n- `USTimeZone` does not implement `fromutc()`, so repeated local times cannot be distinguished after UTC conversion.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-4d8b488b1f91c879d054", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:96f1f7e77ac892d654e0558444659c6f6969c39a588264251796e6d40100492e", "task_path": "tasks/swe-next-4d8b488b1f91c879d054", "instruction": "## `has_path` function missing from `funcy.colls`\n\n### Description\n\nThere's no `has_path` function available in `funcy` for checking whether a nested path exists in a collection. This is quite useful when working with nested dicts or lists, for example:\n\n```python\nfrom funcy.colls import has_path\n\nd = {\n \"a\": {\n \"b\": \"c\",\n \"d\": \"e\",\n \"f\": {\n \"g\": \"h\"\n }\n },\n \"i\": \"j\"\n}\n\n# Check if a path exists before accessing it\nhas_path(d, [\"a\", \"f\", \"g\"]) # should return True\nhas_path(d, [\"m\"]) # should return False\nhas_path(d, [\"m\", \"n\"]) # should return False\n```\n\nIt should also work with lists:\n\n```python\nhas_path([1, 2], [0]) # should return True\nhas_path([1, 2], [3]) # should return False\nhas_path({'x': [1, 2]}, ['x', 1]) # should return True\n```\n\n### Expected behavior\n\n`has_path(coll, path)` should return `True` if the full sequence of keys/indices in `path` exists within the nested collection `coll`, and `False` otherwise. It should work for both dicts and lists (or mixed nesting).\n\n### Actual behavior\n\nCalling `has_path` raises a `NameError` because the function does not exist:\n\n```\nNameError: name 'has_path' is not defined\n```\n\nThe function needs to be implemented and exported from `funcy.colls`.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `funcy`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-584a4532d13b27c6cca7", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:75881388186274326c3b3478864c364435621cdd738d4f9fc970503045765c09", "task_path": "tasks/swe-next-584a4532d13b27c6cca7", "instruction": "## `complement` set `<=` and `>=` comparisons raise `AttributeError`\n\nComparing two `complement` sets with `<=` or `>=` raises an `AttributeError` instead of returning a boolean result.\n\n### Steps to reproduce\n\n```python\nfrom boltons.setutils import complement\n\ncab = complement('ab')\n\n# This should return True — complement('ab') is a subset of complement('a')\nresult = cab <= complement('a')\nprint(result)\n```\n\nRunning this raises:\n\n```\nAttributeError: 'set' object has no attribute 'issupserset'. Did you mean: 'issuperset'?\n```\n\nSimilarly, `>=` between two complement sets fails:\n\n```python\nfrom boltons.setutils import complement\n\nca = complement('a')\ncab = complement('ab')\n\n# Should return True\nresult = ca >= cab\nprint(result)\n```\n\nSame `AttributeError` is raised.\n\n### Expected behavior\n\n- `complement('ab') <= complement('a')` should return `True` (since `'a' ⊆ 'ab'`, complement of `'ab'` is a subset of complement of `'a'`)\n- `complement('a') >= complement('ab')` should return `True` for the same reason\n- `complement('ab') <= complement('ab')` should return `True` (equal sets)\n\n### Actual behavior\n\nBoth `<=` and `>=` raise `AttributeError: 'set' object has no attribute 'issupserset'` when both operands are complement sets. The method `issupserset` does not exist on Python's built-in `set` — the correct spelling is `issuperset`. This typo exists in the `- -` branch of `__le__` and the `+ +` branch of `__ge__` in `_ComplementSet`.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-5a0e26bb0159a67bbbc0", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:318f444ea11a4857ecbc3311c3c4e5de647cb1442a7476acc4800323491adac9", "task_path": "tasks/swe-next-5a0e26bb0159a67bbbc0", "instruction": "## `Pylock.select()` does not support `prefer_sdist_predicate` argument\n\nWhen calling `Pylock.select()` with a `prefer_sdist_predicate` keyword argument, a `TypeError` is raised because the method does not accept that parameter.\n\nThe expected behavior is that `prefer_sdist_predicate` should be a callable that takes a normalized package name and returns `True` if the source distribution should be preferred over available wheels for that package. If no sdist is available for a package, the predicate should not be called and wheel selection should proceed as normal.\n\n### Example\n\n```python\nfrom packaging.pylock import Package, PackageSdist, PackageWheel, Pylock\nfrom packaging.tags import sys_tags\nfrom packaging.version import Version\nfrom typing import cast\n\npylock = Pylock(\n lock_version=Version(\"1.0\"),\n created_by=\"some_tool\",\n packages=[\n Package(\n name=cast(\"NormalizedName\", \"foo\"),\n sdist=PackageSdist(path=\"foo-1.0.tar.gz\", hashes={\"sha256\": \"abc123\"}),\n wheels=[\n PackageWheel(path=\"./foo-1.0-py3-none-any.whl\", hashes={\"sha256\": \"abc123\"})\n ],\n )\n ],\n)\npylock.validate()\n\ndef prefer_sdist(name):\n return True # always prefer source distributions\n\nresult = list(pylock.select(prefer_sdist_predicate=prefer_sdist))\n```\n\nRunning this raises:\n\n```\nTypeError: Pylock.select() got an unexpected keyword argument 'prefer_sdist_predicate'\n```\n\n### Expected behavior\n\n`Pylock.select()` should accept a `prefer_sdist_predicate` callable. When the predicate returns `True` for a given package name and an sdist is available, the sdist should be yielded instead of a compatible wheel. If no sdist is available for a package, the predicate should not be called and normal wheel selection should apply. When no wheels exist and the predicate returns `False`, the sdist should still be selected as a fallback.\n\n### Actual behavior\n\n`Pylock.select()` raises `TypeError: Pylock.select() got an unexpected keyword argument 'prefer_sdist_predicate'` regardless of the arguments passed.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/packaging`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-5e830173928160b2ece0", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:8803240daf1d95acaf11a2ceb020483cbfbcd8c38b97112ca58cc05634c71e5f", "task_path": "tasks/swe-next-5e830173928160b2ece0", "instruction": "**`TimestampSigner.unsign` does not raise `SignatureExpired` when the token was signed in the future**\n\nWhen a token is signed at a future time (relative to when `unsign` is called), the computed age is negative. Currently, `unsign` does not raise any error in this case, even when `max_age` is specified. It should raise `SignatureExpired` to indicate the signature cannot be trusted.\n\n**Reproducer:**\n\n```python\nfrom freezegun import freeze_time\nfrom itsdangerous.timed import TimestampSigner\nfrom itsdangerous.exc import SignatureExpired\n\nsigner = TimestampSigner(\"secret-key\")\n\n# Sign a value \"now\" (e.g., 2020-01-01)\nsigned = signer.sign(\"value\")\n\n# Travel back in time — the signature was created in the \"future\"\nwith freeze_time(\"1971-05-31\"):\n # This should raise SignatureExpired, but currently does not\n signer.unsign(signed, max_age=10)\n```\n\n**Expected behavior:**\nWhen the token's embedded timestamp is in the future relative to the current time at verification, `unsign` should raise `SignatureExpired` (with a message indicating the age is negative, e.g., `\"Signature age -N < 0 seconds\"`).\n\n**Actual behavior:**\n`unsign` returns successfully without raising any exception, even though the computed age is negative (the token appears to be from the future). This means a token with a future timestamp bypasses expiry checks entirely.\n\nThe fix should add a check in `TimestampSigner.unsign`: if the computed age is less than 0, raise `SignatureExpired` with the payload and `date_signed`.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/itsdangerous`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-60eb23e74aa4d73ebd78", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:7bf36735eab341469ed161a637201ceed1e14f7f6008bf93f877ad3df9aca279", "task_path": "tasks/swe-next-60eb23e74aa4d73ebd78", "instruction": "## Missing `interpreter_abi()` function in `packaging.tags`\n\nThe `packaging.tags` module is missing a public `interpreter_abi()` function that returns the ABI tag string for the currently running interpreter.\n\n### Description\n\nWhen trying to call `tags.interpreter_abi()`, an `AttributeError` is raised because the function does not exist:\n\n```\nAttributeError: module 'packaging.tags' has no attribute 'interpreter_abi'. Did you mean: 'interpreter_name'?\n```\n\nThe function should return the ABI tag string that corresponds to the most specific tag for the running interpreter. For example:\n- For CPython 3.12, it should return something like `\"cp312\"`\n- For PyPy with EXT_SUFFIX `.pypy39-pp73-x86_64-linux-gnu.so`, it should return `\"pypy39_pp73\"`\n\nHere's a test that exercises the expected behavior:\n\n```python\ndef test_interpreter_abi(monkeypatch):\n # PyPy case\n monkeypatch.setattr(tags, \"interpreter_name\", lambda: \"pp\")\n monkeypatch.setattr(\n sysconfig,\n \"get_config_var\",\n {\"EXT_SUFFIX\": \".pypy39-pp73-x86_64-linux-gnu.so\"}.get,\n )\n assert tags.interpreter_abi() == \"pypy39_pp73\"\n\n # CPython case\n monkeypatch.setattr(sysconfig, \"get_config_var\", {\"Py_DEBUG\": 0}.get)\n monkeypatch.setattr(tags, \"interpreter_name\", lambda: \"cp\")\n assert tags.interpreter_abi() == f\"cp{sys.version_info.major}{sys.version_info.minor}\"\n```\n\n### Expected behavior\n\n`packaging.tags` should expose a public `interpreter_abi()` function that returns the ABI tag string for the current interpreter. For CPython it should delegate to the CPython ABI logic (e.g. `_cpython_abis`), and for other interpreters it should use the generic ABI logic (e.g. `_generic_abi`).\n\n### Actual behavior\n\nCalling `tags.interpreter_abi()` raises `AttributeError: module 'packaging.tags' has no attribute 'interpreter_abi'`. The function does not exist at all in the current module.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/packaging`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-61b6bcfdef57cdea0391", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:6e481fae4622a3cc4787b703f97119d288e225972e36e23ba743c8da3a166fda", "task_path": "tasks/swe-next-61b6bcfdef57cdea0391", "instruction": "## `log_durations` uses `time.time` instead of a patchable `timer` reference\n\n### Description\n\nThe `log_durations` context manager/decorator in `funcy.debug` currently measures elapsed time using `time.time()`. The tests expect the module to expose a `timer` name (imported as `from timeit import default_timer as timer`) so that it can be monkeypatched for deterministic testing.\n\nRight now, trying to patch `funcy.debug.timer` raises an `AttributeError` because no such attribute exists in the module:\n\n```python\nfrom funcy.debug import log_durations\n\ndef test_log_durations(monkeypatch):\n timestamps = iter([0, 0.01, 1, 1.000025])\n monkeypatch.setattr('funcy.debug.timer', lambda: next(timestamps))\n log = []\n\n f = log_durations(log.append)(lambda: None)\n f()\n with log_durations(log.append, 'hello'):\n pass\n # expects log entries like ['10.00 ms', '25.00 mks']\n```\n\nRunning this produces:\n\n```\nAttributeError: 'module' object at funcy.debug has no attribute 'timer'\n```\n\nThe same failure occurs for the `log_durations` exception/threshold variant test.\n\n### Expected behavior\n\n`funcy/debug.py` should import `timeit.default_timer` under the name `timer` (i.e., `from timeit import default_timer as timer`) and use `timer()` instead of `time.time()` inside `log_durations` and `log_iter_durations`. This makes the timer injectable/patchable for tests and also provides a more precise, monotonic clock.\n\n### Actual behavior\n\nThe module uses `import time` and calls `time.time()` directly, so there is no `timer` attribute in `funcy.debug` to monkeypatch. Any attempt to patch `funcy.debug.timer` raises `AttributeError: 'module' object at funcy.debug has no attribute 'timer'`.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `funcy`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-643a3e6b9ccba6d2406d", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:395f1d207a2d064085773bd039133f6f7f5d7e6e0bb22cd1c1f2adc3a698954f", "task_path": "tasks/swe-next-643a3e6b9ccba6d2406d", "instruction": "## Bug: `GUIDerator` error message says `20 < size <= 36` but 20 is actually a valid size\n\nThe `GUIDerator` class accepts sizes between 20 and 36 inclusive (the guard is `if size < 20 or size > 36`), and the docstring confirms this. However, the `ValueError` raised for out-of-range sizes says `expected 20 < size <= 36`, which incorrectly implies that `size=20` is invalid.\n\nThis inconsistency becomes apparent when you check the error message for an invalid size:\n\n```python\nfrom boltons.iterutils import GUIDerator\n\n# size=20 is accepted without error (correct behavior)\ng = GUIDerator(size=20)\nprint(len(next(g))) # prints 20\n\n# but passing size=19 raises a misleading error message\ntry:\n GUIDerator(size=19)\nexcept ValueError as e:\n print(e) # prints: expected 20 < size <= 36\n```\n\nThe error message `expected 20 < size <= 36` is wrong — it suggests 20 is not a valid size, but `GUIDerator(size=20)` works fine. The message should say `expected 20 <= size <= 36` to accurately reflect the inclusive lower bound.\n\n**Expected behavior:** When an out-of-range size like 19 or 37 is passed, the `ValueError` message should read `expected 20 <= size <= 36`.\n\n**Actual behavior:** The message reads `expected 20 < size <= 36`, which contradicts both the actual validation logic and the documented valid range.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-67d12b180b736a0c0e3d", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:6ba7cbad24126d457b0e248551a1cefb7c466fd8bfc81ff95629f27a54a80be9", "task_path": "tasks/swe-next-67d12b180b736a0c0e3d", "instruction": "Title: `relative_time` / `decimal_relative_time` raises `TypeError` when called with an aware datetime and no comparison time\n\n## Description\n\nWhen you call `decimal_relative_time()` or `relative_time()` with a timezone-aware datetime and omit the `other` argument, a `TypeError` is raised because the internally-computed default comparison time is always naive.\n\n```python\nfrom datetime import datetime, timezone\nfrom boltons.timeutils import decimal_relative_time, relative_time\n\nnow_utc = datetime.now(timezone.utc)\nprint(decimal_relative_time(now_utc)) # TypeError here\nprint(relative_time(now_utc)) # TypeError here\n```\n\nThe same happens with any fixed-offset timezone, e.g. `timezone(timedelta(hours=5, minutes=30))`.\n\n## Error message\n\n```\nTypeError: can't subtract offset-naive and offset-aware datetimes\n```\n\nThe traceback points to the subtraction `other - d` inside `decimal_relative_time` in `boltons/timeutils.py`.\n\n## Expected behavior\n\nWhen `other` is not supplied, the function should default to the current time in the **same timezone** as the input datetime. Calling `decimal_relative_time(datetime.now(timezone.utc))` should return `(0.0, 'seconds')` and `relative_time(datetime.now(timezone.utc))` should return `'0 seconds ago'`. The same should hold for naive datetimes (existing behavior) and any other fixed-offset timezone.\n\n## Actual behavior\n\nThe default `other` is always constructed as a naive datetime (`datetime.now(timezone.utc).replace(tzinfo=None)`), so subtracting it from an aware datetime unconditionally raises `TypeError`.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-67d2ba792fd32dbea8d8", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:a9074c82ea72ce198acb63316aa3098f6d934bd6ed931efb7ef2a0dc6fd00fb0", "task_path": "tasks/swe-next-67d2ba792fd32dbea8d8", "instruction": "## `BarrelList` slicing raises `ValueError` for negative stop/start and gives wrong results for reverse steps\n\n### Description\n\nWhen slicing a `BarrelList` with negative bounds or a negative step, the results either raise a `ValueError` or don't match the equivalent plain Python list slice.\n\nFor example:\n\n```python\nfrom boltons.listutils import BarrelList\n\nreference = list(range(8))\nvalue = BarrelList(reference)\n\n# This raises ValueError instead of returning an empty list\nprint(list(value[20:-20:-1]))\n\n# These should match the reference list\nfor key in [slice(None, -20, -1), slice(-2, 2, -1), slice(20, 0, -2)]:\n result = list(value[key])\n expected = reference[key]\n print(f\"{key}: got {result}, expected {expected}\")\n```\n\nRunning the above triggers:\n\n```\nValueError: Stop argument for islice() must be None or an integer: 0 <= x <= sys.maxsize.\n```\n\nThe error comes from `iter_slice` in `listutils.py`, which attempts to negate and re-sign start/stop values for reverse iteration without first clamping them to valid, non-negative indices. Large negative values (like `-20` on a list of 8 elements) survive the arithmetic and get passed directly to `islice()`, which rejects negative stop arguments.\n\nEven in cases that don't crash, slices with explicit bounds and a negative step return wrong results compared to a plain Python list, because the sign-flip logic misinterprets what the bounds mean after negation.\n\n### Expected behavior\n\nAll slices on a `BarrelList` should produce the same result as the same slice on an equivalent Python list, regardless of whether the bounds are `None`, negative, zero, positive, or out-of-range, and regardless of whether the step is positive or negative.\n\n### Actual behavior\n\nSlices with negative stop values (especially large ones like `-20`) passed to `islice()` raise:\n\n```\nValueError: Stop argument for islice() must be None or an integer: 0 <= x <= sys.maxsize.\n```\n\nAnd slices with negative steps but explicit start/stop bounds return incorrect (wrong-order or wrong-element) results instead of matching the Python list behavior.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-6b247837df52ac26284a", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:76681aacea40aea97c08cfb5f70a2d747da88d351dbbf53ce41dbb67d82d6331", "task_path": "tasks/swe-next-6b247837df52ac26284a", "instruction": "## `AtomicSaver` and `iter_find_files` crash when given a `pathlib.Path`\n\nBoth `AtomicSaver` and `iter_find_files` in `boltons.fileutils` fail when passed a `pathlib.Path` instead of a plain string path.\n\n### `AtomicSaver` example\n\n```python\nimport pathlib\nfrom boltons import fileutils\n\ndest = pathlib.Path('/tmp/output.bin')\nwith fileutils.AtomicSaver(dest) as f:\n f.write(b'hello')\n```\n\nThis raises:\n```\nTypeError: unsupported operand type(s) for +: 'PosixPath' and 'str'\n```\n\nThe error occurs internally when building the `.part` temporary path via `dest_path + '.part'`, because `dest_path` is stored as the raw `Path` object rather than being converted to a string first.\n\n### `iter_find_files` example\n\n```python\nimport pathlib\nfrom boltons.fileutils import iter_find_files\n\nresults = list(iter_find_files(pathlib.Path('/some/directory'), patterns=['*.py']))\n```\n\nThis raises:\n```\nAttributeError: 'PosixPath' object has no attribute 'split'\n```\n\nThe error occurs because `iter_find_files` calls `directory.split(os.path.sep)` to compute the starting depth, which only works on plain strings.\n\n### Expected behavior\n\nBoth `AtomicSaver` and `iter_find_files` should accept any `os.PathLike` object (including `pathlib.Path`) in addition to plain strings, consistent with how the rest of the standard library handles path arguments.\n\n### Fix\n\n- In `AtomicSaver.__init__`, convert `dest_path` to a string via `os.fspath()` before storing it, and use the already-converted `self.dest_path` when building the `.part` path.\n- In `iter_find_files`, convert `directory` via `os.fspath()` before calling `.split()`.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-6d1785abde41e3764200", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:7d823206671a58acea7ec323ab69854580cbd99ea5da8cb7b83d8d255e397f8c", "task_path": "tasks/swe-next-6d1785abde41e3764200", "instruction": "## `iter_splitlines` incorrectly splits text containing ` 28` or ` 29`, and doesn't recognize Unicode line separators\n\n### Description\n\nThere's a bug in `iter_splitlines()` (and by extension `indent()`) where the line-ending regex uses `\\x2028` and `\\x2029` to try to match the Unicode line separator (U+2028) and paragraph separator (U+2029). However, `\\x` escapes in Python regex only consume **two** hex digits, so `\\x2028` is interpreted as `\\x20` (a space) followed by the literal characters `2` and `8`. This causes two separate problems:\n\n1. **Unicode line/paragraph separators are not recognized as line endings** — text using U+2028 or U+2029 is returned as a single unsplit chunk.\n2. **Ordinary text containing ` 28` or ` 29` (space + digits) is incorrectly split** — for example, date strings like `\"February 28\"` get broken apart.\n\n### Reproducing the issue\n\n```python\nfrom boltons import strutils\n\n# Unicode line separator should split the string\ntext = '\\u2028first\\u2028second\\u2028'\nprint(list(strutils.iter_splitlines(text)))\n# Expected: ['', 'first', 'second', '']\n# Actual: ['\\u2028first\\u2028second\\u2028'] (no split at all)\n\n# Plain text with \" 28\" or \" 29\" should NOT be split\ntext2 = 'February 28, or February 29 in a leap year'\nprint(list(strutils.iter_splitlines(text2)))\n# Expected: ['February 28, or February 29 in a leap year']\n# Actual: ['February', ', or February', ' in a leap year'] (incorrectly split!)\n\n# indent() inherits the same bug\ntext3 = 'February 28\\u2028February 29\\u2029March 1\\r\\nMarch 2'\nprint(strutils.indent(text3, ' '))\n# Expected: ' February 28\\n February 29\\n March 1\\n March 2'\n# Actual: ' February\\n \\n , or... (date numbers are stripped/misplaced)\n```\n\n### Root cause\n\nIn `boltons/strutils.py`, the `_line_ending_re` pattern is defined as:\n\n```python\n_line_ending_re = re.compile(r'(\\r\\n|\\n|\\x0b|\\f|\\r|\\x85|\\x2028|\\x2029)', re.UNICODE)\n```\n\n`\\x2028` in a regex matches a space (`\\x20`) followed by the literal string `28`, not the Unicode character U+2028. The fix is to use `\\u2028` and `\\u2029` (4-digit Unicode escapes) instead.\n\n### Expected behavior\n\n- `iter_splitlines` should split on U+2028 and U+2029 just like other Unicode line endings.\n- `iter_splitlines` should **not** split on ordinary text that happens to contain a space followed by `28` or `29`.\n- `indent()` should correctly handle text that uses Unicode line/paragraph separators without corrupting date strings or other content.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-6f59fc5cd8372ff0ed91", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:b5229ed36e078dead9d45d1aac217dacac968155e41588496c7ab04b41d0d265", "task_path": "tasks/swe-next-6f59fc5cd8372ff0ed91", "instruction": "## BarrelList has three index-boundary bugs: out-of-bounds `__getitem__`, wrong `insert` position, and `pop()` crash on drained tail\n\n### Description\n\nAfter a `BarrelList` has been split into multiple internal sublists (which happens after mutating operations trigger `_balance_list`), several boundary conditions are handled incorrectly.\n\nHere's a helper to get a multi-sublist `BarrelList`:\n\n```python\nfrom boltons.listutils import BarrelList\n\ndef make_bl(n=30000):\n bl = BarrelList(range(n))\n bl.pop(0)\n bl.insert(0, 0)\n # now bl.lists has more than one sublist\n return bl\n```\n\n**Bug 1: `bl[len(bl)]` does not raise `IndexError`**\n\nAccessing an index equal to the length of the list should raise `IndexError` (matching standard Python list behavior), but instead it silently returns a value from somewhere in the middle of the list:\n\n```python\nbl = make_bl()\nbl[len(bl)] # should raise IndexError, but returns an integer\n```\n\n**Bug 2: `insert` at or past the end doesn't append**\n\nPython's `list.insert(i, x)` clamps out-of-bounds indices: `insert(len(lst), x)` appends to the end. `BarrelList.insert` does not do this — it inserts at the wrong position:\n\n```python\nbl = make_bl()\nbl.insert(len(bl), 'end')\nprint(bl[-1]) # prints 29999, expected 'end'\n```\n\n**Bug 3: `pop()` raises `IndexError` after tail sublist is drained**\n\nIf you remove all elements from the last internal sublist via indexed pops, the tail sublist becomes empty. A subsequent `bl.pop()` (no-arg, should pop the last element) then crashes with `IndexError: pop from empty list` even though the `BarrelList` still has elements:\n\n```python\nbl = make_bl()\nfor _ in range(len(bl.lists[-1])):\n bl.pop(len(bl) - 1) # drain the tail sublist\nbl.pop() # IndexError: pop from empty list\n```\n\n### Expected behavior\n\n- `bl[len(bl)]` raises `IndexError`\n- `bl.insert(len(bl), x)` appends `x` to the end; `bl[-1] == x`\n- `bl.insert(len(bl) + 100, x)` also appends; `bl.insert(-len(bl) - 100, x)` prepends\n- `bl.pop()` returns the last element even when the tail internal sublist has been emptied by prior indexed removals\n\n### Actual behavior\n\n- `bl[len(bl)]` returns a mid-list element instead of raising `IndexError`\n- `bl.insert(len(bl), 'end')` inserts somewhere in the middle; `bl[-1]` is still `29999`\n- `bl.pop()` raises `IndexError: pop from empty list` on a non-empty `BarrelList`\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-732a97bd7982a757ea2d", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:6481044790b170329dea309b6ba4e07cb9b1388eac846c36c7bc392a869960ba", "task_path": "tasks/swe-next-732a97bd7982a757ea2d", "instruction": "## Bug: `backoff` raises `ZeroDivisionError` when `factor=1.0` and `count` is not specified\n\n### Description\n\nWhen calling `backoff` (or `backoff_iter`) with `factor=1.0` and no explicit `count`, a `ZeroDivisionError` is raised instead of either returning a sensible result or raising a descriptive `ValueError`.\n\nThe function accepts `factor >= 1.0` as valid, so `factor=1.0` passes validation. But when `count=None`, the count is inferred internally using `math.log(stop/denom, factor)`. Since `math.log(x, 1.0)` involves dividing by `log(1.0) = 0`, this crashes.\n\n### Reproduction\n\n```python\nfrom boltons.iterutils import backoff\n\n# Crashes with ZeroDivisionError — start == stop, should return [5.0]\nresult = backoff(5, 5, factor=1.0)\nprint(result)\n\n# Also crashes with ZeroDivisionError — should raise a clear ValueError\n# since a factor of 1.0 can never grow from 1 to 10\nresult = backoff(1, 10, factor=1.0)\nprint(result)\n```\n\nBoth calls produce:\n```\nZeroDivisionError: float division by zero\n```\n\nNote that passing an explicit `count` does work fine:\n```python\nbackoff(1, 10, count=5, factor=1.0) # returns [1.0, 1.0, 1.0, 1.0, 1.0] — OK\n```\n\n### Expected behavior\n\n- `backoff(5, 5, factor=1.0)` — when `start == stop`, no growth is needed, so the result should be `[5.0]` (a single-element list).\n- `backoff(1, 10, factor=1.0)` — when `start != stop` and `factor=1.0`, it is impossible to infer how many steps are needed (the value never grows), so a descriptive `ValueError` should be raised instead of crashing with `ZeroDivisionError`.\n\n### Actual behavior\n\nBoth cases raise `ZeroDivisionError: float division by zero` originating from the `math.log(stop/denom, factor)` call in `backoff_iter`.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-78176413e3cb8d75e10d", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:b11eef9bbb0b1249c3efe3b25a5f1251c6986c82fea01f2de2346cfdb89169f0", "task_path": "tasks/swe-next-78176413e3cb8d75e10d", "instruction": "## `MATERIALIZED` is not recognized as a keyword, breaks `keyword_case` formatting\n\nWhen parsing a `CREATE MATERIALIZED VIEW` statement, sqlparse treats `MATERIALIZED` as an identifier/name rather than a keyword. This means the `keyword_case` formatting option has no effect on it, producing inconsistent output.\n\n### Steps to reproduce\n\n```python\nimport sqlparse\nfrom sqlparse import tokens as T\n\n# Check how MATERIALIZED is tokenized\np = sqlparse.parse('CREATE MATERIALIZED VIEW v AS SELECT 1')[0]\nprint(p.tokens[2].ttype) # prints None — it's an Identifier, not a Keyword\n\n# Try formatting with keyword_case='upper'\nresult = sqlparse.format('create materialized view v as select 1', keyword_case='upper')\nprint(result) # prints: CREATE materialized VIEW v AS SELECT 1\n```\n\n### Expected behavior\n\n`MATERIALIZED` should be recognized as a keyword (like `VIEW`, `CREATE`, `SELECT`, etc.), so `keyword_case='upper'` produces:\n\n```\nCREATE MATERIALIZED VIEW v AS SELECT 1\n```\n\nThe token type for `MATERIALIZED` should be `Token.Keyword`.\n\n### Actual behavior\n\nThe token type for `MATERIALIZED` is `None` (it is parsed as an `Identifier` node, not a keyword token). As a result, `keyword_case='upper'` leaves it untouched:\n\n```\nCREATE materialized VIEW v AS SELECT 1\n```\n\n`MATERIALIZED` is a standard SQL keyword used in `CREATE MATERIALIZED VIEW`, `DROP MATERIALIZED VIEW`, and `REFRESH MATERIALIZED VIEW` across PostgreSQL, Oracle, BigQuery, and Snowflake. It appears to be simply missing from the `KEYWORDS` table in `sqlparse/keywords.py`.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `sqlparse`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-78ddff8e97cf846b2c3d", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:dde474edd947e3489a9f50532015a44970ff3c623ea9ae588c6d5fb7edb48dd8", "task_path": "tasks/swe-next-78ddff8e97cf846b2c3d", "instruction": "## Off-by-one in `Bits` length validation allows values that exceed the declared bit width\n\n### Description\n\nThe `Bits` class in `boltons.mathutils` accepts an optional `len_` argument that specifies how many bits to use to represent a value. The constructor is supposed to raise a `ValueError` if the value cannot be represented in the given number of bits, but the boundary check is off by one.\n\nThe maximum value representable in `n` bits is `2 ** n - 1`, so a value of exactly `2 ** n` should be rejected. However, the current guard uses `val > 2 ** len_` instead of `val >= 2 ** len_`, meaning `Bits(4, 2)` (where 4 == 2**2) is silently accepted:\n\n```python\nfrom boltons.mathutils import Bits\n\n# 4 requires 3 bits, but len_=2 is accepted without error\nb = Bits(4, 2)\nprint(b.as_bin()) # prints '100' — 3 chars, though b.len == 2\nprint(Bits(b.as_bin()).len) # prints 3, doesn't round-trip\n```\n\nSimilarly, `Bits(1, 0)` is accepted even though 0 bits cannot represent the value 1.\n\nThe following should raise `ValueError` but currently does not:\n\n```python\nfrom boltons.mathutils import Bits\n\n# Both of these should raise ValueError but don't\nBits(4, 2) # 4 == 2**2, doesn't fit in 2 bits\nBits(1, 0) # 1 == 2**0, doesn't fit in 0 bits\n\n# This should succeed (3 == 2**2 - 1, the true maximum for 2 bits)\nassert Bits(3, 2).as_bin() == '11'\n```\n\n### Expected behavior\n\n`Bits(4, 2)` and `Bits(1, 0)` should raise a `ValueError` with a message like \"value X cannot be represented with N bits\". `Bits(3, 2)` (the actual maximum for 2 bits) should continue to work and return `'11'` from `as_bin()`.\n\n### Actual behavior\n\nNo exception is raised. `Bits(4, 2)` silently creates an object with `len == 2` but whose binary representation is `'100'` (3 characters), violating the declared length invariant and breaking round-trip conversion.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-7e0825300bb95bb64678", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:cf86183568ade9e24757bff9533038a203265d8e33d31ba44b8555c3ca07d562", "task_path": "tasks/swe-next-7e0825300bb95bb64678", "instruction": "## Bug: Version string containing `{field}` is silently rewritten in `InvalidMetadata` error messages\n\nWhen a package version string contains the literal text `{field}`, the metadata validator corrupts the error message instead of preserving the user's value verbatim.\n\n### Steps to reproduce\n\n```python\nfrom packaging import metadata\n\nmeta = metadata.Metadata.from_raw({\"version\": \"{field}\"}, validate=False)\ntry:\n _ = meta.version\nexcept metadata.InvalidMetadata as e:\n print(str(e))\n```\n\nThe version value `\"{field}\"` is intentionally invalid, so accessing `meta.version` should raise `InvalidMetadata` with a message like:\n\n```\n'{field}' is invalid for 'version'\n```\n\n### Actual behavior\n\nInstead of preserving the user-supplied string `{field}` in the error message, the validator treats it as a format placeholder and substitutes it with the field name, producing:\n\n```\n''version'' is invalid for 'version'\n```\n\n### Root cause\n\nThe `_Validator._invalid_metadata()` method applies `str.format_map({\"field\": repr(self.raw_name)})` to the already-interpolated error message. This means any occurrence of `{field}` anywhere in the message — including inside a user-supplied value — gets replaced by the field name. A user value that contains other brace patterns (e.g. a bare `{`) would crash with a `KeyError` or `ValueError` entirely.\n\nThe `{field}` substitution mechanism in `_invalid_metadata()` should be removed, and the field name should be interpolated directly at each call site using an f-string, so user values always pass through verbatim.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/packaging`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-7e85ce65d210bbbb98a0", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:de9075bd6d2185ad47fca00a955b2481b987c93d621616a607f6af8c27aae9c8", "task_path": "tasks/swe-next-7e85ce65d210bbbb98a0", "instruction": "## `Bits.__getitem__` always returns `False` for negative indices\n\nNegative integer indices into a `Bits` object always return `False`, regardless of the actual bit value. Out-of-range negative indices also silently return `False` instead of raising `IndexError`.\n\n```python\nfrom boltons.mathutils import Bits\n\nb = Bits('10') # two bits: True, False\n\nprint(b[0]) # True ✓\nprint(b[-2]) # False ✗ — should be True (same bit as b[0])\nprint(b[-1]) # False ✓ (happens to be correct by accident)\n\nb2 = Bits('0000100')\nprint(b2[4]) # True ✓\nprint(b2[-3]) # False ✗ — should be True (same bit as b2[4])\n\n# Out-of-range negative should raise IndexError, but doesn't:\nBits('10')[-3] # returns False instead of raising\n```\n\n### Expected behavior\n- `Bits('10')[-2]` should return `True` (same as `Bits('10')[0]`)\n- `Bits('10')[-1]` should return `False` (same as `Bits('10')[1]`)\n- `Bits('0000100')[-3]` should return `True` (same as `Bits('0000100')[4]`)\n- `Bits('10')[-3]` should raise `IndexError` since the sequence only has 2 elements\n\n### Actual behavior\nAll negative indices return `False`. Out-of-range negative indices also return `False` silently.\n\n### Root cause\n`Bits.__getitem__` only guards against `k >= self.len` before computing `(1 << (self.len - k - 1)) & self.val`. When `k` is negative, the shift amount becomes larger than the stored integer's bit length, so the AND always yields 0. Negative indices are never normalized to their positive equivalents before the mask is applied.\n\nNote that slice indexing (e.g., `b[-1:]`) already works correctly because it delegates to Python's string slicing via `as_bin()`.\n\nThe fix should normalize negative indices by adding `self.len` to them (mirroring standard Python sequence semantics) and then apply the existing bounds check to catch out-of-range values.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-876a98ed543f640056e4", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:852004703c7e8bc99485572a3a6443d2eaa77050df82e91495727550af831b06", "task_path": "tasks/swe-next-876a98ed543f640056e4", "instruction": "## `JSONLIterator` rejects `rel_seek=1.0` despite it being a documented valid value\n\nAccording to the documentation, `rel_seek=1.0` represents the end of the file. When iterating in reverse, this is the natural starting point (and is even used internally as the default when `reverse=True` and no `rel_seek` is given). However, passing `rel_seek=1.0` explicitly raises a `ValueError`.\n\n### Reproducer\n\n```python\nimport io\nfrom boltons.jsonutils import JSONLIterator\n\ndata = b'{\"n\": 1}\\n{\"n\": 2}\\n'\nstream = io.BytesIO(data)\n\n# This raises ValueError even though 1.0 is supposed to mean \"end of file\"\nresult = list(JSONLIterator(stream, reverse=True, rel_seek=1.0))\nprint(result) # Expected: [{'n': 2}, {'n': 1}]\n```\n\n### Error\n\n```\nValueError: 'rel_seek' expected a float between -1.0 and 1.0, not 1.0\n```\n\nThe validation condition uses a strict upper bound, so `1.0` is rejected even though it is a meaningful and documented endpoint. Internally, when `reverse=True` and `rel_seek` is not provided, the code already sets `rel_seek = 1.0` and processes it correctly via `_init_rel_seek()`. The inconsistency is that the explicit user-supplied value `1.0` is blocked by the validator, while the implicitly assigned `1.0` bypasses it.\n\n### Expected behavior\n\nPassing `rel_seek=1.0` explicitly should behave the same as the default for a reverse iterator — seeking to the end of the file. For a forward iterator, `rel_seek=1.0` should return an empty sequence (already at the end). No `ValueError` should be raised.\n\n### Actual behavior\n\nA `ValueError` is raised immediately when `rel_seek=1.0` is passed, before any iteration occurs.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-88cbd10223c4000a893e", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:a9a010e7caaea09926dbbf1242a980dae6a7517a223b2dc95a6ef537ab729da7", "task_path": "tasks/swe-next-88cbd10223c4000a893e", "instruction": "Title: JSONWebSignatureSerializer and TimedJSONWebSignatureSerializer should emit a DeprecationWarning on instantiation\n\nThe JWS serializer classes (`JSONWebSignatureSerializer` and `TimedJSONWebSignatureSerializer`) are slated for removal in a future version, but currently instantiating them does not emit any deprecation warning. Users are not notified that they should migrate to a dedicated JWS/JWT library.\n\nHere is a minimal example that demonstrates the problem:\n\n```python\nimport warnings\nfrom itsdangerous.jws import JSONWebSignatureSerializer, TimedJSONWebSignatureSerializer\n\nwith warnings.catch_warnings(record=True) as w:\n warnings.simplefilter(\"always\")\n s = JSONWebSignatureSerializer(secret_key=\"secret-key\")\n print(len(w)) # prints 0 — no warning was emitted\n```\n\nSimilarly for `TimedJSONWebSignatureSerializer`:\n\n```python\nwith warnings.catch_warnings(record=True) as w:\n warnings.simplefilter(\"always\")\n ts = TimedJSONWebSignatureSerializer(secret_key=\"secret-key\", expires_in=10)\n print(len(w)) # also prints 0\n```\n\n**Expected behavior:** Constructing either `JSONWebSignatureSerializer` or `TimedJSONWebSignatureSerializer` should emit a `DeprecationWarning` telling users that JWS support is deprecated and directing them to use a dedicated library such as authlib.\n\n**Actual behavior:** No warning of any kind is emitted when instantiating these classes. The `__init__` method of `JSONWebSignatureSerializer` needs to call `warnings.warn(...)` with `DeprecationWarning` so that downstream code and tooling (e.g. `-W error::DeprecationWarning`) can detect the usage and prompt migration.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/itsdangerous`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-8b311d34ed68c335375a", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:36c0b06258b94d60cfb8110fcbf0ecef6a5ed22ceb31b71c0c7f5eff54d5a5c5", "task_path": "tasks/swe-next-8b311d34ed68c335375a", "instruction": "In `boltons/urlutils.py`, the `parse_qsl` function accepts an `encoding` keyword argument but never forwards it to the internal `unquote` calls used to decode query string keys and values. As a result, percent-encoded bytes are always decoded as UTF-8 regardless of what the caller requests.\n\nHere is a minimal reproduction:\n\n```python\nfrom boltons import urlutils\n\n# %E9 is 'é' in latin-1 but not valid UTF-8\nresult = urlutils.parse_qsl('k=%E9', encoding='latin-1')\nprint(result) # prints [('k', '\\ufffd')] — wrong, should be [('k', 'é')]\n\n# Keys are affected too\nresult2 = urlutils.parse_qsl('%E9=v', encoding='latin-1')\nprint(result2) # prints [('\\ufffd', 'v')] — wrong, should be [('é', 'v')]\n```\n\nThe `encoding` argument passed to `parse_qsl` should be forwarded to both `unquote` calls inside the function — one for the key and one for the value. The default behavior (UTF-8) must remain unchanged when no encoding is specified.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-8d0d54cd26713b8f4d83", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:c84d579caaa2ccdae3aafd91a18f127c54505e1035f4bd1fc4b746e645d8d883", "task_path": "tasks/swe-next-8d0d54cd26713b8f4d83", "instruction": "## `schedule.get_jobs()` is missing — no way to retrieve scheduled jobs by tag\n\n### Description\n\nThe `schedule` module exposes `schedule.clear(tag)` to remove jobs by tag, but there is no equivalent `schedule.get_jobs(tag)` to *retrieve* jobs by tag. When you try to call it, you get an `AttributeError`.\n\nThis is a problem when you want to inspect or log the jobs (and their tags) that are currently scheduled, especially when jobs carry multiple tags used as metadata.\n\n### Steps to reproduce\n\n```python\nimport schedule\nfrom schedule import every\n\nevery().second.do(lambda: None).tag('job1', 'tag1')\nevery().second.do(lambda: None).tag('job2', 'tag2', 'tag4')\nevery().second.do(lambda: None).tag('job3', 'tag3', 'tag4')\n\n# Retrieve all scheduled jobs\njobs = schedule.get_jobs()\nprint(len(jobs)) # expected: 3\n\n# Retrieve jobs matching a specific tag\njobs = schedule.get_jobs('tag4')\nprint(len(jobs)) # expected: 2\n\n# Retrieve jobs with a tag that no job has\njobs = schedule.get_jobs('tag5')\nprint(len(jobs)) # expected: 0\n```\n\n### Expected behavior\n\n- `schedule.get_jobs()` (no argument) returns a list of all currently scheduled jobs.\n- `schedule.get_jobs(tag)` returns a list of jobs that have the given tag.\n- `schedule.get_jobs('nonexistent_tag')` returns an empty list.\n- The same functionality should be available on the `Scheduler` class as `scheduler.get_jobs(tag=None)`.\n\n### Actual behavior\n\nCalling `schedule.get_jobs()` raises:\n\n```\nAttributeError: module 'schedule' has no attribute 'get_jobs'\n```\n\nNeither the module-level `get_jobs` function nor the `Scheduler.get_jobs` method exist.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `schedule`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-8f98b79c50889659d632", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:1d5dedce7fd0b4dc441e60ba5b25a8039918445f069a894b9be01fd3fd89a200", "task_path": "tasks/swe-next-8f98b79c50889659d632", "instruction": "## Bug: `ZeroDivisionError` when computing histogram for constant or near-constant data\n\nCalling `Stats.get_histogram_counts()` on a dataset where all (or nearly all) values are the same raises a `ZeroDivisionError`. This happens because the automatic bin-selection algorithm (Freedman-Diaconis) computes a bin width `dx` that is zero when the interquartile range is zero, and then divides by it.\n\n### Steps to reproduce\n\n```python\nfrom boltons.statsutils import Stats\n\n# Constant dataset — all values identical\ncounts = Stats([5] * 10).get_histogram_counts()\nprint(counts) # Should print [(5.0, 10)]\n\n# Near-constant dataset — one outlier\ncounts = Stats([0] * 10 + [100]).get_histogram_counts()\nprint(counts)\n```\n\nRunning either of the above raises:\n\n```\nZeroDivisionError: float division by zero\n```\n\nThe traceback points to `statsutils.py` in `_get_bin_bounds`, at the line that computes `bin_count = max(1, int(ceil((max_data - min_data) / dx)))`.\n\n### Expected behavior\n\nWhen the interquartile range is zero (making the Freedman bin width `dx` equal to zero), the histogram should fall back gracefully to a single bin spanning all the data. For `[5] * 10`, the result should be `[(5.0, 10)]` — one bin at `5.0` containing all 10 values. `format_histogram()` should also work without error in these cases.\n\n### Actual behavior\n\nA `ZeroDivisionError` is raised inside `_get_bin_bounds` because `dx` is zero and is used as a divisor without any guard.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-908bdc4f6b4ca7a1e7fe", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:8aacc2645745d6b40939f654e38f5f60830a42c07c671ab9d0dca9f5fb876209", "task_path": "tasks/swe-next-908bdc4f6b4ca7a1e7fe", "instruction": "## `date_signed` is a raw integer instead of `datetime` on bad signature\n\nWhen using `TimestampSigner` and calling `unsign()` on a value with a corrupted signature (but a valid timestamp), the `BadTimeSignature` exception's `date_signed` attribute is a raw integer (Unix timestamp) instead of a `datetime` object.\n\n### Reproducing the issue\n\n```python\nfrom datetime import datetime\nfrom itsdangerous.timed import TimestampSigner\nfrom itsdangerous.exc import BadTimeSignature\nimport pytest\n\nsigner = TimestampSigner(\"secret-key\")\nsigned = signer.sign(\"my string\").replace(b\"my\", b\"other\", 1) # corrupt the value\n\nwith pytest.raises(BadTimeSignature) as exc_info:\n signer.unsign(signed)\n\nprint(type(exc_info.value.date_signed)) # , expected \nprint(exc_info.value.date_signed) # e.g. 1308874145\n```\n\n### Expected behavior\n\n`exc_info.value.date_signed` should be a `datetime` instance (consistent with how `date_signed` is set in all other error cases like `SignatureExpired`). The timestamp embedded in the signed value should be converted via `timestamp_to_datetime()` before being attached to the exception.\n\n### Actual behavior\n\n`date_signed` is a raw `int` (the Unix epoch integer), not a `datetime`. For example:\n\n```\nassert False\n + where False = isinstance(1308874145, datetime)\n + where 1308874145 = BadTimeSignature(\"Signature b'YR7LeXge8QKe4WGdzO8Qpdl20Yc' does not match\").date_signed\n```\n\nThis inconsistency means callers cannot reliably treat `date_signed` as a `datetime` when catching `BadTimeSignature` from `TimestampSigner.unsign()`.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/itsdangerous`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-90eec8823645d39e79fa", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:7b76de1c90f8db78a3174587cabad29a95dbd84493a30444c2dfa91b20a9516a", "task_path": "tasks/swe-next-90eec8823645d39e79fa", "instruction": "## `once_per` / `once_per_args` raises `TypeError` when arguments are unhashable (list, dict, set)\n\nWhen decorating a function with `once_per()` or `once_per_args` and calling it with an unhashable argument (like a list, dict, or set), a `TypeError` is raised before the function body is ever reached.\n\n### Example\n\n```python\nfrom funcy import once_per_args\n\n@once_per_args\ndef initialize(items):\n return 'called'\n\nprint(initialize([1, 2])) # TypeError: unhashable type: 'list'\n```\n\nThe same issue occurs with `once_per`:\n\n```python\nfrom funcy import once_per\n\n@once_per('items')\ndef process(items):\n return 'called'\n\nprocess({'a': 1}) # TypeError: unhashable type: 'dict'\n```\n\nThe error comes from inside the decorator's wrapper, at the point where it checks whether the arguments have been seen before:\n\n```\nfuncy/flow.py in wrapper\n if values not in done:\nTypeError: unhashable type: 'list'\n```\n\n### Why it happens\n\nThe decorator uses `isinstance(values, collections.abc.Hashable)` to decide whether to use a `set` (fast path) or a `list` (fallback) for tracking already-seen argument combinations. The problem is that a `tuple` like `([1, 2],)` satisfies `isinstance(..., Hashable)` even though calling `hash()` on it actually fails — because the tuple contains an unhashable element. So the set path is chosen incorrectly, and the subsequent `in` check on the set raises `TypeError`.\n\n### Expected behavior\n\nCalling a `@once_per_args`- or `@once_per(...)`-decorated function with unhashable arguments should work without error. The function should be called on the first invocation and suppressed on subsequent calls with equal arguments (using equality comparison via the list-based fallback). Mixing hashable and unhashable arguments in different calls should also work correctly:\n\n```python\nassert initialize([1, 2]) == 'called' # first call: executes\nassert initialize([1, 2]) is None # duplicate: suppressed\nassert initialize('other') == 'called' # different arg: executes\nassert initialize('other') is None # duplicate: suppressed\n```\n\n### Actual behavior\n\nA `TypeError` is raised on the first call with an unhashable argument, before the wrapped function is invoked at all.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `funcy`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-9125f888769b0e475570", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:85c58f84f4b91af7cd4e59ade35e4174a38497b0ecd989be64355c6d344ef11f", "task_path": "tasks/swe-next-9125f888769b0e475570", "instruction": "## `str()` on a scheduled `functools.partial` job raises `AttributeError`\n\nWhen you schedule a `functools.partial` function and then call `str()` on the resulting job, you get an `AttributeError` because `functools.partial` objects don't have a `__name__` attribute, but the `Job.__str__` method tries to access it directly.\n\n### Steps to reproduce\n\n```python\nimport functools\nfrom schedule import every\n\ndef job_fun(arg):\n pass\n\njob_fun = functools.partial(job_fun, 'foo')\njob_str = str(every().minute.do(job_fun, bar=True, somekey=23))\nprint(job_str)\n```\n\nThis raises:\n\n```\nAttributeError: 'functools.partial' object has no attribute '__name__'. Did you mean: '__ne__'?\n```\n\nThe error originates inside `Job.__str__` where it does `self.job_func.__name__` without first checking whether the attribute exists.\n\n### Expected behavior\n\nCalling `str()` on a job whose function is a `functools.partial` should succeed and return a string that includes a meaningful representation of the partial function (e.g. containing `'functools.partial'`) along with the job's args and kwargs such as `bar=True` and `somekey=23`.\n\n### Actual behavior\n\nAn `AttributeError` is raised because `functools.partial` objects have no `__name__` attribute. Interestingly, `repr()` on the same job works fine — it appears `__repr__` already guards against missing `__name__`, but `__str__` does not apply the same check.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `schedule`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-95535d87672108a27c18", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:5634b71d576871fb87bc346cd56db9c5c1902652c07de0b283b570d3eb9cd97d", "task_path": "tasks/swe-next-95535d87672108a27c18", "instruction": "## Bug: Marker value serialization always uses double quotes, breaking round-trips for values containing `\"`\n\n### Description\n\nWhen serializing marker values, the serializer always wraps the value in double quotes. This causes incorrect behavior when the value itself contains a double quote character — the serialized form is no longer valid or semantically equivalent to the original.\n\nFor example, a marker value like `a\"b` (containing a double quote) should be serialized as `'a\"b'` (using single quotes), but instead it's serialized as `\"a\"b\"`, which is malformed.\n\nThis also means that a marker string that uses single-quote delimiters to wrap a value containing double quotes does not round-trip correctly:\n\n```python\nfrom packaging.markers import Marker\n\n# This marker uses single quotes to delimit a value that contains double quotes.\n# The whole token 'a\" == os_name or python_version >= \"0\" or \"b' is one string literal.\nmarker_string = \"'a\\\" == os_name or python_version >= \\\"0\\\" or \\\"b' == os_name\"\nm = Marker(marker_string)\nprint(str(m)) # Should be the same as marker_string, but is not\n```\n\nSimilarly, a `Requirement` with such a marker does not round-trip:\n\n```python\nfrom packaging.requirements import Requirement\n\nreq_string = 'demo; \\'a\" == os_name or python_version >= \"0\" or \"b\\' == os_name'\nreq = Requirement(req_string)\nprint(str(req)) # Should equal req_string, but does not\n```\n\nAdditionally, when a value contains **both** single and double quotes (e.g., `a\"b'c`), the serializer should raise a `ValueError` since there is no safe way to represent it, but currently it silently produces a broken string:\n\n```python\nfrom packaging._parser import Value\n\n# Should raise ValueError, but doesn't\nValue(\"a\\\"b'c\").serialize()\n```\n\n### Expected behavior\n\n- If the value contains no double quotes, wrap it in double quotes: `\"value\"`\n- If the value contains a double quote but no single quote, wrap it in single quotes: `'value'`\n- If the value contains both types of quotes, raise a `ValueError` with a descriptive message\n- Marker strings that use single-quote delimiters to embed double quotes should round-trip correctly through `str(Marker(...))` and `str(Requirement(...))`\n\n### Actual behavior\n\n- `Value(\"a\\\"b\").serialize()` returns `'\"a\"b\"'` instead of `\"'a\\\"b'\"`\n- `Value(\"a\\\"b'c\").serialize()` does not raise any error\n- `str(Marker(\"'a\\\" == os_name or python_version >= \\\"0\\\" or \\\"b' == os_name\"))` returns the wrong string, changing the semantics of the marker\n- `str(Requirement(...))` for a requirement with an embedded-double-quote marker does not reproduce the original string\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/packaging`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-9d01e5b313c6aaa726bf", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:fe16f01626f3c9b34fe52524909e18916a25b09929fdb4cdb48863b22201d8d5", "task_path": "tasks/swe-next-9d01e5b313c6aaa726bf", "instruction": "## Bug: Wheel filename derived from URL is not percent-decoded, causing invalid filenames for local versions\n\n### Description\n\nWhen parsing a `pylock.toml` file, if a wheel entry does not include an explicit `name` field, `packaging` derives the filename from the URL basename. However, the URL basename is not percent-decoded before being used as the filename. This means that wheels with local version identifiers (e.g., `2.12.1+cu130`) — where `+` is encoded as `%2B` in the URL — end up with an invalid filename like `example-2.12.1%2Bcu130-py3-none-any.whl` instead of the correct `example-2.12.1+cu130-py3-none-any.whl`.\n\nThis is a real-world problem when working with PyTorch wheels from custom indexes (e.g., `https://download.pytorch.org/whl/cpu`), which use local version labels that get percent-encoded in URLs.\n\n### Reproduction\n\n```python\nfrom packaging.pylock import PackageWheel\n\n# Wheel URL with percent-encoded local version (+cpu encoded as %2Bcu130)\nwheel = PackageWheel(\n url=\"https://example.com/example-2.12.1%2Bcu130-py3-none-any.whl\",\n hashes={},\n)\n\nprint(wheel.filename)\n# Prints: example-2.12.1%2Bcu130-py3-none-any.whl\n# Expected: example-2.12.1+cu130-py3-none-any.whl\n```\n\nThe returned filename contains the raw percent-encoded `%2B` instead of the decoded `+`, making it an invalid wheel filename. Tools that then try to validate or use this filename (e.g., `pip wheel -r pylock.toml`) will reject it with an error like:\n\n```\nERROR: Invalid pylock file 'pylock.toml': Invalid wheel filename 'example-2.12.1%2Bcu130-py3-none-any.whl'\n```\n\n### Expected behavior\n\nWhen `PackageWheel.filename` is derived from the URL (i.e., no explicit `name` field is present in the pylock entry), the URL path component should be percent-decoded so that the resulting filename is valid. For the URL `https://example.com/example-2.12.1%2Bcu130-py3-none-any.whl`, the filename should be `example-2.12.1+cu130-py3-none-any.whl`.\n\n### Actual behavior\n\nThe filename is returned as `example-2.12.1%2Bcu130-py3-none-any.whl` — the `%2B` is not decoded to `+`, resulting in an invalid wheel filename.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/packaging`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-9daf3bb286e3f4f93a79", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:4fee26cc8e743e4e63fc3b9fa2ca6dd2b37d733c4038a07d32aabaeacbdd2c58", "task_path": "tasks/swe-next-9daf3bb286e3f4f93a79", "instruction": "## `autocurry` does not preserve function metadata (e.g., docstrings) when used as a decorator\n\nWhen using `autocurry` as a decorator, the metadata of the original function — including its docstring — is lost. This is because the inner wrapper function returned by `autocurry` does not copy over attributes from the original function.\n\n### Reproducing the issue\n\n```python\nfrom funcy.funcs import autocurry\n\n@autocurry\ndef f(a, b):\n 'docstring'\n\nprint(f.__doc__) # prints None, expected 'docstring'\n```\n\n### Expected behavior\n\n`f.__doc__` should be `'docstring'`, since the original function `f` has that docstring. Any other metadata (like `__name__`, `__module__`, etc.) should also be preserved.\n\n### Actual behavior\n\n`f.__doc__` is `None`. The `autocurry` function wraps the original in an inner `autocurried` function but does not use `functools.wraps` (or equivalent) to copy over the original function's attributes, so all metadata is discarded.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `funcy`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-9dd83e0127b63cd5715a", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:04aaaca0412ffda775a124f9bc43673bce94841848d5db0e02323128d08266db", "task_path": "tasks/swe-next-9dd83e0127b63cd5715a", "instruction": "## Bug: `Requirement` leaks `InvalidSpecifier` instead of raising `InvalidRequirement` for malformed specifier lists\n\nWhen parsing a requirement string like `demo===x,y`, the requirement parser accepts the name and specifier portion, but the subsequent `SpecifierSet` construction rejects the bare `y` token. Instead of wrapping this failure as `InvalidRequirement`, the raw `InvalidSpecifier` exception propagates out of `Requirement()`.\n\nThis breaks the documented exception contract for `Requirement`: callers catching `InvalidRequirement` to detect malformed requirement strings will miss this class of error.\n\n### Reproducer\n\n```python\nfrom packaging.requirements import InvalidRequirement, Requirement\nfrom packaging.specifiers import InvalidSpecifier\n\n# This should raise InvalidRequirement, but currently raises InvalidSpecifier\ntry:\n Requirement(\"demo===x,y\")\nexcept InvalidRequirement:\n print(\"Got InvalidRequirement as expected\")\nexcept InvalidSpecifier as e:\n print(f\"Got InvalidSpecifier instead: {e}\")\n```\n\nRunning this prints:\n```\nGot InvalidSpecifier instead: Invalid specifier: 'y'\n```\n\n### Expected behavior\n\n`Requirement(\"demo===x,y\")` should raise `InvalidRequirement` (with a message like `Invalid specifier: 'y'`), consistent with how all other malformed requirement strings are handled.\n\n### Actual behavior\n\n`Requirement(\"demo===x,y\")` raises `packaging.specifiers.InvalidSpecifier: Invalid specifier: 'y'` directly, bypassing the `InvalidRequirement` wrapping.\n\n### Additional impact\n\nThe pickle restoration path (`Requirement.__setstate__`) is also affected. When restoring a `Requirement` from a pickled invalid string like `demo===x,y`, `__setstate__` calls `Requirement()` internally and expects `InvalidRequirement` to signal that the string is invalid (so it can raise `TypeError` with a helpful message). Because `InvalidSpecifier` is raised instead, this conversion does not happen correctly.\n\n```python\nimport pickle\nfrom packaging.requirements import Requirement\n\nr = Requirement.__new__(Requirement)\n# Should raise TypeError(\"Cannot restore Requirement ...\"), but currently raises InvalidSpecifier\nr.__setstate__(\"demo===x,y\")\n```\n\n### Fix\n\nIn `Requirement.__init__`, wrap the `SpecifierSet(parsed.specifier)` call with a try/except that catches `InvalidSpecifier` and re-raises it as `InvalidRequirement`.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/packaging`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-9f7e15b2d66cb098785a", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:4465bbdf24fe0462667956e3548a3f442d3af363202cb2c1680efaa6fd5e0441", "task_path": "tasks/swe-next-9f7e15b2d66cb098785a", "instruction": "## Bug: Marker and Requirement parsers silently accept a trailing LF (`\\n`)\n\n### Description\n\nWhen parsing a marker expression or a requirement string that ends with a Unix newline (`\\n`), no error is raised even though the input is malformed. Only a trailing LF is affected — `\\r` and `\\r\\n` already cause a parse error as expected.\n\nFor example, constructing a `Marker` with a trailing newline should raise `InvalidMarker`, but it currently succeeds silently:\n\n```python\nfrom packaging.markers import Marker, InvalidMarker\n\n# This should raise InvalidMarker, but currently does NOT\ntry:\n m = Marker('python_version >= \"3\"\\n')\n print(\"No error raised — bug!\")\nexcept InvalidMarker:\n print(\"Correctly raised InvalidMarker\")\n```\n\nSimilarly for requirements:\n\n```python\nfrom packaging.requirements import Requirement, InvalidRequirement\n\n# Both of these should raise InvalidRequirement, but currently do NOT for \\n\nfor req_str in ['name>=1\\n', 'name; python_version >= \"3\"\\n']:\n try:\n r = Requirement(req_str)\n print(f\"No error raised for {req_str!r} — bug!\")\n except InvalidRequirement:\n print(f\"Correctly raised InvalidRequirement for {req_str!r}\")\n```\n\nNote that trailing horizontal whitespace (spaces and tabs) should still be accepted — only vertical whitespace like newlines should be rejected.\n\n### Root cause\n\nThe tokenizer's `END` rule in `DEFAULT_RULES` is defined using `re.compile(r\"$\")`. Python's `$` anchor matches at the end of the string **or immediately before a trailing newline**, so a string like `'name>=1\\n'` is treated as if it ended cleanly. Using `re.compile(r\"\\Z\")` would match only at the true end of the string, with no newline exception.\n\n### Expected behavior\n\n- `Marker('python_version >= \"3\"\\n')` should raise `InvalidMarker`\n- `Requirement('name>=1\\n')` should raise `InvalidRequirement` \n- `Requirement('name; python_version >= \"3\"\\n')` should raise `InvalidRequirement`\n- Strings ending with `\\r` or `\\r\\n` already correctly raise errors and should continue to do so\n- Strings ending with trailing spaces or tabs should still parse successfully\n\n### Fix\n\nIn `src/packaging/_tokenizer.py`, change the `END` rule from:\n\n```python\n\"END\": re.compile(r\"$\"),\n```\n\nto:\n\n```python\n\"END\": re.compile(r\"\\Z\"),\n```\n\nThis makes the end-of-input anchor strict, matching only the absolute end of the string.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/packaging`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-a3a93665aa076e600d25", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:0aa2ad897ae1cc754c186b50442cde5b0b0c7e67e5c4052e8d664986c1a0fc86", "task_path": "tasks/swe-next-a3a93665aa076e600d25", "instruction": "## `InvalidRequirement` leaks raw from dependency group parsing, dropping sibling errors\n\nWhen resolving dependency groups, if a group contains both an invalid object (like `{}`) **and** a malformed PEP 508 requirement string, two things go wrong:\n\n1. The `InvalidRequirement` for the bad string is raised as a bare exception instead of being wrapped in the aggregated `[dependency-groups] data for '' was malformed` `ExceptionGroup`.\n2. Any errors already collected earlier in the same group (e.g., an `InvalidDependencyGroupObject` for the invalid `{}`) are silently dropped, because the raw raise short-circuits the loop before the post-loop error aggregation runs.\n\nHere's a minimal reproduction:\n\n```python\nfrom packaging.dependency_groups import resolve_dependency_groups\n\ngroups = {\n \"all\": [\n {}, # invalid object, collected first\n \"this is not a valid requirement!!!\", # malformed PEP 508 string\n ],\n}\n\n# Expected: raises ExceptionGroup containing both InvalidRequirement\n# and InvalidDependencyGroupObject\nresolve_dependency_groups(groups, \"all\")\n```\n\nInstead of getting an `ExceptionGroup` with both errors, a bare `InvalidRequirement` is raised:\n\n```\npackaging.requirements.InvalidRequirement: Expected semicolon (after name with no version specifier) or end\n this is not a valid requirement!!!\n ^\n```\n\nThe `InvalidDependencyGroupObject` for `{}` that was collected before the bad string is completely lost.\n\n**Expected behavior:** Calling `resolve_dependency_groups` with a group containing mixed errors (an invalid object AND a malformed requirement string) should raise an `ExceptionGroup` matching `[dependency-groups] data for 'all' was malformed` that contains **both** the `InvalidRequirement` and the `InvalidDependencyGroupObject`. This is consistent with how other errors in the same loop (e.g., a non-string `include-group` value) are handled via the error collector.\n\n**Actual behavior:** `InvalidRequirement` propagates raw out of `_parse_group`, bypassing the error collector and dropping any sibling errors already collected in the same iteration.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/packaging`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-ab37c2e89fc16f9c7f9e", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:d538f59ad219fd2f2c308ed123cb3787dd0383cc76cc2dfaa4ae421c5d127772", "task_path": "tasks/swe-next-ab37c2e89fc16f9c7f9e", "instruction": "## `BarrelList` raises `IndexError` when deleting a slice that spans multiple barrels\n\nDeleting a slice from a `BarrelList` that crosses barrel boundaries raises an `IndexError`. The same error occurs when the stop index is `None` or beyond the length of the list.\n\n### Reproducing the cross-barrel deletion bug\n\nA `BarrelList` with 12 elements split into four sublists of 3 elements each:\n\n```python\nfrom boltons.listutils import BarrelList\n\nreference = list(range(12)) # [0, 1, 2, ..., 11]\nvalue = BarrelList()\nvalue.lists = [reference[i:i+3] for i in range(0, 12, 3)]\n# value.lists == [[0,1,2], [3,4,5], [6,7,8], [9,10,11]]\n\ndel reference[2:10] # works fine on a plain list\ndel value[2:10] # IndexError: list index out of range\n```\n\nThis raises:\n```\nIndexError: list index out of range\n```\n\n### Reproducing the delete-to-end bug\n\nDeleting from a middle index to the end of a large `BarrelList` also fails:\n\n```python\nreference = list(range(30000))\nvalue = BarrelList(range(30000))\n\ndel reference[10000:] # works\ndel value[10000:] # IndexError\n```\n\nSame error when using an explicit stop beyond the list length, e.g. `del value[10000:40000]`.\n\n### Expected behavior\n\nBoth operations should produce the same result as performing the equivalent slice deletion on a plain Python `list`. After `del value[2:10]` on a 12-element `BarrelList`, the remaining elements should be `[0, 1, 10, 11]`. After `del value[10000:]`, only the first 10000 elements should remain.\n\n### Actual behavior\n\nAn `IndexError` is raised in `BarrelList.del_slice`. The cross-barrel case fails because intermediate barrels are removed first, which shifts the index of the stop barrel before it has been trimmed, so `stop_list_idx` ends up pointing out of range. The delete-to-end case fails because a stop value of `None` or beyond `len(self)` is not handled correctly before calling `_translate_index`.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-b212e0c23d26b304485c", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:a034b57e5f9b0294f5078d32a5fe09e74f941abc1c9f41a1be9872b01d6fc425", "task_path": "tasks/swe-next-b212e0c23d26b304485c", "instruction": "## Bug: `~=` operator accepts non-ASCII Unicode characters in pre/post-release labels\n\n### Description\n\nThe compatible release operator (`~=`) incorrectly accepts version specifiers that contain non-ASCII Unicode characters in their pre-release or post-release labels. For example, `~=1.2.3prev\\u0131ew1` (where `\\u0131` is the Turkish dotless-i \"ı\") and `~=1.2.3po\\u017ft1` (where `\\u017f` is the long s \"ſ\") are accepted without raising an error, even though they are not valid PEP 440 version specifiers.\n\nThis is inconsistent with other operators like `==` and `>=`, which correctly reject such inputs. The issue is that the `~=` branch of the specifier regex uses plain non-capturing groups `(?:...)` for the pre-release, post-release, and dev-release segments. Under case-insensitive matching without ASCII restriction, Unicode characters that fold to ASCII letters (e.g., `ı` → `i`, `ſ` → `s`) are matched, allowing invalid strings through.\n\n### Reproducer\n\n```python\nfrom packaging.specifiers import Specifier, InvalidSpecifier\n\n# These should raise InvalidSpecifier but currently do not\nfor spec in [\"~=1.2.3prev\\u0131ew1\", \"~=1.2.3po\\u017ft1\"]:\n try:\n s = Specifier(spec)\n print(f\"ERROR: {spec!r} was accepted as valid, but should be invalid\")\n except InvalidSpecifier:\n print(f\"OK: {spec!r} correctly rejected\")\n\n# For comparison, the == operator correctly rejects similar inputs:\ntry:\n Specifier(\"==1.2+\\u0130\")\nexcept InvalidSpecifier:\n print(\"OK: ==1.2+\\u0130 correctly rejected\")\n```\n\n### Expected behavior\n\nConstructing `Specifier(\"~=1.2.3prev\\u0131ew1\")` and `Specifier(\"~=1.2.3po\\u017ft1\")` should raise `InvalidSpecifier`, just as `Specifier(\"==1.2+\\u0130\")` does. The `~=` operator's pre-release, post-release, and dev-release regex groups should enforce ASCII-only matching, consistent with all other operators.\n\n### Actual behavior\n\nNo exception is raised. The specifiers `~=1.2.3prev\\u0131ew1` and `~=1.2.3po\\u017ft1` are silently accepted as valid, which can later cause failures when trying to parse or use them as version constraints.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/packaging`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-b3da366d391bf5c3f6ff", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:9a0b8f963cecca76e181d8860827b4f01da49eea674d6bccd917e6c1096e96a3", "task_path": "tasks/swe-next-b3da366d391bf5c3f6ff", "instruction": "## `Function` object has no `get_window()` method and `get_parameters()` breaks with OVER clause\n\nWhen parsing a SQL window function like `foo(5) over win1` or `foo(5) over (PARTITION BY c1)`, the `Function` class doesn't expose a way to retrieve the window definition, and `get_parameters()` also returns incorrect results because it blindly grabs `self.tokens[-1]` — which may be the OVER clause rather than the function's parenthesis.\n\n### Reproducing the issue\n\n```python\nimport sqlparse\nfrom sqlparse import sql\n\n# Named window reference\np = sqlparse.parse('foo(5) over win1')[0]\nfunc = p.tokens[0]\nprint(type(func)) # should be sql.Function\nprint(list(func.get_parameters())) # should have 1 parameter\nprint(func.get_window()) # AttributeError: 'Function' object has no attribute 'get_window'\n\n# Inline window specification\np2 = sqlparse.parse('foo(5) over (PARTITION BY c1)')[0]\nfunc2 = p2.tokens[0]\nprint(func2.get_window()) # also fails\n```\n\n### Expected behavior\n\n- `Function.get_window()` should return the window definition:\n - An `sql.Identifier` when a named window reference is used (e.g., `over win1`)\n - An `sql.Parenthesis` when an inline window spec is used (e.g., `over (PARTITION BY c1)`)\n- `Function.get_parameters()` should correctly return only the parameters inside the function's own parentheses (not accidentally pick up the OVER clause tokens).\n\n### Actual behavior\n\nCalling `get_window()` on a `Function` object raises:\n\n```\nAttributeError: 'Function' object has no attribute 'get_window'\n```\n\nAdditionally, `get_parameters()` may return wrong results for window functions because it uses `self.tokens[-1]` to find the parenthesis, but when an OVER clause is present the last token is no longer the function's parameter list.\n\n### Fix needed\n\n1. Add a `get_window()` method to the `Function` class that returns the window identifier or parenthesis following an OVER clause, or `None` if no OVER clause is present.\n2. Fix `get_parameters()` to locate the `Parenthesis` token by type rather than by position, so it works correctly when the function is followed by an OVER clause.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `sqlparse`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-b69dfe4649584f991a9f", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:4389f8a9e8b0368dc7f09288f9195f198bea4dbf659bba3e4a0ebb3c08c61824", "task_path": "tasks/swe-next-b69dfe4649584f991a9f", "instruction": "## Bug: `parse_tag` and `parse_wheel_filename` silently accept invalid interpreter tags\n\n### Description\n\nWhen parsing wheel tags, the interpreter field is not validated against any identifier rules. This means that numeric strings, version-like strings, and other non-identifier values are accepted silently as interpreter tags.\n\nFor example, the wheel filename `playlyfe-0.1.1-2.7.6-none-any.whl` has `2.7.6` as its interpreter field. Since the interpreter field supports compressed tag sets (dot-separated), `2.7.6` expands into three separate interpreter tags: `2`, `7`, and `6`. None of these are valid interpreter identifiers, but `parse_wheel_filename` currently accepts the filename without complaint.\n\nSimilarly, calling `parse_tag` directly with interpreter components that aren't valid identifiers raises no error:\n\n```python\nfrom packaging import tags\n\n# These all silently succeed but should raise InvalidTag:\nresult1 = tags.parse_tag(\"2-none-any\") # bare digit\nresult2 = tags.parse_tag(\"2.7.6-none-any\") # dot-separated numbers\nresult3 = tags.parse_tag(\"py3.2-none-any\") # dot in interpreter name\nresult4 = tags.parse_tag(\"py+3-none-any\") # plus sign in interpreter name\nprint(result1) # frozenset of Tag objects with interpreter '2'\nprint(result2) # frozenset with interpreters '2', '7', '6'\n```\n\nAnd for wheel filenames:\n\n```python\nfrom packaging.utils import parse_wheel_filename\n\n# Should raise InvalidWheelFilename, but doesn't:\nresult = parse_wheel_filename(\"playlyfe-0.1.1-2.7.6-none-any.whl\")\nprint(result) # Returns successfully instead of raising\n```\n\n### Expected behavior\n\n- `parse_tag` should raise `InvalidTag` (with a message indicating an invalid interpreter) when any interpreter component is not a valid identifier (e.g., a purely numeric string like `\"2\"`, a dot-containing string like `\"py3.2\"`, or one with special characters like `\"py+3\"`).\n- `parse_wheel_filename` should raise `InvalidWheelFilename` for filenames like `playlyfe-0.1.1-2.7.6-none-any.whl` where the interpreter field contains non-identifier components.\n- Valid custom interpreter identifiers such as `graalpy311`, `sillywalk`, and `_custom` should continue to be accepted.\n\n### Actual behavior\n\n`parse_tag(\"2.7.6-none-any\")` returns a frozenset containing `Tag('2', 'none', 'any')`, `Tag('7', 'none', 'any')`, and `Tag('6', 'none', 'any')` without raising any error. Similarly, `parse_wheel_filename(\"playlyfe-0.1.1-2.7.6-none-any.whl\")` returns successfully instead of raising `InvalidWheelFilename`.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/packaging`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-ba8170e904b225f8a608", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:5818c88c14804afe619978a327464c4d312c147a8c56c7bb0bdca883ec8d2ffd", "task_path": "tasks/swe-next-ba8170e904b225f8a608", "instruction": "## `ecoutils.get_profile(scrub=True)` still performs hostname resolution and reads the working directory\n\nWhen calling `ecoutils.get_profile(scrub=True)`, the intent is to return a profile with identifying information masked. However, the implementation currently performs all the identifying lookups first (hostname resolution, current working directory, etc.) and only *afterwards* replaces the values with `'-'`. This means:\n\n- `socket.gethostname()` and `socket.getfqdn()` are called (triggering potential reverse DNS lookups)\n- `os.getcwd()` is called (accessing the filesystem)\n\neven though the results are immediately discarded.\n\n### Reproducing the issue\n\nYou can verify that `socket.gethostname` is called during a scrubbed profile by replacing it with a function that raises:\n\n```python\nimport socket\nfrom boltons import ecoutils\n\ndef unreachable(*args):\n raise AssertionError('scrubbed profile resolved the host name')\n\noriginal_gethostname = socket.gethostname\nsocket.gethostname = unreachable\nsocket.getfqdn = unreachable\n\ntry:\n prof = ecoutils.get_profile(scrub=True)\n print('hostname:', prof['hostname']) # should be '-'\nfinally:\n socket.gethostname = original_gethostname\n```\n\nThis raises `AssertionError: scrubbed profile resolved the host name` because `get_profile` calls `socket.gethostname()` unconditionally before the scrub block replaces the value.\n\nSimilarly, for `os.getcwd`:\n\n```python\nimport os\nfrom boltons import ecoutils\n\ncalls = []\nreal_getcwd = os.getcwd\n\ndef recording_getcwd():\n calls.append('getcwd')\n return real_getcwd()\n\nos.getcwd = recording_getcwd\n\nprof = ecoutils.get_profile(scrub=True)\nprint(calls) # prints ['getcwd'] — but should be []\nprint(prof['cwd']) # prints '-'\n\nos.getcwd = real_getcwd\n```\n\nAfter calling `get_profile(scrub=True)`, `calls` contains `['getcwd']`, meaning `os.getcwd()` was invoked even though its result was immediately thrown away.\n\n### Expected behavior\n\nWhen `scrub=True`, `get_profile` should **not** call `socket.gethostname()`, `socket.getfqdn()`, `os.getcwd()`, or `getpass.getuser()` at all. These fields should be set directly to `'-'` without performing the underlying lookup, since the results will never be used.\n\n### Actual behavior\n\n- Calling `get_profile(scrub=True)` triggers `socket.gethostname()` → raises `AssertionError: scrubbed profile resolved the host name` in environments where hostname resolution is blocked or replaced.\n- `os.getcwd()` is called and recorded even though `cwd` is set to `'-'` in the returned profile.\n\nThis is both a correctness issue (unnecessary side effects like DNS lookups) and a potential failure point in restricted environments where these calls are not available.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-bd9380fa137d254f7c4c", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:854fb698efc6acb13118cfd061b999a1e4c9d1b55745f8839a53030a0d4e6043", "task_path": "tasks/swe-next-bd9380fa137d254f7c4c", "instruction": "## `wraps(g)(f)` raises `TypeError` when `f` has keyword-only parameters that `g` accepts positionally\n\nWhen using `wraps(g)(f)` from `boltons.funcutils`, the generated shim adopts `g`'s signature but calls `f`. If `f` declares a parameter as keyword-only (after `*`) that `g` accepts positionally, the shim forwards the argument positionally and `f` raises a `TypeError`.\n\n### Non-defaulted case\n\n```python\nfrom boltons.funcutils import wraps\n\ndef g(a, b):\n return a * b\n\ndef f(a, *, b): # b is keyword-only in f\n return a + b\n\nresult = wraps(g)(f)(3, 4) # should return 7\n```\n\nThis raises:\n```\nTypeError: test_wraps_target_kwonly_arg_no_default..f() takes 1 positional argument but 2 were given\n```\n\nThe generated shim calls `_call(a, b)` positionally, but `f` only accepts `b` as a keyword argument.\n\n### Varargs case\n\n```python\nfrom boltons.funcutils import wraps\n\ndef g(a, b, *va):\n pass\n\ndef f(a, *va, b): # b is keyword-only in f\n return (a, va, b)\n\nresult = wraps(g)(f)(1, 2, 3) # should return (1, (3,), 2)\n```\n\nThis raises:\n```\nTypeError: test_wraps_target_kwonly_arg_with_varargs..f() missing 1 required keyword-only argument: 'b'\n```\n\nHere, because `g` has `*va`, the existing varargs forwarding logic forces all preceding args to be passed positionally, generating `_call(a, b, *va)`. But since `f` requires `b` as keyword-only, `b` ends up consumed by `*va` and `f` never receives it as `b`.\n\n### Expected behavior\n\nIn both cases, the shim should detect that the target function (`f`) only accepts `b` as a keyword argument, and forward it as `b=b` in the generated call — even when `g`'s signature would normally pass it positionally. The call should be `_call(a, *va, b=b)` for the varargs case, and `_call(a, b=b)` for the plain case.\n\n### Notes\n\nThe defaulted flavor of this bug (`f(a, *, b=1)`) was apparently fixed as a side effect of earlier keyword-forwarding work, but the non-defaulted and varargs flavors remain broken. The fix should live in the invocation generation logic and account for the target callable's actual parameter kinds.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-c1e6a71f42ea746ddd91", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:0db0b8e2c2d8e4d408feec1c820105cfbb4e9612784972cf44c7bdb54d63a1e8", "task_path": "tasks/swe-next-c1e6a71f42ea746ddd91", "instruction": "## `InvalidMetadata` and `CyclicDependencyGroup` cannot be pickled/unpickled\n\nBoth `InvalidMetadata` and `CyclicDependencyGroup` raise a `TypeError` when you try to send them across a process boundary (e.g. via `concurrent.futures` or `multiprocessing`), because Python's default exception pickling mechanism reconstructs exceptions using `self.args`, and neither class's `self.args` matches its `__init__` signature.\n\n### Reproducing the issue\n\n**`InvalidMetadata`:**\n\n```python\nimport pickle\nfrom packaging.metadata import InvalidMetadata\n\nexc = InvalidMetadata(\"version\", \"'1.0.a' is invalid\")\ncopy = pickle.loads(pickle.dumps(exc))\nprint(copy.field) # should print \"version\"\nprint(str(copy)) # should print \"'1.0.a' is invalid\"\n```\n\nThis raises:\n```\nTypeError: InvalidMetadata.__init__() missing 1 required positional argument: 'message'\n```\n\nbecause `InvalidMetadata.__init__` takes `(field, message)` but only calls `super().__init__(message)`, so `self.args` is `(\"'1.0.a' is invalid\",)`. On unpickling, Python calls `InvalidMetadata(\"'1.0.a' is invalid\")`, which is missing the `field` argument.\n\n**`CyclicDependencyGroup`:**\n\n```python\nimport pickle\nfrom packaging.dependency_groups import CyclicDependencyGroup\n\nexc = CyclicDependencyGroup(\"group1\", \"group2\", \"group1\")\ncopy = pickle.loads(pickle.dumps(exc))\nprint(copy.requested_group) # should print \"group1\"\nprint(str(copy)) # should match original\n```\n\nThis raises:\n```\nTypeError: CyclicDependencyGroup.__init__() missing 2 required positional arguments: 'group' and 'include_group'\n```\n\nSame root cause: `__init__` takes three positional arguments but `self.args` only contains the formatted message string.\n\n### Expected behavior\n\nBoth exceptions should survive a pickle round-trip with all their attributes (`field`, `requested_group`, `group`, `include_group`) and their string representation intact.\n\n### Actual behavior\n\nUnpickling either exception raises a `TypeError` because Python tries to reconstruct the exception from `self.args`, which doesn't match the multi-argument `__init__` signatures. Both classes need a `__reduce__` method that returns the original constructor arguments so reconstruction works correctly.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/packaging`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-c36ffef9396c21651183", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:94c4663fff86d652eb71e7e0ea3937c8449d144fef441f0c51fb7c21004300fe", "task_path": "tasks/swe-next-c36ffef9396c21651183", "instruction": "## Bug: `\"X\" in extras` and `\"X\" in dependency_groups` markers are not normalized at parse time\n\nWhen creating a `Marker` using the set-membership form (`\"X\" in extras` or `\"X\" in dependency_groups`), the extra/dependency-group name is **not** normalized (canonicalized per PEP 503) at parse time. This means two markers that are semantically equivalent end up with different string representations, compare as unequal, and have different hashes.\n\nNote that the singular form `extra == \"X\"` is already normalized correctly — this bug only affects the plural membership forms.\n\n### Example\n\n```python\nfrom packaging.markers import Marker\n\nraw = Marker('\"S_P__A_M\" in extras')\nnormalized = Marker('\"s-p-a-m\" in extras')\n\nprint(str(raw)) # prints: \"S_P__A_M\" in extras (should be \"s-p-a-m\" in extras)\nprint(raw == normalized) # prints: False (should be True)\nprint(hash(raw) == hash(normalized)) # prints: False (should be True)\n\n# Same issue with 'not in' and 'dependency_groups'\nraw2 = Marker('\"Foo_Bar\" not in dependency_groups')\nprint(str(raw2)) # prints: \"Foo_Bar\" not in dependency_groups (should be \"foo-bar\" not in dependency_groups)\n```\n\nThe inconsistency is especially confusing because `evaluate()` **does** normalize both operands, so the markers above evaluate identically:\n\n```python\nprint(Marker('\"S_P__A_M\" in extras').evaluate({\"extras\": {\"s-p-a-m\"}})) # True\nprint(Marker('\"s-p-a-m\" in extras').evaluate({\"extras\": {\"s-p-a-m\"}})) # True\n```\n\nBut because `str()` / `__eq__` / `__hash__` differ, these markers won't deduplicate in sets or dicts, and requirement/lock-file processing that compares markers by equality will treat them as different.\n\n### Expected behavior\n\nParsing `Marker('\"S_P__A_M\" in extras')` should normalize the name at parse time so that:\n- `str(Marker('\"S_P__A_M\" in extras'))` returns `'\"s-p-a-m\" in extras'`\n- `Marker('\"S_P__A_M\" in extras') == Marker('\"s-p-a-m\" in extras')` is `True`\n- `hash(Marker('\"S_P__A_M\" in extras')) == hash(Marker('\"s-p-a-m\" in extras'))` is `True`\n\nThis should apply to both `in` and `not in` operators, and to both `extras` and `dependency_groups` variables.\n\n### Fix needed\n\nThe parse-time normalizer (`_normalize_extras` in `packaging/markers.py`) currently only handles the `extra == \"X\"` case. It needs to be extended to also canonicalize the string-literal operand when the right-hand operand is a `Variable` named `extras` or `dependency_groups` (i.e., the set-membership case).\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/packaging`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-c5cceac05e2316bbc3ee", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:271f4f158c00c9e3c9c5f1c0bb2c3b2781cc2083c0e9fef6e3701e30d35c5ac3", "task_path": "tasks/swe-next-c5cceac05e2316bbc3ee", "instruction": "## Wrong next run date when using `.at()` with a timezone\n\nWhen scheduling a daily job with a specific time and timezone using `.at(time, timezone)`, the computed `next_run` date can be off by one day in certain situations.\n\n### Example\n\nConsider the following scenario where the local (Berlin) time is April 14, 04:50, and you want to schedule a job to run at midnight US/Central time:\n\n```python\nimport schedule\nfrom schedule import every\nimport datetime\n\n# Simulating current local time: 2023-04-14 04:50 (Berlin, during daylight saving)\n# US/Central time at this moment: 2023-04-13 21:50\n# Next scheduled run in US/Central: 2023-04-14 00:00\n# Expected next run in Berlin local time: 2023-04-14 07:00\n\ndef my_job():\n pass\n\nnext_run = every().day.at(\"00:00\", \"US/Central\").do(my_job).next_run\nprint(next_run) # Prints: 2023-04-15 07:00 — but should be 2023-04-14 07:00\n```\n\nThe job is scheduled for midnight US/Central, which in Berlin local time corresponds to 07:00 on April 14 — still in the future at the current time of 04:50. So the next run should be **April 14**, but instead it is computed as **April 15**.\n\nThe same class of bug also causes the opposite problem: in some timezone combinations, the next run is scheduled one day *too early*.\n\n### Expected behavior\n\nWhen using `.at(\"00:00\", \"US/Central\")` at Berlin local time April 14, 04:50, the `next_run` should be April 14, 07:00 (Berlin local time), because the target time in US/Central hasn't passed yet today.\n\n### Actual behavior\n\nThe `next_run` is incorrectly set to April 15, 07:00 — one day too late. The internal logic that decides whether to subtract a day (to schedule the job for today rather than tomorrow) compares the raw `at_time` value (e.g., `00:00`) directly against the local clock time, instead of comparing the timezone-converted next run time against the local clock time. This leads to an incorrect decision about whether the scheduled time is still upcoming today.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `schedule`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-c5ce2b3c06775ebf841c", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:7a22cdbb5f0837a81def3952cecd9f8a1b5bbbd9bac7af980e4af9b105ca8b08", "task_path": "tasks/swe-next-c5ce2b3c06775ebf841c", "instruction": "## `OrderedMultiDict.addlist()` silently drops values from one-shot iterables\n\nThe `addlist()` method on `OrderedMultiDict` loses all values when given a one-shot iterator such as `iter([...])` or a generator expression, even though the docstring explicitly states that \"tuples and other sequences and iterables work\".\n\n### Reproduction\n\n```python\nfrom boltons.dictutils import OrderedMultiDict as OMD\n\nomd = OMD()\nomd.addlist('a', iter([1, 2, 3]))\nomd.addlist('b', (x for x in [4, 5]))\n\nprint(omd.keys()) # ['a', 'b'] — keys are recorded\nprint(omd.getlist('a')) # [] — but values are gone!\nprint(omd.get('a')) # raises IndexError instead of returning a value\n```\n\nThe problem is that `addlist` internally traverses its `v` argument twice — once to insert keys into the linked list, and once to extend the backing values list. A one-shot iterator is exhausted after the first pass, so the second pass sees nothing.\n\nThis leaves the OMD internally inconsistent: `keys()` and `repr()` show the entries, while `getlist()` returns `[]` and `get()` raises `IndexError` (which also contradicts its own docstring: \"This method never raises a `KeyError`\").\n\nThe empty-iterator case is even worse:\n\n```python\nomd = OMD()\nomd.addlist('a', (x for x in []))\n\nprint(len(omd)) # 1 — a key was recorded\nprint(omd.keys()) # [] — but keys() shows nothing\nprint('a' in omd) # True\n```\n\nHere `len()` and `keys()` disagree, which is a hard invariant break for a `dict` subclass. The `if not v` guard evaluates the generator object itself (always truthy) rather than its contents.\n\n### Expected behavior\n\nAfter `omd.addlist('a', iter([1, 2, 3]))`, calling `omd.getlist('a')` should return `[1, 2, 3]` and `omd.get('a')` should return `3`. Passing an empty generator should be a no-op — `len(omd)` should remain `0` and `'a' in omd` should be `False`.\n\n### Actual behavior\n\n`getlist('a')` returns `[]`, `get('a')` raises `IndexError`, and an empty-generator call records a phantom key that makes `len()` and `keys()` disagree.\n\nNote: `urlutils.OrderedMultiDict` has a vendored copy of the same method with the same defect.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-d51ed8ab61ddbecf999f", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:d9e2413e7ce0041c7b13ca992dbb4bf41d0791abd02ed378e06719fa5eb648b7", "task_path": "tasks/swe-next-d51ed8ab61ddbecf999f", "instruction": "## `singularize()` corrupts words ending in double `s` (`glass`, `boss`, `address`, etc.)\n\n### Description\n\nWhen calling `singularize()` on words that are already singular and end in a double `s`, the function incorrectly strips the trailing `s`, producing a corrupted result:\n\n```python\nfrom boltons.strutils import singularize\n\nprint(singularize('glass')) # prints 'glas' — expected 'glass'\nprint(singularize('boss')) # prints 'bos' — expected 'boss'\nprint(singularize('class')) # prints 'clas' — expected 'class'\nprint(singularize('kiss')) # prints 'kis' — expected 'kiss'\nprint(singularize('address')) # prints 'addres' — expected 'address'\nprint(singularize('business')) # prints 'busines' — expected 'business'\n```\n\nThis also breaks idempotency. The function's own docstring implies `singularize('Glasses') == 'Glass'`, but feeding that result back in gives `'Glas'`:\n\n```python\nresult = singularize('Glasses') # 'Glass' — correct\nresult2 = singularize(result) # 'Glas' — wrong, should be 'Glass'\n```\n\nSo applying `singularize()` defensively to a word that's already singular silently corrupts it further on each call (`'boss'` → `'bos'` → `'bo'` → ...).\n\n### Root cause\n\nThe function has a catch-all `else` branch that blindly strips the final character from any word ending in `s` that didn't match the `-ies` or `-ses` patterns. Words ending in `ss` are already singular — their plurals end in `sses` (e.g. `glass` → `glasses`), which is handled correctly by an earlier branch. Only the already-singular forms fall through to the destructive `word[:-1]` fallback.\n\n### Expected behavior\n\n- `singularize('glass')` should return `'glass'`\n- `singularize('boss')` should return `'boss'`\n- `singularize('address')` should return `'address'`\n- `singularize('Glass')` should return `'Glass'` (case preserved)\n- `singularize('BOSS')` should return `'BOSS'` (case preserved)\n- `singularize('glasses')` should still return `'glass'` (real plurals unaffected)\n- `singularize(singularize('Glasses'))` should return `'Glass'` (idempotent)\n\n### Actual behavior\n\n`singularize('glass')` returns `'glas'` — the trailing `s` is stripped even though the word is already singular.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-d82ddfbfa8774cd4546c", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:a00ef3ea8d87f9527ab78d7a06c1b8b66943bea3939ffd8a1a2b3efb5a08c132", "task_path": "tasks/swe-next-d82ddfbfa8774cd4546c", "instruction": "Title: `TimestampSigner.timestamp_to_datetime()` returns a naive datetime instead of a timezone-aware UTC datetime\n\n## Description\n\nThe `timestamp_to_datetime` method on `TimestampSigner` (and similarly `get_issue_date` on `TimedJSONWebSignatureSerializer`) uses `datetime.utcfromtimestamp()` internally, which is deprecated in Python 3.12 and returns a **naive** `datetime` object with no timezone info. The method should instead return a **timezone-aware** `datetime` in UTC.\n\nThis causes failures whenever you compare the returned timestamp against a timezone-aware datetime, or when running on Python 3.12 where the deprecation warning is treated as an error.\n\nHere's a minimal reproduction:\n\n```python\nfrom datetime import datetime, timezone\nfrom itsdangerous.timed import TimestampSigner\n\nsigner = TimestampSigner(\"secret\")\nsigned = signer.sign(\"value\")\nvalue, ts = signer.unsign(signed, return_timestamp=True)\n\nexpected = datetime(2011, 6, 24, 0, 9, 5, tzinfo=timezone.utc)\nprint(ts) # naive datetime, e.g. 2011-06-24 00:09:05\nprint(ts == expected) # False — tzinfo mismatch\n```\n\nThe same problem surfaces when a `SignatureExpired` exception is raised and you inspect `exc_info.value.date_signed` — it is a naive datetime rather than a timezone-aware one:\n\n```python\nfrom datetime import datetime, timezone, timedelta\nimport pytest\nfrom itsdangerous.exc import SignatureExpired\nfrom itsdangerous.timed import TimestampSigner\n\nsigner = TimestampSigner(\"secret\")\nsigned = signer.sign(\"value\")\n# fast-forward time beyond max_age ...\ntry:\n signer.unsign(signed, max_age=0)\nexcept SignatureExpired as e:\n print(e.date_signed.tzinfo) # None — should be UTC\n```\n\nThe root cause is in `src/itsdangerous/timed.py`:\n\n```python\ndef timestamp_to_datetime(self, ts):\n return datetime.utcfromtimestamp(ts) # returns naive datetime; deprecated in 3.12\n```\n\nIt should use `datetime.fromtimestamp(ts, tz=timezone.utc)` to return a proper timezone-aware UTC datetime. The same issue exists in `jws.py` inside `get_issue_date`.\n\n## Expected behavior\n\n`TimestampSigner.timestamp_to_datetime()` should return a timezone-aware `datetime` object with `tzinfo=timezone.utc`. Consequently, `unsign(..., return_timestamp=True)` should return a timezone-aware timestamp, and `BadTimeSignature.date_signed` / `SignatureExpired.date_signed` should also be timezone-aware. No `DeprecationWarning` about `utcfromtimestamp` should be raised.\n\n## Actual behavior\n\nThe method returns a **naive** `datetime` (no `tzinfo`), causing comparison failures with timezone-aware datetimes and triggering a `DeprecationWarning` on Python 3.12:\n\n```\nDeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).\n```\n\nThis affects `TimestampSigner`, `TimedSerializer`, and `TimedJSONWebSignatureSerializer`.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/itsdangerous`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-da05fd09d06e170b2e88", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:01cf47a84ff5f04f845fb39f9938d9b440e8620282a4e37b68d38f8dcc33ad7c", "task_path": "tasks/swe-next-da05fd09d06e170b2e88", "instruction": "## Function grouping skipped for lowercase `as` in `CREATE TABLE ... AS SELECT`\n\nWhen parsing a `CREATE TABLE ... AS SELECT` (CTAS) statement where the `AS` keyword is lowercase, `sqlparse` fails to group function calls in the `SELECT` body correctly.\n\nFor example:\n\n```python\nimport sqlparse\nfrom sqlparse import sql\n\np = sqlparse.parse('create table tbl1 as select coalesce(t1.col1, 0) as col1 from t1')[0]\nprint(p.tokens[10].get_alias()) # Returns None, expected 'col1'\nprint(type(p.tokens[10].tokens[0])) # Not sql.Function as expected\n```\n\nThe alias `col1` is not resolved (`get_alias()` returns `None`), and `coalesce(t1.col1, 0)` is not grouped as a `sql.Function`. With uppercase `AS` the same statement parses correctly:\n\n```python\np2 = sqlparse.parse('create table tbl1 AS select coalesce(t1.col1, 0) as col1 from t1')[0]\nprint(p2.tokens[10].get_alias()) # Returns 'col1' correctly\nprint(isinstance(p2.tokens[10].tokens[0], sql.Function)) # True\n```\n\n### Root cause\n\nIn `sqlparse/engine/grouping.py`, inside `group_functions`, there is a guard that detects `CREATE TABLE ... (...)` statements (without `AS`) to avoid incorrectly grouping the column list as a function call. It checks for the `AS` keyword using a **case-sensitive** comparison:\n\n```python\nif tmp_token.value == 'AS': # case-sensitive — misses lowercase 'as'\n has_as = True\n```\n\nWhen the keyword is lowercase `as`, `has_as` stays `False`. The guard then fires (`has_create and has_table and not has_as`), causing the function to return early and skip **all** function grouping for the entire statement.\n\n### Expected behavior\n\nSQL keywords are case-insensitive. A CTAS statement using lowercase `as` should be parsed identically to one using uppercase `AS`. The `coalesce(...)` call should be grouped as a `sql.Function`, and alias resolution should work correctly regardless of keyword casing.\n\n### Actual behavior\n\n`get_alias()` returns `None` instead of `'col1'`, and the token is not an instance of `sql.Function`. The fix should make the `AS` comparison case-insensitive (e.g., `tmp_token.value.upper() == 'AS'`) to match the sibling checks for `CREATE` and `TABLE`.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `sqlparse`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-dc6de596dcf52258d2cc", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:bbfddbc3f101429e4ca493898e48dac6660139f82a056b25d9dc624041238186", "task_path": "tasks/swe-next-dc6de596dcf52258d2cc", "instruction": "## `Metadata.from_email` drops `from_raw` validation errors when unparsed headers are present\n\n### Description\n\nWhen calling `Metadata.from_email(data, validate=True)` (or without `validate`, which defaults to `True`), the raised `ExceptionGroup` only contains errors for headers that couldn't be parsed (e.g., duplicate single-value fields or unrecognized field names). Errors reported by the internal `from_raw` validation step — such as missing required fields (`metadata-version`, `name`, `version`) or invalid field values — are not included in the same group.\n\nFor example, passing a single unrecognized header like `\"Hello: PyPA\"` should raise an `ExceptionGroup` containing four errors: one for the unrecognized `hello` field, plus three more for the missing required fields (`metadata-version`, `name`, `version`). Instead, only one error is raised:\n\n```python\nfrom packaging import metadata\nfrom packaging.errors import ExceptionGroup\nimport pytest\n\ntry:\n metadata.Metadata.from_email(\"Hello: PyPA\")\nexcept ExceptionGroup as eg:\n print(len(eg.exceptions)) # prints 1, expected 4\n print(eg.exceptions[0]) # InvalidMetadata(\"unrecognized field: 'hello'\")\n```\n\nSimilarly, when a metadata block has both an unparsed known header (e.g., a duplicated `Name`) and an invalid value for another field (e.g., `Version: invalid version`), both errors should appear in the same group:\n\n```python\ntry:\n metadata.Metadata.from_email(\n \"Metadata-Version: 2.6\\n\"\n \"Name: packaging\\n\"\n \"Name: packaging-copy\\n\"\n \"Version: invalid version\\n\"\n )\nexcept ExceptionGroup as eg:\n print(len(eg.exceptions)) # prints 1, expected 2\n # Only gets: InvalidMetadata(\"'name' has invalid data\")\n # Missing: InvalidMetadata for 'version'\n```\n\nAnd when there are both an unknown field and an invalid field value:\n\n```python\ntry:\n metadata.Metadata.from_email(\n \"Metadata-Version: 2.6\\n\"\n \"Name: packaging\\n\"\n \"Unknown-Field: value\\n\"\n \"Version: invalid version\\n\"\n )\nexcept ExceptionGroup as eg:\n print(len(eg.exceptions)) # prints 1, expected 2\n # Only gets: InvalidMetadata(\"unrecognized field: 'unknown-field'\")\n # Missing: InvalidMetadata for 'version'\n```\n\n### Expected behavior\n\n`Metadata.from_email(validate=True)` should collect **all** validation errors — both from the unparsed-headers phase and from the `from_raw` validation phase — into a single `ExceptionGroup`. When a required field is already reported as unparsed (e.g., duplicate header), the corresponding \"missing field\" error from `from_raw` should be suppressed to avoid duplicates.\n\n### Actual behavior\n\nThe `ExceptionGroup` raised by `from_email` only contains errors from the unparsed-headers scan. Errors from `from_raw` (missing required fields, invalid field values) are not aggregated into the same group, so callers see an incomplete picture of what is wrong with the metadata.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/packaging`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-dd041ef84c74be6c1038", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:423579ab6f94131215935377fe0f01df3223485956420fd1f57bff511f63e26c", "task_path": "tasks/swe-next-dd041ef84c74be6c1038", "instruction": "## Bug: `partition` and `chunks` give wrong results when `step > n` and input is an iterator\n\nWhen calling `partition(n, step, seq)` or `chunks(n, step, seq)` with `step > n`, the result depends on whether `seq` is a list or an iterator — even if both contain the same data. The iterator path produces chunks of the wrong length, wrong content, and a different number of parts.\n\n### Example\n\n```python\nfrom funcy import partition, chunks\n\n# Using a list (correct)\nprint(list(partition(2, 3, list(range(10)))))\n# [[0, 1], [3, 4], [6, 7]]\n\n# Using an iterator (wrong)\nprint(list(partition(2, 3, iter(range(10)))))\n# [[0, 1], [2, 3, 4], [5, 6, 7], [8, 9]]\n```\n\nThe iterator path returns `[2, 3, 4]` as the second chunk — that's 3 items, not 2 — and the expected second chunk should be `[3, 4]` (skipping item `2`). The same problem affects `chunks`:\n\n```python\nprint(list(chunks(2, 3, list(range(10)))))\n# [[0, 1], [3, 4], [6, 7], [9]]\n\nprint(list(chunks(2, 3, iter(range(10)))))\n# [[0, 1], [2, 3, 4], [5, 6, 7], [8, 9]] -- wrong length and content\n```\n\n### Expected behavior\n\n`partition(n, step, seq)` and `chunks(n, step, seq)` should produce the same result regardless of whether `seq` is a list or an iterator. With `n=2, step=3` on `range(10)`, both should yield parts starting at indices 0, 3, 6 with each part containing exactly 2 elements: `[[0, 1], [3, 4], [6, 7]]`.\n\n### Actual behavior\n\nWhen an iterator is passed and `step > n`, the internal sliding-window logic in the iterator code path uses `pool[step:]` (which silently clips to `[]` when `step > n`) and then reads `step` items from the iterator into the new pool instead of `n`. This results in chunks of length `step` instead of `n`, with incorrect content and an incorrect number of parts.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `funcy`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-dd9dd3a586c2a5f7425c", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:58ce4c6f51f5e8162907c2a72e3189e423ff2f29f9b898ce336c19521c3a2861", "task_path": "tasks/swe-next-dd9dd3a586c2a5f7425c", "instruction": "## Bug: `LowerBound(None, True)` and `UpperBound(None, True)` don't normalize `inclusive` to `False`\n\nWhen constructing an unbounded lower or upper bound (i.e., with `version=None`, representing -∞ or +∞), passing `inclusive=True` is accepted and stored as-is. This causes two different spellings of the same conceptual bound to compare as unequal and sort differently from each other.\n\n### Reproducer\n\n```python\nfrom packaging._ranges import LowerBound, UpperBound, NEG_INF, POS_INF\n\n# Two spellings of -inf\na = LowerBound(None, True)\nb = LowerBound(None, False) # this is NEG_INF\n\nprint(a.inclusive) # prints True — should be False\nprint(a == b) # prints False — should be True\nprint(len({a, b, NEG_INF})) # prints 3 — should be 1\n\n# Ordering between the two spellings is also broken\nprint(a > b) # prints True — should be False (they represent the same point)\nprint(a <= b) # prints False — should be True\n```\n\nThe same problem affects `UpperBound`:\n\n```python\na = UpperBound(None, True)\nb = UpperBound(None, False) # this is POS_INF\n\nprint(a.inclusive) # True — should be False\nprint(a > b) # True — should be False\n```\n\n### Expected behavior\n\nAn unbounded end has only one meaningful representation. `LowerBound(None, True)` and `LowerBound(None, False)` should be the same object semantically: both should have `inclusive == False`, compare equal, hash identically, and never sort above or below each other. The same applies to `UpperBound(None, ...)`. The `inclusive` flag should be silently normalized to `False` whenever `version is None`.\n\n### Actual behavior\n\n- `LowerBound(None, True).inclusive` is `True` instead of `False`.\n- `LowerBound(None, True) == LowerBound(None, False)` is `False` instead of `True`.\n- Comparison `LowerBound(None, True) > LowerBound(None, False)` returns `True` instead of `False` — two representations of -∞ sort above each other.\n- The same issues occur symmetrically for `UpperBound`.\n\nThe fix should be applied in `LowerBound.__init__` and `UpperBound.__init__`: when `version is None`, unconditionally set `inclusive = False` before storing it.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/packaging`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-df95120c370c23e038c0", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:724526cb882dc6360a564540936f8bc829662f5d1c97e8a6cf08b77d8d96fe05", "task_path": "tasks/swe-next-df95120c370c23e038c0", "instruction": "## `repr()` crashes on partially-constructed `Job` when `job_func` is `None`\n\nWhen using `schedule.every()` to create a job without calling `.do()` on it, calling `repr()` on the resulting `Job` object raises an `AttributeError`. This makes it difficult to debug or inspect jobs in environments like Jupyter Notebook, and also breaks any Factory pattern where a `Job` may be constructed incrementally.\n\n### Steps to reproduce\n\n```python\nimport schedule\n\n# Create a partially-composed job (no .do() call)\njob = schedule.every(10)\nprint(repr(job)) # crashes here\n```\n\n### Error\n\n```\nAttributeError: 'NoneType' object has no attribute 'args'\n```\n\nThe traceback points to the `__repr__` method in `schedule/__init__.py`, where it unconditionally accesses `self.job_func.args` and `self.job_func.keywords` even when `self.job_func` is `None`.\n\n### Expected behavior\n\nCalling `repr()` on a partially-constructed `Job` (where `.do()` has not yet been called) should not raise an exception. Instead, it should return a sensible string such as:\n\n```\nEvery 10 None do [None] (last run: [never], next run: [never])\n```\n\n### Actual behavior\n\nAn `AttributeError` is raised because the `__repr__` method tries to iterate over `self.job_func.args` without first checking whether `self.job_func` is `None`.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `schedule`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-e3b20adc5e5a17d63ed0", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:a9fcd36fc4eb0529b3cc3dc70313520c2d2e1edaca4e7a281db49cfff2632a2f", "task_path": "tasks/swe-next-e3b20adc5e5a17d63ed0", "instruction": "## `memoize` silently drops `key_func` when called directly (non-decorator form)\n\nWhen calling `memoize` directly with a function and a custom `key_func`, the key function is silently ignored. This means that if the function takes unhashable arguments (like lists), a `TypeError` is raised even though the supplied `key_func` is supposed to convert them to a hashable form.\n\n### Reproducer\n\n```python\nfrom funcy import memoize\n\ndef total(values):\n return sum(values)\n\n# Direct call form — key_func should convert list -> tuple for hashing\ncached_total = memoize(total, key_func=tuple)\ncached_total([1, 2]) # TypeError: unhashable type: 'list'\n```\n\nThe decorator form works fine:\n\n```python\n@memoize(key_func=tuple)\ndef total(values):\n return sum(values)\n\ntotal([1, 2]) # works correctly\n```\n\n### Expected behavior\n\nBoth forms should behave identically. When `key_func=tuple` is provided, calling `cached_total([1, 2])` should succeed, cache the result, and return `3` on subsequent calls without invoking the underlying function again. Invalidation via `cached_total.invalidate([1, 2])` should also work correctly with the custom key.\n\n### Actual behavior\n\nCalling `cached_total([1, 2])` raises:\n\n```\nTypeError: unhashable type: 'list'\n```\n\nThe `key_func` argument is discarded in the direct-call code path, so the raw list is used as the cache key instead of being converted to a tuple first.\n\n### Root cause\n\nIn `funcy/calc.py`, the `memoize` function handles the direct-call form with:\n\n```python\nif _func is not None:\n return memoize()(_func)\n```\n\nThis discards `key_func`. It should forward it:\n\n```python\nif _func is not None:\n return memoize(key_func=key_func)(_func)\n```\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `funcy`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-e449f3a74c16c9c7b926", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:8fa99c38ee4456df84171de85b6cfc6ef58a528f776ef4774a77f87ecb6e6d90", "task_path": "tasks/swe-next-e449f3a74c16c9c7b926", "instruction": "## Long-running jobs skip their next scheduled period\n\nWhen a job takes longer than its scheduled interval to complete, the next run is incorrectly scheduled one period too far in the future, effectively skipping a period.\n\n### Example\n\nConsider a daily job scheduled to run at 23:30. If the job starts on day 1 at 23:30 but takes 1.5 hours to finish (completing at 01:00 on day 2), the scheduler should reschedule it for 23:30 on day 2. Instead, it schedules it for 23:30 on day 3.\n\n```python\nimport schedule\nfrom schedule import every\n\ndef long_running_job():\n pass\n\n# Schedule a daily job at 23:30\n# Imagine current time is 2010-12-01 23:00\njob = every().day.at('23:30').do(long_running_job)\nprint(job.next_run) # 2010-12-01 23:30 — correct\n\n# Now simulate the job finishing at 01:00 on day 2\n# (the job started at 23:30 on day 1 and took 1.5 hours)\n# At this point, current time is 2010-12-02 01:00\njob.run()\nprint(job.next_run) # Expected: 2010-12-02 23:30, Actual: 2010-12-03 23:30\n```\n\nThe same problem occurs with hourly jobs. A job scheduled every hour at `:10` that runs at 13:00 (having started at 12:10 and taken ~50 minutes) should next run at 13:10, not 14:10:\n\n```python\njob = every().hour.at(':10').do(long_running_job)\n# job created at 12:00 -> next_run = 12:10\n\n# job.run() called at 13:00 (job took ~50 min, crossed the hour boundary)\njob.run()\nprint(job.next_run) # Expected: 13:10, Actual: 14:10\n```\n\nAnd similarly for per-minute jobs with a seconds offset.\n\n### Expected behavior\n\nAfter a long-running job finishes in the next period, the scheduler should detect that the computed `next_run` has skipped ahead by more than one period and reschedule within the current period instead. For example:\n- Daily job at 23:30, finishes at 01:00 next day → next run should be 23:30 **that same day** (day 2)\n- Hourly job at :10, finishes at 13:00 → next run should be **13:10**, not 14:10\n\n### Actual behavior\n\nThe scheduler always advances `next_run` by a full period from the already-incremented value, so long-running jobs that finish in the next period skip one scheduled occurrence entirely. The `next_run` ends up being one period further than it should be.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `schedule`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-e8d35130dbfb1bf090f1", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:3abb3611365e72f3cab71273cc3884206278f6a470862a9b749ad765b15b09a9", "task_path": "tasks/swe-next-e8d35130dbfb1bf090f1", "instruction": "## Ordered identifiers inside parentheses are not grouped correctly\n\nWhen parsing a SQL expression like `(a desc)`, sqlparse fails to group the identifier `a` together with its ordering keyword `desc` when they are inside parentheses.\n\nHere's a minimal example that reproduces the issue:\n\n```python\nimport sqlparse\nfrom sqlparse import sql\n\np = sqlparse.parse('(a desc)')[0]\nprint(type(p.tokens[0])) # \nprint(type(p.tokens[0].tokens[1])) # Expected: Identifier, but gets something else\nprint(str(p.tokens[0].tokens[1])) # Expected: 'a desc', but gets 'a'\n```\n\n**Expected behavior:** The token at `p.tokens[0].tokens[1]` should be an `sql.Identifier` instance with string value `'a desc'`, because `a desc` is an ordered identifier and should be grouped as a unit.\n\n**Actual behavior:** The token at `p.tokens[0].tokens[1]` has string value `'a'` only — the `desc` keyword is left ungrouped and separate. The `group_order` logic does not recurse into nested structures like parentheses, so ordered identifiers inside parentheses are never grouped together.\n\nThis affects any SQL that places ordered identifiers within parentheses, such as window function clauses or subexpressions with ordering.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `sqlparse`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-ea9d3f21bd135c324c84", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:7bfca25f2881490c9f70d7d836562fdd32c1630e357699cd24d756c8210ae1e4", "task_path": "tasks/swe-next-ea9d3f21bd135c324c84", "instruction": "When a signed token contains a timestamp value so large that it would correspond to a year far beyond what Python's `datetime` supports, calling `unsign()` on a `TimestampSigner` raises an unhandled `ValueError` instead of the expected `BadTimeSignature` exception.\n\n## Steps to Reproduce\n\n```python\nfrom itsdangerous.timed import TimestampSigner\nfrom itsdangerous.exc import BadTimeSignature\n\nsigner = TimestampSigner(\"secret-key\")\n# This signed value encodes a timestamp whose year is astronomically far in the future\nsigned = b\"value.TgPVoaGhoQ.AGBfQ6G6cr07byTRt0zAdPljHOY\"\n\n# This should raise BadTimeSignature, but instead raises ValueError\nsigner.unsign(signed)\n```\n\n## Expected Behavior\n\n`unsign()` should catch the out-of-range timestamp and raise `BadTimeSignature` with `\"Malformed\"` in the message and `date_signed` set to `None`. This is consistent with how other malformed timestamps are handled.\n\n## Actual Behavior\n\nAn unhandled `ValueError` propagates out of `unsign()`:\n\n```\nValueError: year 695863352 is out of range\n```\n\nThis originates from `datetime.fromtimestamp(ts, tz=timezone.utc)` inside `timestamp_to_datetime` when the encoded integer timestamp is too large for Python's `datetime` to represent. In real-world usage (e.g. Flask sessions), this surfaces as a 500 error:\n\n```\nFile \"itsdangerous/timed.py\", line 47, in timestamp_to_datetime\n return datetime.fromtimestamp(ts, tz=timezone.utc)\nValueError: year 5365471 is out of range\n```\n\nThe `unsign()` method needs to catch `ValueError` (and `OSError` on Windows) when converting the raw timestamp integer to a datetime and convert it into a proper `BadTimeSignature` exception.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/itsdangerous`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-eb1b2ad1c94d96e4ae3d", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:d47d13381ecbfc245b23f8a135099c5f88b64258c7be519061ad1e85cbd58c83", "task_path": "tasks/swe-next-eb1b2ad1c94d96e4ae3d", "instruction": "## `rpartial` does not accept keyword arguments\n\nCurrently, `rpartial` only supports positional arguments. Passing keyword arguments to it raises a `TypeError`.\n\n### Example\n\n```python\nfrom funcy import rpartial\n\nmerge = lambda a, b, c='bra': a + b + c\n\n# This raises TypeError: rpartial() got an unexpected keyword argument 'a'\nresult = rpartial(merge, a='abra')(b='cada')\nprint(result) # Expected: 'abracadabra'\n```\n\nSimilarly, keyword arguments passed to the partially-applied function are also not forwarded:\n\n```python\n# Even if rpartial itself only gets positional args, call-time kwargs are dropped\nresult = rpartial(merge, 'cada', c='fancy')('abra', c='funcy')\nprint(result) # Expected: 'abracadafuncy' (call-time 'c' should override)\n```\n\n### Expected behavior\n\n`rpartial` should accept keyword arguments, store them, and merge them with any keyword arguments provided at call time. Call-time keyword arguments should override those given to `rpartial`.\n\n### Actual behavior\n\nCalling `rpartial(merge, a='abra')` immediately raises:\n\n```\nTypeError: rpartial() got an unexpected keyword argument 'a'\n```\n\nThe current implementation has the signature `def rpartial(func, *args)` with a returned lambda `lambda *a: func(*(a + args))`, which neither accepts nor passes through keyword arguments.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `funcy`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-f9798f08c35dd35139bd", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:2714c8353987721d41d4dfe2c8a84e5e0388fe9f3eeb43445f5794bc30a4ab06", "task_path": "tasks/swe-next-f9798f08c35dd35139bd", "instruction": "## Bug: `Pylock.select()` silently succeeds when `environments` is an empty list\n\nWhen creating a `Pylock` with an explicitly empty `environments=[]`, calling `select()` should raise a `PylockSelectError` because the lock file declares no supported environments — meaning the current environment cannot possibly match any of them. However, `select()` currently returns without raising any error.\n\nHere's a minimal reproduction:\n\n```python\nfrom packaging.markers import Marker\nfrom packaging.pylock import Pylock, PylockSelectError\nfrom packaging.version import Version\n\npylock = Pylock(\n lock_version=Version(\"1.0\"),\n created_by=\"some_tool\",\n environments=[], # explicitly empty — no environments are supported\n packages=[],\n)\npylock.validate()\n\n# This should raise PylockSelectError, but it doesn't\nlist(pylock.select(tags=..., environment=...))\n```\n\nThe expected behavior is that `select()` raises a `PylockSelectError` with a message like:\n\n> \"Provided environment does not satisfy any of the environments specified in the lock file\"\n\nThis is consistent with the behavior when `environments` contains markers that don't match (e.g., `[Marker('python_version == \"3.14\"')]`), which correctly raises the error.\n\nThe root cause appears to be that the environment check uses a truthiness test on `self.environments`, which treats both `None` (omitted field — unrestricted) and `[]` (explicitly empty — no valid environment) the same way, skipping validation entirely for both. These two cases should be handled differently: `None` means no restriction, while `[]` means no environment is supported and should always raise an error.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/packaging`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-fa4be66a6091c0aa7f60", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:e43a85abf56382ecb84513a3a8d7f19f55c609570646be30a1d12ec3158688ac", "task_path": "tasks/swe-next-fa4be66a6091c0aa7f60", "instruction": "## `namedtuple` and `namedlist` raise `IndexError` instead of `ValueError` for empty names\n\nPassing an empty string as a field name or typename to `boltons.namedutils.namedtuple` (or `namedlist`) crashes with an `IndexError` instead of raising a clean `ValueError`.\n\n### Reproducer\n\n```python\nfrom boltons.namedutils import namedtuple, namedlist\n\n# Empty field name\nnamedtuple('Point', ['x', ''])\n# => IndexError: string index out of range\n\n# Empty typename\nnamedlist('', ['x', 'y'])\n# => IndexError: string index out of range\n```\n\n### What's happening\n\nThe validation loop checks for invalid characters with:\n\n```python\nif not all(c.isalnum() or c == '_' for c in name):\n raise ValueError(...)\n```\n\nBecause `all()` returns `True` for an empty iterable, an empty string passes this check silently. It also passes the `_iskeyword('')` check. The code then reaches `name[0].isdigit()`, which crashes with `IndexError: string index out of range` because the string has no characters.\n\nFor comparison, CPython's `collections.namedtuple` correctly raises `ValueError` for the same inputs:\n\n```\nValueError: Type names and field names must be valid identifiers: \"\"\n```\n\n### Expected behavior\n\nPassing an empty string as either a typename or a field name should raise a `ValueError` with a descriptive message, not an `IndexError`. This applies to both `namedtuple` and `namedlist`.\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `boltons`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []} +{"task_id": "swe-next-fec9556e37168b73f265", "recipe": "swe_next", "quality_status": "exported", "bundle_hash": "sha256:cfd7a58cc1055988540ed2f2b3757ab1da54289d1aa32b845b1caddfa87aa73e", "task_path": "tasks/swe-next-fec9556e37168b73f265", "instruction": "## `Pylock.select(tags=[])` ignores the empty tag list and falls back to host tags\n\nWhen calling `Pylock.select()` with an explicitly empty `tags=[]`, the method behaves as if `tags` was not provided at all — it falls back to `sys_tags()` and selects a wheel that is compatible with the running interpreter, instead of treating the empty list as \"no compatible tags\".\n\nThis is because the implementation uses `tags or sys_tags()`, and an empty list is falsy in Python, so it gets silently replaced with the host's tags.\n\n### Reproducer\n\nGiven a lock file with both a `py3-none-any` wheel and an sdist for a package:\n\n```python\nfrom packaging.pylock import Pylock, PackageSdist\n\n# pylock has both a py3-none-any wheel and an sdist\npylock = _pylock_with_wheel_and_sdist()\n\nselected = list(\n pylock.select(\n tags=[],\n environment=_py312_linux.environment,\n )\n)\n\nprint(type(selected[0][1])) # prints PackageWheel, expected PackageSdist\n```\n\nAnd when the lock contains only a wheel (no sdist):\n\n```python\nfrom packaging.pylock import Pylock, PylockSelectError\n\npylock = _pylock_with_wheel_and_sdist(include_sdist=False)\n\n# Expected: raises PylockSelectError\n# Actual: no error raised, wheel is selected via sys_tags()\nlist(\n pylock.select(\n tags=[],\n environment=_py312_linux.environment,\n )\n)\n```\n\n### Expected behavior\n\n- `select(tags=[])` should treat the empty sequence as \"no compatible tags\": if an sdist is available, it should be selected; if only wheels are available, a `PylockSelectError` should be raised.\n- `select()` (no `tags` argument, i.e., `tags=None`) should retain the existing behavior of falling back to `sys_tags()`.\n\n### Actual behavior\n\n- `select(tags=[])` falls back to `sys_tags()` because `[] or sys_tags()` evaluates to `sys_tags()`. This causes a host-compatible wheel to be selected even though the caller explicitly passed an empty tag sequence, and no `PylockSelectError` is raised in the wheel-only case.\n\n### Root cause\n\nThe defaulting logic in `Pylock.select()` uses:\n\n```python\ncompatible_tags_selector = create_compatible_tags_selector(tags or sys_tags())\n```\n\nThis does not distinguish between `tags=None` (omitted) and `tags=[]` (explicitly empty). It should use:\n\n```python\ncompatible_tags_selector = create_compatible_tags_selector(\n tags if tags is not None else sys_tags()\n)\n```\n\nWork in `/workspace`. Submit your fix in the existing Python source files under `src/packaging`. Preserve the other public behavior. The environment is offline; dependencies are preinstalled. Grading runs the repository's test suite in a fresh environment, using your submitted source files.\n", "evidence_json": "{\"artifact_integrity\": true, \"blind_solver\": \"not assessed by this release audit\", \"control_scope\": \"Hash-matched baseline 0 and reference 1 in the Wave 1 audit\", \"harbor_parse\": true, \"independent_quality_review\": \"not assessed by this release audit\", \"paired_harbor_controls\": true, \"retained\": false}", "diagnostics": []}