{"instance_id": "django__django-14752", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/django/contrib/admin/views/autocomplete.py b/django/contrib/admin/views/autocomplete.py\nindex 3903e4c98c..9abc3bc514 100644\n--- a/django/contrib/admin/views/autocomplete.py\n+++ b/django/contrib/admin/views/autocomplete.py\n@@ -26,12 +26,19 @@ class AutocompleteJsonView(BaseListView):\n         context = self.get_context_data()\n         return JsonResponse({\n             'results': [\n-                {'id': str(getattr(obj, to_field_name)), 'text': str(obj)}\n+                self.serialize_result(obj, to_field_name)\n                 for obj in context['object_list']\n             ],\n             'pagination': {'more': context['page_obj'].has_next()},\n         })\n \n+    def serialize_result(self, obj, to_field_name):\n+        \"\"\"\n+        Convert the provided model object to a dictionary that is added to the\n+        results list.\n+        \"\"\"\n+        return {'id': str(getattr(obj, to_field_name)), 'text': str(obj)}\n+\n     def get_paginator(self, *args, **kwargs):\n         \"\"\"Use the ModelAdmin's paginator.\"\"\"\n         return self.model_admin.get_paginator(self.request, *args, **kwargs)\n", "model": "claude-sonnet-5-5", "steps": 2, "finished": true, "patch_lines": 25, "candidates": [{"compile_ok": 0, "loc_hits": 1, "files": 1, "diff_lines": 25, "steps": 2}], "ms": 9390}
{"instance_id": "django__django-11265", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py\nindex d69c24419b..405f54774c 100644\n--- a/django/db/models/sql/query.py\n+++ b/django/db/models/sql/query.py\n@@ -1666,6 +1666,7 @@ class Query(BaseExpression):\n             filter_expr = (filter_lhs, OuterRef(filter_rhs.name))\n         # Generate the inner query.\n         query = Query(self.model)\n+        query._filtered_relations = self._filtered_relations\n         query.add_filter(filter_expr)\n         query.clear_ordering(True)\n         # Try to have as simple as possible subquery -> trim leading joins from\n", "model": "claude-sonnet-5-5", "steps": 7, "finished": true, "patch_lines": 12, "candidates": [{"compile_ok": 0, "loc_hits": 1, "files": 1, "diff_lines": 12, "steps": 7}], "ms": 14021}
{"instance_id": "django__django-12155", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/django/contrib/admindocs/utils.py b/django/contrib/admindocs/utils.py\nindex 4c0e7e2a56..aa663ead5b 100644\n--- a/django/contrib/admindocs/utils.py\n+++ b/django/contrib/admindocs/utils.py\n@@ -34,7 +34,7 @@ def trim_docstring(docstring):\n         return ''\n     # Convert tabs to spaces and split into lines\n     lines = docstring.expandtabs().splitlines()\n-    indent = min(len(line) - len(line.lstrip()) for line in lines if line.lstrip())\n+    indent = min((len(line) - len(line.lstrip()) for line in lines[1:] if line.lstrip()), default=0)\n     trimmed = [lines[0].lstrip()] + [line[indent:].rstrip() for line in lines[1:]]\n     return \"\\n\".join(trimmed).strip()\n \n", "model": "claude-sonnet-5-5", "steps": 10, "finished": true, "patch_lines": 13, "candidates": [{"compile_ok": 0, "loc_hits": 0, "files": 1, "diff_lines": 13, "steps": 10}], "ms": 17763}
{"instance_id": "django__django-13279", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/django/contrib/sessions/backends/base.py b/django/contrib/sessions/backends/base.py\nindex b5453160a5..acd96c03ec 100644\n--- a/django/contrib/sessions/backends/base.py\n+++ b/django/contrib/sessions/backends/base.py\n@@ -108,11 +108,20 @@ class SessionBase:\n \n     def encode(self, session_dict):\n         \"Return the given session dictionary serialized and encoded as a string.\"\n+        # RemovedInDjango40Warning: DEFAULT_HASHING_ALGORITHM will be removed.\n+        if settings.DEFAULT_HASHING_ALGORITHM == 'sha1':\n+            return self._legacy_encode(session_dict)\n         return signing.dumps(\n             session_dict, salt=self.key_salt, serializer=self.serializer,\n             compress=True,\n         )\n \n+    def _legacy_encode(self, session_dict):\n+        # RemovedInDjango40Warning.\n+        serialized = self.serializer().dumps(session_dict)\n+        hash = self._hash(serialized)\n+        return base64.b64encode(hash.encode() + b':' + serialized).decode('ascii')\n+\n     def decode(self, session_data):\n         try:\n             return signing.loads(session_data, salt=self.key_salt, serializer=self.serializer)\n", "model": "claude-sonnet-5-5", "steps": 7, "finished": true, "patch_lines": 25, "candidates": [{"compile_ok": 0, "loc_hits": 0, "files": 1, "diff_lines": 25, "steps": 7}], "ms": 20735}
{"instance_id": "django__django-13933", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/django/forms/models.py b/django/forms/models.py\nindex 422bc5d178..e403cf2c12 100644\n--- a/django/forms/models.py\n+++ b/django/forms/models.py\n@@ -1188,8 +1188,8 @@ class ModelChoiceField(ChoiceField):\n     # This class is a subclass of ChoiceField for purity, but it doesn't\n     # actually use any of ChoiceField's implementation.\n     default_error_messages = {\n-        'invalid_choice': _('Select a valid choice. That choice is not one of'\n-                            ' the available choices.'),\n+        'invalid_choice': _('Select a valid choice. %(value)s is not one of the'\n+                            ' available choices.'),\n     }\n     iterator = ModelChoiceIterator\n \n@@ -1284,7 +1284,11 @@ class ModelChoiceField(ChoiceField):\n                 value = getattr(value, key)\n             value = self.queryset.get(**{key: value})\n         except (ValueError, TypeError, self.queryset.model.DoesNotExist):\n-            raise ValidationError(self.error_messages['invalid_choice'], code='invalid_choice')\n+            raise ValidationError(\n+                self.error_messages['invalid_choice'],\n+                code='invalid_choice',\n+                params={'value': value},\n+            )\n         return value\n \n     def validate(self, value):\n", "model": "claude-sonnet-5-5", "steps": 7, "finished": true, "patch_lines": 28, "candidates": [{"compile_ok": 0, "loc_hits": 1, "files": 1, "diff_lines": 28, "steps": 7}], "ms": 22004}
{"instance_id": "astropy__astropy-14369", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/astropy/units/format/cds.py b/astropy/units/format/cds.py\nindex 307e987ed6..1e3425e318 100644\n--- a/astropy/units/format/cds.py\n+++ b/astropy/units/format/cds.py\n@@ -182,7 +182,7 @@ class CDS(Base):\n         def p_division_of_units(p):\n             \"\"\"\n             division_of_units : DIVISION unit_expression\n-                              | unit_expression DIVISION combined_units\n+                              | combined_units DIVISION unit_expression\n             \"\"\"\n             if len(p) == 3:\n                 p[0] = p[2] ** -1\n", "model": "claude-sonnet-5-5", "steps": 8, "finished": true, "patch_lines": 13, "candidates": [{"compile_ok": 0, "loc_hits": 0, "files": 1, "diff_lines": 13, "steps": 8}], "ms": 23870}
{"instance_id": "django__django-15561", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/django/db/backends/base/schema.py b/django/db/backends/base/schema.py\nindex 9d6952df21..85d53e3b1a 100644\n--- a/django/db/backends/base/schema.py\n+++ b/django/db/backends/base/schema.py\n@@ -1378,6 +1378,7 @@ class BaseDatabaseSchemaEditor:\n         # - adding only a db_column and the column name is not changed\n         non_database_attrs = [\n             \"blank\",\n+            \"choices\",\n             \"db_column\",\n             \"editable\",\n             \"error_messages\",\n", "model": "claude-sonnet-5-5", "steps": 9, "finished": true, "patch_lines": 12, "candidates": [{"compile_ok": 0, "loc_hits": 0, "files": 1, "diff_lines": 12, "steps": 9}], "ms": 14788}
{"instance_id": "django__django-16485", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py\nindex 23c3a08c67..3032a36f76 100644\n--- a/django/template/defaultfilters.py\n+++ b/django/template/defaultfilters.py\n@@ -183,7 +183,7 @@ def floatformat(text, arg=-1):\n     tupl = d.as_tuple()\n     units = len(tupl[1])\n     units += -tupl[2] if m else tupl[2]\n-    prec = abs(p) + units + 1\n+    prec = max(1, abs(p) + units + 1)\n \n     # Avoid conversion to scientific notation by accessing `sign`, `digits`,\n     # and `exponent` from Decimal.as_tuple() directly.\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": 11702}
{"instance_id": "matplotlib__matplotlib-21568", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/lib/matplotlib/dates.py b/lib/matplotlib/dates.py\nindex 0766156d64..d0d7d72f64 100644\n--- a/lib/matplotlib/dates.py\n+++ b/lib/matplotlib/dates.py\n@@ -595,8 +595,11 @@ def _wrap_in_tex(text):\n     p = r'([a-zA-Z]+)'\n     ret_text = re.sub(p, r'}$\\1$\\\\mathdefault{', text)\n \n-    # Braces ensure dashes are not spaced like binary operators.\n-    ret_text = '$\\\\mathdefault{'+ret_text.replace('-', '{-}')+'}$'\n+    # Braces ensure symbols are not spaced like binary operators.\n+    ret_text = ret_text.replace('-', '{-}').replace(':', '{:}')\n+    # Avoid spaces being dropped in math mode.\n+    ret_text = ret_text.replace(' ', r'\\;')\n+    ret_text = '$\\\\mathdefault{' + ret_text + '}$'\n     ret_text = ret_text.replace('$\\\\mathdefault{}$', '')\n     return ret_text\n \n", "model": "claude-sonnet-5-5", "steps": 6, "finished": true, "patch_lines": 18, "candidates": [{"compile_ok": 0, "loc_hits": 0, "files": 1, "diff_lines": 18, "steps": 6}], "ms": 15333}
{"instance_id": "sphinx-doc__sphinx-9258", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py\nindex 7d39d80ed..ba021b36b 100644\n--- a/sphinx/domains/python.py\n+++ b/sphinx/domains/python.py\n@@ -304,7 +304,7 @@ class PyXrefMixin:\n     def make_xrefs(self, rolename: str, domain: str, target: str,\n                    innernode: Type[TextlikeNode] = nodes.emphasis,\n                    contnode: Node = None, env: BuildEnvironment = None) -> List[Node]:\n-        delims = r'(\\s*[\\[\\]\\(\\),](?:\\s*or\\s)?\\s*|\\s+or\\s+|\\.\\.\\.)'\n+        delims = r'(\\s*[\\[\\]\\(\\),](?:\\s*or\\s)?\\s*|\\s+or\\s+|\\s*\\|\\s*|\\.\\.\\.)'\n         delims_re = re.compile(delims)\n         sub_targets = re.split(delims, target)\n \n", "model": "claude-sonnet-5-5", "steps": 7, "finished": true, "patch_lines": 13, "candidates": [{"compile_ok": 0, "loc_hits": 1, "files": 1, "diff_lines": 13, "steps": 7}], "ms": 8959}
{"instance_id": "pylint-dev__pylint-4604", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/pylint/checkers/variables.py b/pylint/checkers/variables.py\nindex 3ddafd599..46ee6ce38 100644\n--- a/pylint/checkers/variables.py\n+++ b/pylint/checkers/variables.py\n@@ -1826,6 +1826,12 @@ class VariablesChecker(BaseChecker):\n             self._type_annotation_names.append(type_annotation.name)\n             return\n \n+        if isinstance(type_annotation, astroid.Attribute):\n+            self._type_annotation_names.extend(\n+                name.name for name in type_annotation.nodes_of_class(astroid.Name)\n+            )\n+            return\n+\n         if not isinstance(type_annotation, astroid.Subscript):\n             return\n \n", "model": "claude-sonnet-5-5", "steps": 9, "finished": true, "patch_lines": 17, "candidates": [{"compile_ok": 0, "loc_hits": 1, "files": 1, "diff_lines": 17, "steps": 9}], "ms": 14580}
{"instance_id": "scikit-learn__scikit-learn-11310", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/sklearn/model_selection/_search.py b/sklearn/model_selection/_search.py\nindex 99d6096af7..a339b9b167 100644\n--- a/sklearn/model_selection/_search.py\n+++ b/sklearn/model_selection/_search.py\n@@ -17,6 +17,7 @@ from collections import Mapping, namedtuple, defaultdict, Sequence, Iterable\n from functools import partial, reduce\n from itertools import product\n import operator\n+import time\n import warnings\n \n import numpy as np\n@@ -766,10 +767,13 @@ class BaseSearchCV(six.with_metaclass(ABCMeta, BaseEstimator,\n         if self.refit:\n             self.best_estimator_ = clone(base_estimator).set_params(\n                 **self.best_params_)\n+            refit_start_time = time.time()\n             if y is not None:\n                 self.best_estimator_.fit(X, y, **fit_params)\n             else:\n                 self.best_estimator_.fit(X, **fit_params)\n+            refit_end_time = time.time()\n+            self.refit_time_ = refit_end_time - refit_start_time\n \n         # Store the only scorer not as a dict for single metric evaluation\n         self.scorer_ = scorers if self.multimetric_ else scorers['score']\n@@ -1076,6 +1080,11 @@ class GridSearchCV(BaseSearchCV):\n     n_splits_ : int\n         The number of cross-validation splits (folds/iterations).\n \n+    refit_time_ : float\n+        Seconds used for refitting the best model on the whole dataset.\n+\n+        This is present only if ``refit`` is not False.\n+\n     Notes\n     ------\n     The parameters selected are those that maximize the score of the left out\n@@ -1387,6 +1396,11 @@ class RandomizedSearchCV(BaseSearchCV):\n     n_splits_ : int\n         The number of cross-validation splits (folds/iterations).\n \n+    refit_time_ : float\n+        Seconds used for refitting the best model on the whole dataset.\n+\n+        This is present only if ``refit`` is not False.\n+\n     Notes\n     -----\n     The parameters selected are those that maximize the score of the held-out\n", "model": "claude-sonnet-5-5", "steps": 7, "finished": true, "patch_lines": 50, "candidates": [{"compile_ok": 0, "loc_hits": 1, "files": 1, "diff_lines": 50, "steps": 7}], "ms": 17104}
{"instance_id": "psf__requests-1142", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/requests/models.py b/requests/models.py\nindex 99260453..42351417 100644\n--- a/requests/models.py\n+++ b/requests/models.py\n@@ -386,13 +386,14 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin):\n         self.body = body\n \n     def prepare_content_length(self, body):\n-        self.headers['Content-Length'] = '0'\n         if hasattr(body, 'seek') and hasattr(body, 'tell'):\n             body.seek(0, 2)\n             self.headers['Content-Length'] = str(body.tell())\n             body.seek(0, 0)\n         elif body is not None:\n             self.headers['Content-Length'] = str(len(body))\n+        elif self.method not in ('GET', 'HEAD'):\n+            self.headers['Content-Length'] = '0'\n \n     def prepare_auth(self, auth):\n         \"\"\"Prepares the given HTTP auth data.\"\"\"\n", "model": "claude-sonnet-5-5", "steps": 14, "finished": true, "patch_lines": 20, "candidates": [{"compile_ok": 0, "loc_hits": 1, "files": 1, "diff_lines": 20, "steps": 14}], "ms": 24797}
{"instance_id": "sympy__sympy-14711", "model_name_or_path": "cain-anthropic-e124", "model_patch": "diff --git a/sympy/physics/vector/vector.py b/sympy/physics/vector/vector.py\nindex a048ee57f1..8849119218 100644\n--- a/sympy/physics/vector/vector.py\n+++ b/sympy/physics/vector/vector.py\n@@ -57,6 +57,8 @@ def __hash__(self):\n \n     def __add__(self, other):\n         \"\"\"The add operator for Vector. \"\"\"\n+        if other == 0:\n+            return self\n         other = _check_vector(other)\n         return Vector(self.args + other.args)\n \n", "model": "claude-sonnet-5-5", "steps": 7, "finished": true, "patch_lines": 13, "candidates": [{"compile_ok": 0, "loc_hits": 0, "files": 1, "diff_lines": 13, "steps": 7}], "ms": 16457}
