{"instance_id": "matplotlib__matplotlib-25122", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/lib/matplotlib/mlab.py b/lib/matplotlib/mlab.py\nindex 3552904c3d..2eec639960 100644\n--- a/lib/matplotlib/mlab.py\n+++ b/lib/matplotlib/mlab.py\n@@ -424,10 +424,10 @@ def _spectral_helper(x, y=None, NFFT=None, Fs=None, detrend_func=None,\n             result /= Fs\n             # Scale the spectrum by the norm of the window to compensate for\n             # windowing loss; see Bendat & Piersol Sec 11.5.2.\n-            result /= (np.abs(window)**2).sum()\n+            result /= (window**2).sum()\n         else:\n             # In this case, preserve power in the segment, not amplitude\n-            result /= np.abs(window).sum()**2\n+            result /= window.sum()**2\n \n     t = np.arange(NFFT/2, len(x) - NFFT/2 + 1, NFFT - noverlap)/Fs\n \n", "model": "claude-sonnet-5-5", "steps": 8, "finished": true, "patch_lines": 17, "candidates": [{"compile_ok": 0, "loc_hits": 0, "files": 1, "diff_lines": 17, "steps": 8}], "ms": 15195}
{"instance_id": "pallets__flask-5014", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/src/flask/blueprints.py b/src/flask/blueprints.py\nindex eb50585d..1aa82562 100644\n--- a/src/flask/blueprints.py\n+++ b/src/flask/blueprints.py\n@@ -190,6 +190,9 @@ class Blueprint(Scaffold):\n             root_path=root_path,\n         )\n \n+        if not name:\n+            raise ValueError(\"'name' may not be empty.\")\n+\n         if \".\" in name:\n             raise ValueError(\"'name' may not contain a dot '.' character.\")\n \n", "model": "claude-sonnet-5-5", "steps": 6, "finished": true, "patch_lines": 14, "candidates": [{"compile_ok": 0, "loc_hits": 1, "files": 1, "diff_lines": 14, "steps": 6}], "ms": 11598}
{"instance_id": "matplotlib__matplotlib-24149", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py\nindex fdac0f3560..3a61e89e14 100644\n--- a/lib/matplotlib/axes/_axes.py\n+++ b/lib/matplotlib/axes/_axes.py\n@@ -2180,12 +2180,12 @@ class Axes(_AxesBase):\n             # wrap numpy arrays.\n             try:\n                 x0 = cbook._safe_first_finite(x0)\n-            except (TypeError, IndexError, KeyError):\n+            except (TypeError, IndexError, KeyError, StopIteration):\n                 pass\n \n             try:\n                 x = cbook._safe_first_finite(xconv)\n-            except (TypeError, IndexError, KeyError):\n+            except (TypeError, IndexError, KeyError, StopIteration):\n                 x = xconv\n \n             delist = False\n", "model": "claude-sonnet-5-5", "steps": 9, "finished": true, "patch_lines": 19, "candidates": [{"compile_ok": 0, "loc_hits": 1, "files": 1, "diff_lines": 19, "steps": 9}], "ms": 20115}
{"instance_id": "matplotlib__matplotlib-14623", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py\nindex 209a3f92ce..9462269294 100644\n--- a/lib/matplotlib/ticker.py\n+++ b/lib/matplotlib/ticker.py\n@@ -2379,7 +2379,8 @@ class LogLocator(Locator):\n         if not np.isfinite(vmin) or not np.isfinite(vmax):\n             return 1, 10  # initial range, no data plotted yet\n \n-        if vmin > vmax:\n+        swapped = vmin > vmax\n+        if swapped:\n             vmin, vmax = vmax, vmin\n         if vmax <= 0:\n             cbook._warn_external(\n@@ -2395,6 +2396,8 @@ class LogLocator(Locator):\n         if vmin == vmax:\n             vmin = _decade_less(vmin, self._base)\n             vmax = _decade_greater(vmax, self._base)\n+        if swapped:\n+            vmin, vmax = vmax, vmin\n         return vmin, vmax\n \n \n@@ -2624,7 +2627,8 @@ class LogitLocator(Locator):\n         if not np.isfinite(vmin) or not np.isfinite(vmax):\n             return initial_range  # no data plotted yet\n \n-        if vmin > vmax:\n+        swapped = vmin > vmax\n+        if swapped:\n             vmin, vmax = vmax, vmin\n \n         # what to do if a window beyond ]0, 1[ is chosen\n@@ -2647,6 +2651,8 @@ class LogitLocator(Locator):\n         if vmin == vmax:\n             return 0.1 * vmin, 1 - 0.1 * vmin\n \n+        if swapped:\n+            vmin, vmax = vmax, vmin\n         return vmin, vmax\n \n \n", "model": "claude-sonnet-5-5", "steps": 8, "finished": true, "patch_lines": 42, "candidates": [{"compile_ok": 0, "loc_hits": 0, "files": 1, "diff_lines": 42, "steps": 8}], "ms": 21926}
{"instance_id": "matplotlib__matplotlib-26113", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py\nindex 5369eadbde..e7bd5c75d4 100644\n--- a/lib/matplotlib/axes/_axes.py\n+++ b/lib/matplotlib/axes/_axes.py\n@@ -4848,7 +4848,7 @@ default: :rc:`scatter.edgecolors`\n             Use a linear or log10 scale on the vertical axis.\n \n         mincnt : int > 0, default: *None*\n-            If not *None*, only display cells with more than *mincnt*\n+            If not *None*, only display cells with at least *mincnt*\n             number of points in the cell.\n \n         marginals : bool, default: *False*\n@@ -5011,10 +5011,10 @@ default: :rc:`scatter.edgecolors`\n                     Cs_at_i1[i1[i]].append(C[i])\n                 else:\n                     Cs_at_i2[i2[i]].append(C[i])\n-            if mincnt is None:\n-                mincnt = 0\n+            # Empty bins can't be reduced, so require at least one point.\n+            mincnt = 1 if mincnt is None else max(mincnt, 1)\n             accum = np.array(\n-                [reduce_C_function(acc) if len(acc) > mincnt else np.nan\n+                [reduce_C_function(acc) if len(acc) >= mincnt else np.nan\n                  for Cs_at_i in [Cs_at_i1, Cs_at_i2]\n                  for acc in Cs_at_i[1:]],  # [1:] drops out-of-range points.\n                 float)\n", "model": "claude-sonnet-5-5", "steps": 6, "finished": true, "patch_lines": 27, "candidates": [{"compile_ok": 0, "loc_hits": 1, "files": 1, "diff_lines": 27, "steps": 6}], "ms": 16304}
{"instance_id": "django__django-15563", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py\nindex 59a5d6abbb..bfe73234f8 100644\n--- a/django/db/models/sql/compiler.py\n+++ b/django/db/models/sql/compiler.py\n@@ -1836,7 +1836,21 @@ class SQLUpdateCompiler(SQLCompiler):\n         query.clear_ordering(force=True)\n         query.extra = {}\n         query.select = []\n-        query.add_fields([query.get_meta().pk.name])\n+        meta = query.get_meta()\n+        fields = [meta.pk.name]\n+        related_ids_index = []\n+        for related in self.query.related_updates:\n+            if all(\n+                path.join_field.primary_key for path in meta.get_path_to_parent(related)\n+            ):\n+                # The pk chain leads to this ancestor; meta.pk can be used.\n+                related_ids_index.append((related, 0))\n+            else:\n+                # Ancestor is not part of the primary key chain of the MTI\n+                # tree; select the link to it.\n+                related_ids_index.append((related, len(fields)))\n+                fields.append(meta.get_ancestor_link(related).name)\n+        query.add_fields(fields)\n         super().pre_sql_setup()\n \n         must_pre_select = (\n@@ -1851,10 +1865,13 @@ class SQLUpdateCompiler(SQLCompiler):\n             # don't want them to change), or the db backend doesn't support\n             # selecting from the updating table (e.g. MySQL).\n             idents = []\n+            related_ids = collections.defaultdict(list)\n             for rows in query.get_compiler(self.using).execute_sql(MULTI):\n                 idents.extend(r[0] for r in rows)\n+                for parent, index in related_ids_index:\n+                    related_ids[parent].extend(r[index] for r in rows)\n             self.query.add_filter(\"pk__in\", idents)\n-            self.query.related_ids = idents\n+            self.query.related_ids = related_ids\n         else:\n             # The fast path. Filters and updates in one query.\n             self.query.add_filter(\"pk__in\", query)\ndiff --git a/django/db/models/sql/subqueries.py b/django/db/models/sql/subqueries.py\nindex 04063f73bc..d8a246d369 100644\n--- a/django/db/models/sql/subqueries.py\n+++ b/django/db/models/sql/subqueries.py\n@@ -134,7 +134,7 @@ class UpdateQuery(Query):\n             query = UpdateQuery(model)\n             query.values = values\n             if self.related_ids is not None:\n-                query.add_filter(\"pk__in\", self.related_ids)\n+                query.add_filter(\"pk__in\", self.related_ids[model])\n             result.append(query)\n         return result\n \n", "model": "claude-sonnet-5-5", "steps": 14, "finished": true, "patch_lines": 55, "candidates": [{"compile_ok": 0, "loc_hits": 0, "files": 2, "diff_lines": 55, "steps": 14}], "ms": 38866}
{"instance_id": "psf__requests-5414", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/requests/models.py b/requests/models.py\nindex e7d292d5..d8638818 100644\n--- a/requests/models.py\n+++ b/requests/models.py\n@@ -403,7 +403,7 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):\n                 host = self._get_idna_encoded_host(host)\n             except UnicodeError:\n                 raise InvalidURL('URL has an invalid label.')\n-        elif host.startswith(u'*'):\n+        elif host.startswith((u'*', u'.')):\n             raise InvalidURL('URL has an invalid label.')\n \n         # Carefully reconstruct the network location\n", "model": "claude-sonnet-5-5", "steps": 5, "finished": true, "patch_lines": 13, "candidates": [{"compile_ok": 0, "loc_hits": 1, "files": 1, "diff_lines": 13, "steps": 5}], "ms": 10773}
{"instance_id": "pytest-dev__pytest-10081", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/src/_pytest/unittest.py b/src/_pytest/unittest.py\nindex 851e4943b..1b158cb37 100644\n--- a/src/_pytest/unittest.py\n+++ b/src/_pytest/unittest.py\n@@ -316,7 +316,9 @@ class TestCaseFunction(Function):\n             # Arguably we could always postpone tearDown(), but this changes the moment where the\n             # TestCase instance interacts with the results object, so better to only do it\n             # when absolutely needed.\n-            if self.config.getoption(\"usepdb\") and not _is_skipped(self.obj):\n+            if self.config.getoption(\"usepdb\") and not (\n+                _is_skipped(self.obj) or _is_skipped(self._testcase)\n+            ):\n                 self._explicit_tearDown = self._testcase.tearDown\n                 setattr(self._testcase, \"tearDown\", lambda *args: None)\n \n", "model": "claude-sonnet-5-5", "steps": 7, "finished": true, "patch_lines": 15, "candidates": [{"compile_ok": 0, "loc_hits": 0, "files": 1, "diff_lines": 15, "steps": 7}], "ms": 10279}
