failed WRONG_FIX UNSUBMITTED wrong_fix_unsubmitted(budget) ยท 35 tool calls ยท 307 s ยท fastapi/fastapi
๐ Add a custom `FastAPIDeprecationWarning` ๐ Add a custom `FastAPIDeprecationWarning` and use it for deprecated logic, like Pydantic v1 models. Motivated by: https://sethmlarson.dev/deprecations-via-warnings-dont-work-for-python-libraries
| # | Tool | Arguments | Result |
|---|---|---|---|
| 1 | run_command | {
"command": "find . -maxdepth 4 -name \"*fastapi*\""
} | {"status": "ok", "stdout": "./fastapi\n./tests/test_fastapi_cli.py\n./docs/ko/docs/help-fastapi.md\n./docs/ko/docs/fastapi-cli.md\n./docs/zh-hant/docs/fastapi-cfull{"status": "ok", "stdout": "./fastapi\n./tests/test_fastapi_cli.py\n./docs/ko/docs/help-fastapi.md\n./docs/ko/docs/fastapi-cli.md\n./docs/zh-hant/docs/fastapi-cli.md\n./docs/fr/docs/help-fastapi.md\n./docs/ja/docs/help-fastapi.md\n./docs/es/docs/help-fastapi.md\n./docs/es/docs/fastapi-cli.md\n./docs/de/docs/help-fastapi.md\n./docs/de/docs/fastapi-cli.md\n./docs/zh/docs/help-fastapi.md\n./docs/zh/docs/fastapi-cli.md\n./docs/en/docs/help-fastapi.md\n./docs/en/docs/fastapi-people.md\n./docs/en/docs/fastapi-cli.md\n./docs/uk/docs/fastapi-cli.md\n./docs/pt/docs/help-fastapi.md\n./docs/pt/docs/fastapi-cli.md\n./docs/ru/docs/help-fastapi.md\n./docs/ru/docs/fastapi-cli.md\n", "stderr": "", "exit_code": 0} |
| 2 | run_command | {
"command": "ls -R fastapi"
} | {"status": "ok", "stdout": "fastapi:\n__init__.py\n__main__.py\n_compat\napplications.py\nbackground.py\ncli.py\nconcurrency.py\ndatastructures.py\ndependenciesfull{"status": "ok", "stdout": "fastapi:\n__init__.py\n__main__.py\n_compat\napplications.py\nbackground.py\ncli.py\nconcurrency.py\ndatastructures.py\ndependencies\nencoders.py\nexception_handlers.py\nexceptions.py\nlogger.py\nmiddleware\nopenapi\nparam_functions.py\nparams.py\npy.typed\nrequests.py\nresponses.py\nrouting.py\nsecurity\nstaticfiles.py\ntemp_pydantic_v1_params.py\ntemplating.py\ntestclient.py\ntypes.py\nutils.py\nwebsockets.py\n\nfastapi/_compat:\n__init__.py\nmain.py\nmay_v1.py\nmodel_field.py\nshared.py\nv1.py\nv2.py\n\nfastapi/dependencies:\n__init__.py\nmodels.py\nutils.py\n\nfastapi/middleware:\n__init__.py\nasyncexitstack.py\ncors.py\ngzip.py\nhttpsredirect.py\ntrustedhost.py\nwsgi.py\n\nfastapi/openapi:\n__init__.py\nconstants.py\ndocs.py\nmodels.py\nutils.py\n\nfastapi/security:\n__init__.py\napi_key.py\nbase.py\nhttp.py\noauth2.py\nopen_id_connect_url.py\nutils.py\n", "stderr": "", "exit_code": 0} |
| 3 | read_file | {
"filepath": "fastapi/exceptions.py"
} | {"status": "ok", "filepath": "fastapi/exceptions.py", "content": "from collections.abc import Sequence\nfrom typing import Annotated, Any, Optional, TypedDict, full{"status": "ok", "filepath": "fastapi/exceptions.py", "content": "from collections.abc import Sequence\nfrom typing import Annotated, Any, Optional, TypedDict, Union\n\nfrom annotated_doc import Doc\nfrom pydantic import BaseModel, create_model\nfrom starlette.exceptions import HTTPException as StarletteHTTPException\nfrom starlette.exceptions import WebSocketException as StarletteWebSocketException\n\n\nclass EndpointContext(TypedDict, total=False):\n function: str\n path: str\n file: str\n line: int\n\n\nclass HTTPException(StarletteHTTPException):\n \"\"\"\n An HTTP exception you can raise in your own code to show errors to the client.\n\n This is for client errors, invalid authentication, invalid data, etc. Not for server\n errors in your code.\n\n Read more about it in the\n [FastAPI docs for Handling Errors](https://fastapi.tiangolo.com/tutorial/handling-errors/).\n\n ## Example\n\n ```python\n from fastapi import FastAPI, HTTPException\n\n app = FastAPI()\n\n items = {\"foo\": \"The Foo Wrestlers\"}\n\n\n @app.get(\"/items/{item_id}\")\n async def read_item(item_id: str):\n if item_id not in items:\n raise HTTPException(status_code=404, detail=\"Item not found\")\n return {\"item\": items[item_id]}\n ```\n \"\"\"\n\n def __init__(\n self,\n status_code: Annotated[\n int,\n Doc(\n \"\"\"\n HTTP status code to send to the client.\n \"\"\"\n ),\n ],\n detail: Annotated[\n Any,\n Doc(\n \"\"\"\n Any data to be sent to the client in the `detail` key of the JSON\n response.\n \"\"\"\n ),\n ] = None,\n headers: Annotated[\n Optional[dict[str, str]],\n Doc(\n \"\"\"\n Any headers to send to the client in the response.\n |
| 4 | run_command | {
"command": "grep -rn \"DeprecationWarning\" fastapi"
} | {"status": "ok", "stdout": "fastapi/dependencies/utils.py:330: category=DeprecationWarning,\nfastapi/temp_pydantic_v1_params.py:66: category=DeprecationWarning,full{"status": "ok", "stdout": "fastapi/dependencies/utils.py:330: category=DeprecationWarning,\nfastapi/temp_pydantic_v1_params.py:66: category=DeprecationWarning,\nfastapi/temp_pydantic_v1_params.py:96: category=DeprecationWarning,\nfastapi/temp_pydantic_v1_params.py:506: category=DeprecationWarning,\nfastapi/temp_pydantic_v1_params.py:536: category=DeprecationWarning,\nfastapi/routing.py:643: category=DeprecationWarning,\nfastapi/routing.py:683: category=DeprecationWarning,\nfastapi/utils.py:200: DeprecationWarning,\nfastapi/params.py:78: category=DeprecationWarning,\nfastapi/params.py:108: category=DeprecationWarning,\nfastapi/params.py:533: category=DeprecationWarning,\nfastapi/params.py:563: category=DeprecationWarning,\nfastapi/openapi/utils.py:220: DeprecationWarning,\n", "stderr": "", "exit_code": 0} |
| 5 | read_file | {
"filepath": "fastapi/exceptions.py",
"start_line": "234",
"end_line": "250"
} | {"status": "error", "error_type": "FileReadError", "error_message": "'>' not supported between instances of 'int' and 'str'"}full{"status": "error", "error_type": "FileReadError", "error_message": "'>' not supported between instances of 'int' and 'str'"} |
| 6 | read_file | {
"filepath": "fastapi/exceptions.py",
"start_line": "234"
} | {"status": "error", "error_type": "FileReadError", "error_message": "'>' not supported between instances of 'int' and 'str'"}full{"status": "error", "error_type": "FileReadError", "error_message": "'>' not supported between instances of 'int' and 'str'"} |
| 7 | run_command | {
"command": "wc -l fastapi/exceptions.py"
} | {"status": "ok", "stdout": "233 fastapi/exceptions.py\n", "stderr": "", "exit_code": 0}full{"status": "ok", "stdout": "233 fastapi/exceptions.py\n", "stderr": "", "exit_code": 0} |
| 8 | edit_file | {
"filepath": "fastapi/exceptions.py",
"new_string": "from collections.abc import Sequence\nfrom typing import Annotated, Any, Optional, TypedDict, Union\n\nfrom annotated_doc import Doc\nfrom pydantic import BaseModel, create_model\nfrom starlette.exceptions import HTTPException as StarletteHTTPException\nfrom starlette.exceptions import WebSocketException as StarletteWebSocketException\n\n\nclass FastAPIDeprecationWarning(DeprecationWarning):\n \\\"\\\"\\\"\n Warning raised when a feature in FastAPI is deprecated.\n \\\"\\\"\\\"\n\n\nclass EndpointContext(TypedDict, total=False):\n",
"old_string": "from collections.abc import Sequence\nfrom typing import Annotated, Any, Optional, TypedDict, Union\n\nfrom annotated_doc import Doc\nfrom pydantic import BaseModel, create_model\nfrom starlette.exceptions import HTTPException as StarletteHTTPException\nfrom starlette.exceptions import WebSocketException as StarletteWebSocketException\n\n\nclass EndpointContext(TypedDict, total=False):\n"
} | {"status": "ok", "filepath": "fastapi/exceptions.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/exceptions.py\n+++ b/fastapi/exceptions.py\nfull{"status": "ok", "filepath": "fastapi/exceptions.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/exceptions.py\n+++ b/fastapi/exceptions.py\n@@ -5,6 +5,12 @@\n from pydantic import BaseModel, create_model\n from starlette.exceptions import HTTPException as StarletteHTTPException\n from starlette.exceptions import WebSocketException as StarletteWebSocketException\n+\n+\n+class FastAPIDeprecationWarning(DeprecationWarning):\n+ \\\"\\\"\\\"\n+ Warning raised when a feature in FastAPI is deprecated.\n+ \\\"\\\"\\\"\n \n \n class EndpointContext(TypedDict, total=False):\n", "is_truncated": false} |
| 9 | run_command | {
"command": "grep -rn \"category=DeprecationWarning\" fastapi"
} | {"status": "ok", "stdout": "fastapi/dependencies/utils.py:330: category=DeprecationWarning,\nfastapi/temp_pydantic_v1_params.py:66: category=DeprecationWarning,full{"status": "ok", "stdout": "fastapi/dependencies/utils.py:330: category=DeprecationWarning,\nfastapi/temp_pydantic_v1_params.py:66: category=DeprecationWarning,\nfastapi/temp_pydantic_v1_params.py:96: category=DeprecationWarning,\nfastapi/temp_pydantic_v1_params.py:506: category=DeprecationWarning,\nfastapi/temp_pydantic_v1_params.py:536: category=DeprecationWarning,\nfastapi/routing.py:643: category=DeprecationWarning,\nfastapi/routing.py:683: category=DeprecationWarning,\nfastapi/params.py:78: category=DeprecationWarning,\nfastapi/params.py:108: category=DeprecationWarning,\nfastapi/params.py:533: category=DeprecationWarning,\nfastapi/params.py:563: category=DeprecationWarning,\n", "stderr": "", "exit_code": 0} |
| 10 | read_file | {
"filepath": "fastapi/dependencies/utils.py",
"start_line": "320",
"end_line": "340"
} | {"status": "error", "error_type": "FileReadError", "error_message": "'>' not supported between instances of 'int' and 'str'"}full{"status": "error", "error_type": "FileReadError", "error_message": "'>' not supported between instances of 'int' and 'str'"} |
| 11 | read_file | {
"filepath": "fastapi/dependencies/utils.py",
"start_line": "320"
} | {"status": "error", "error_type": "FileReadError", "error_message": "'>' not supported between instances of 'int' and 'str'"}full{"status": "error", "error_type": "FileReadError", "error_message": "'>' not supported between instances of 'int' and 'str'"} |
| 12 | run_command | {
"command": "grep -n \"category=DeprecationWarning\" fastapi/dependencies/utils.py"
} | {"status": "ok", "stdout": "330: category=DeprecationWarning,\n", "stderr": "", "exit_code": 0}full{"status": "ok", "stdout": "330: category=DeprecationWarning,\n", "stderr": "", "exit_code": 0} |
| 13 | read_file | {
"end_line": "340",
"filepath": "fastapi/dependencies/utils.py",
"start_line": "320"
} | {"status": "error", "error_type": "FileReadError", "error_message": "'>' not supported between instances of 'int' and 'str'"}full{"status": "error", "error_type": "FileReadError", "error_message": "'>' not supported between instances of 'int' and 'str'"} |
| 14 | run_command | {
"command": "sed -n '320,340p' fastapi/dependencies/utils.py"
} | {"status": "ok", "stdout": " ):\n assert param_details.field is None, (\n f\"Cannot specify multiple FastAPI annotations for {param_name!r}\"\n )\n continue\n afull{"status": "ok", "stdout": " ):\n assert param_details.field is None, (\n f\"Cannot specify multiple FastAPI annotations for {param_name!r}\"\n )\n continue\n assert param_details.field is not None\n if isinstance(param_details.field, may_v1.ModelField):\n warnings.warn(\n \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\n f\" Please update the param {param_name}: {param_details.type_annotation!r}.\",\n category=DeprecationWarning,\n stacklevel=5,\n )\n if isinstance(\n param_details.field.field_info, (params.Body, temp_pydantic_v1_params.Body)\n ):\n dependant.body_params.append(param_details.field)\n else:\n add_param_to_fields(field=param_details.field, dependant=dependant)\n return dependant\n\n", "stderr": "", "exit_code": 0} |
| 15 | edit_file | {
"filepath": "fastapi/dependencies/utils.py",
"new_string": " if isinstance(param_details.field, may_v1.ModelField):\n warnings.warn(\n \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\n f\" Please update the param {param_name}: {param_details.type_annotation!r}.\",\n category=FastAPIDeprecationWarning,\n stacklevel=5,\n )\n",
"old_string": " if isinstance(param_details.field, may_v1.ModelField):\n warnings.warn(\n \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\n f\" Please update the param {param_name}: {param_details.type_annotation!r}.\",\n category=DeprecationWarning,\n stacklevel=5,\n )\n"
} | {"status": "ok", "filepath": "fastapi/dependencies/utils.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/dependencies/utils.py\n+++ b/fastapifull{"status": "ok", "filepath": "fastapi/dependencies/utils.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/dependencies/utils.py\n+++ b/fastapi/dependencies/utils.py\n@@ -327,7 +327,7 @@\n warnings.warn(\n \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\n f\" Please update the param {param_name}: {param_details.type_annotation!r}.\",\n- category=DeprecationWarning,\n+ category=FastAPIDeprecationWarning,\n stacklevel=5,\n )\n if isinstance(\n", "is_truncated": false} |
| 16 | run_command | {
"command": "grep -n \"category=DeprecationWarning\" fastapi/temp_pydantic_v1_params.py"
} | {"status": "ok", "stdout": "66: category=DeprecationWarning,\n96: category=DeprecationWarning,\n506: category=DeprecationWarning,\n536: category=DeprecationWarnfull{"status": "ok", "stdout": "66: category=DeprecationWarning,\n96: category=DeprecationWarning,\n506: category=DeprecationWarning,\n536: category=DeprecationWarning,\n", "stderr": "", "exit_code": 0} |
| 17 | run_command | {
"command": "sed -n '60,100p' fastapi/temp_pydantic_v1_params.py"
} | {"status": "ok", "stdout": " json_schema_extra: Union[dict[str, Any], None] = None,\n **extra: Any,\n ):\n if example is not _Unset:\n warnings.warn(\n \"`exampfull{"status": "ok", "stdout": " json_schema_extra: Union[dict[str, Any], None] = None,\n **extra: Any,\n ):\n if example is not _Unset:\n warnings.warn(\n \"`example` has been deprecated, please use `examples` instead\",\n category=DeprecationWarning,\n stacklevel=4,\n )\n self.example = example\n self.include_in_schema = include_in_schema\n self.openapi_examples = openapi_examples\n kwargs = dict(\n default=default,\n default_factory=default_factory,\n alias=alias,\n title=title,\n description=description,\n gt=gt,\n ge=ge,\n lt=lt,\n le=le,\n min_length=min_length,\n max_length=max_length,\n discriminator=discriminator,\n multiple_of=multiple_of,\n allow_inf_nan=allow_inf_nan,\n max_digits=max_digits,\n decimal_places=decimal_places,\n **extra,\n )\n if examples is not None:\n kwargs[\"examples\"] = examples\n if regex is not None:\n warnings.warn(\n \"`regex` has been deprecated, please use `pattern` instead\",\n category=DeprecationWarning,\n stacklevel=4,\n )\n current_json_schema_extra = json_schema_extra or extra\n kwargs[\"deprecated\"] = deprecated\n", "stderr": "", "exit_code": 0} |
| 18 | edit_file | {
"filepath": "fastapi/temp_pydantic_v1_params.py",
"new_string": " if example is not _Unset:\n warnings.warn(\n \"`example` has been deprecated, please use `examples` instead\",\n category=FastAPIDeprecationWarning,\n stacklevel=4,\n )\n",
"old_string": " if example is not _Unset:\n warnings.warn(\n \"`example` has been deprecated, please use `examples` instead\",\n category=DeprecationWarning,\n stacklevel=4,\n )\n"
} | {"status": "error", "error_type": "FileEditError", "error_message": "Target string occurs 2 times in fastapi/temp_pydantic_v1_params.py. Please provide more surfull{"status": "error", "error_type": "FileEditError", "error_message": "Target string occurs 2 times in fastapi/temp_pydantic_v1_params.py. Please provide more surrounding context."} |
| 19 | edit_file | {
"filepath": "fastapi/temp_pydantic_v1_params.py",
"new_string": " if example is not _Unset:\n warnings.warn(\n \"`example` has been deprecated, please use `examples` instead\",\n category=FastAPIDeprecationWarning,\n stacklevel=4,\n )\n",
"old_string": " if example is not _Unset:\n warnings.warn(\n \"`example` has been deprecated, please use `examples` instead\",\n category=DeprecationWarning,\n stacklevel=4,\n )\n",
"allow_multiple": true
} | {"status": "ok", "filepath": "fastapi/temp_pydantic_v1_params.py", "occurrences": 2, "strategy": "exact", "diff": "--- a/fastapi/temp_pydantic_v1_params.py\n+++full{"status": "ok", "filepath": "fastapi/temp_pydantic_v1_params.py", "occurrences": 2, "strategy": "exact", "diff": "--- a/fastapi/temp_pydantic_v1_params.py\n+++ b/fastapi/temp_pydantic_v1_params.py\n@@ -63,7 +63,7 @@\n if example is not _Unset:\n warnings.warn(\n \"`example` has been deprecated, please use `examples` instead\",\n- category=DeprecationWarning,\n+ category=FastAPIDeprecationWarning,\n stacklevel=4,\n )\n self.example = example\n@@ -503,7 +503,7 @@\n if example is not _Unset:\n warnings.warn(\n \"`example` has been deprecated, please use `examples` instead\",\n- category=DeprecationWarning,\n+ category=FastAPIDeprecationWarning,\n stacklevel=4,\n )\n self.example = example\n", "is_truncated": false} |
| 20 | edit_file | {
"allow_multiple": true,
"filepath": "fastapi/temp_pydantic_v1_params.py",
"new_string": " if regex is not None:\n warnings.warn(\n \"`regex` has been deprecated, please use `pattern` instead\",\n category=FastAPIDeprecationWarning,\n stacklevel=4,\n )\n",
"old_string": " if regex is not None:\n warnings.warn(\n \"`regex` has been deprecated, please use `pattern` instead\",\n category=DeprecationWarning,\n stacklevel=4,\n )\n"
} | {"status": "ok", "filepath": "fastapi/temp_pydantic_v1_params.py", "occurrences": 2, "strategy": "exact", "diff": "--- a/fastapi/temp_pydantic_v1_params.py\n+++full{"status": "ok", "filepath": "fastapi/temp_pydantic_v1_params.py", "occurrences": 2, "strategy": "exact", "diff": "--- a/fastapi/temp_pydantic_v1_params.py\n+++ b/fastapi/temp_pydantic_v1_params.py\n@@ -93,7 +93,7 @@\n if regex is not None:\n warnings.warn(\n \"`regex` has been deprecated, please use `pattern` instead\",\n- category=DeprecationWarning,\n+ category=FastAPIDeprecationWarning,\n stacklevel=4,\n )\n current_json_schema_extra = json_schema_extra or extra\n@@ -533,7 +533,7 @@\n if regex is not None:\n warnings.warn(\n \"`regex` has been deprecated, please use `pattern` instead\",\n- category=DeprecationWarning,\n+ category=FastAPIDeprecationWarning,\n stacklevel=4,\n )\n current_json_schema_extra = json_schema_extra or extra\n", "is_truncated": false} |
| 21 | run_command | {
"command": "grep -n \"category=DeprecationWarning\" fastapi/routing.py"
} | {"status": "ok", "stdout": "643: category=DeprecationWarning,\n683: category=DeprecationWarning,\n", "stderr": "", "exit_code": 0}full{"status": "ok", "stdout": "643: category=DeprecationWarning,\n683: category=DeprecationWarning,\n", "stderr": "", "exit_code": 0} |
| 22 | run_command | {
"command": "sed -n '630,650p' fastapi/routing.py"
} | {"status": "ok", "stdout": " # normalize enums e.g. http.HTTPStatus\n if isinstance(status_code, IntEnum):\n status_code = int(status_code)\n self.status_code =full{"status": "ok", "stdout": " # normalize enums e.g. http.HTTPStatus\n if isinstance(status_code, IntEnum):\n status_code = int(status_code)\n self.status_code = status_code\n if self.response_model:\n assert is_body_allowed_for_status_code(status_code), (\n f\"Status code {status_code} must not have a response body\"\n )\n response_name = \"Response_\" + self.unique_id\n if annotation_is_pydantic_v1(self.response_model):\n warnings.warn(\n \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\n f\" Please update the response model {self.response_model!r}.\",\n category=DeprecationWarning,\n stacklevel=4,\n )\n self.response_field = create_model_field(\n name=response_name,\n type_=self.response_model,\n mode=\"serialization\",\n )\n", "stderr": "", "exit_code": 0} |
| 23 | edit_file | {
"filepath": "fastapi/routing.py",
"new_string": " if annotation_is_pydantic_v1(self.response_model):\n warnings.warn(\n \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\n f\" Please update the response model {self.response_model!r}.\",\n category=FastAPIDeprecationWarning,\n stacklevel=4,\n )\n",
"old_string": " if annotation_is_pydantic_v1(self.response_model):\n warnings.warn(\n \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\n f\" Please update the response model {self.response_model!r}.\",\n category=DeprecationWarning,\n stacklevel=4,\n )\n"
} | {"status": "ok", "filepath": "fastapi/routing.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/routing.py\n+++ b/fastapi/routing.py\n@@ -640,7full{"status": "ok", "filepath": "fastapi/routing.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/routing.py\n+++ b/fastapi/routing.py\n@@ -640,7 +640,7 @@\n warnings.warn(\n \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\n f\" Please update the response model {self.response_model!r}.\",\n- category=DeprecationWarning,\n+ category=FastAPIDeprecationWarning,\n stacklevel=4,\n )\n self.response_field = create_model_field(\n", "is_truncated": false} |
| 24 | run_command | {
"command": "sed -n '670,690p' fastapi/routing.py"
} | {"status": "ok", "stdout": " response_fields = {}\n for additional_status_code, response in self.responses.items():\n assert isinstance(response, dict), \"An adfull{"status": "ok", "stdout": " response_fields = {}\n for additional_status_code, response in self.responses.items():\n assert isinstance(response, dict), \"An additional response must be a dict\"\n model = response.get(\"model\")\n if model:\n assert is_body_allowed_for_status_code(additional_status_code), (\n f\"Status code {additional_status_code} must not have a response body\"\n )\n response_name = f\"Response_{additional_status_code}_{self.unique_id}\"\n if annotation_is_pydantic_v1(model):\n warnings.warn(\n \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\n f\" In responses={{}}, please update {model}.\",\n category=DeprecationWarning,\n stacklevel=4,\n )\n response_field = create_model_field(\n name=response_name, type_=model, mode=\"serialization\"\n )\n response_fields[additional_status_code] = response_field\n if response_fields:\n", "stderr": "", "exit_code": 0} |
| 25 | edit_file | {
"filepath": "fastapi/routing.py",
"new_string": " if annotation_is_pydantic_v1(model):\n warnings.warn(\n \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\n f\" In responses={{}}, please update {model}.\",\n category=FastAPIDeprecationWarning,\n stacklevel=4,\n )\n",
"old_string": " if annotation_is_pydantic_v1(model):\n warnings.warn(\n \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\n f\" In responses={{}}, please update {model}.\",\n category=DeprecationWarning,\n stacklevel=4,\n )\n"
} | {"status": "ok", "filepath": "fastapi/routing.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/routing.py\n+++ b/fastapi/routing.py\n@@ -680,7full{"status": "ok", "filepath": "fastapi/routing.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/routing.py\n+++ b/fastapi/routing.py\n@@ -680,7 +680,7 @@\n warnings.warn(\n \"pydantic.v1 is deprecated and will soon stop being supported by FastAPI.\"\n f\" In responses={{}}, please update {model}.\",\n- category=DeprecationWarning,\n+ category=FastAPIDeprecationWarning,\n stacklevel=4,\n )\n response_field = create_model_field(\n", "is_truncated": false} |
| 26 | run_command | {
"command": "grep -n \"category=DeprecationWarning\" fastapi/params.py"
} | {"status": "ok", "stdout": "78: category=DeprecationWarning,\n108: category=DeprecationWarning,\n533: category=DeprecationWarning,\n563: category=DeprecationWarfull{"status": "ok", "stdout": "78: category=DeprecationWarning,\n108: category=DeprecationWarning,\n533: category=DeprecationWarning,\n563: category=DeprecationWarning,\n", "stderr": "", "exit_code": 0} |
| 27 | run_command | {
"command": "sed -n '70,115p' fastapi/params.py"
} | {"status": "ok", "stdout": " deprecated: Union[deprecated, str, bool, None] = None,\n include_in_schema: bool = True,\n json_schema_extra: Union[dict[str, Any],full{"status": "ok", "stdout": " deprecated: Union[deprecated, str, bool, None] = None,\n include_in_schema: bool = True,\n json_schema_extra: Union[dict[str, Any], None] = None,\n **extra: Any,\n ):\n if example is not _Unset:\n warnings.warn(\n \"`example` has been deprecated, please use `examples` instead\",\n category=DeprecationWarning,\n stacklevel=4,\n )\n self.example = example\n self.include_in_schema = include_in_schema\n self.openapi_examples = openapi_examples\n kwargs = dict(\n default=default,\n default_factory=default_factory,\n alias=alias,\n title=title,\n description=description,\n gt=gt,\n ge=ge,\n lt=lt,\n le=le,\n min_length=min_length,\n max_length=max_length,\n discriminator=discriminator,\n multiple_of=multiple_of,\n allow_inf_nan=allow_inf_nan,\n max_digits=max_digits,\n decimal_places=decimal_places,\n **extra,\n )\n if examples is not None:\n kwargs[\"examples\"] = examples\n if regex is not None:\n warnings.warn(\n \"`regex` has been deprecated, please use `pattern` instead\",\n category=DeprecationWarning,\n stacklevel=4,\n )\n current_json_schema_extra = json_schema_extra or extra\n kwargs[\"deprecated\"] = deprecated\n\n if serialization_alias in (_Unset, None) and isinstance(alias, str):\n serialization_alias = alias\n", "stderr": "", "exit_code": 0} |
| 28 | edit_file | {
"allow_multiple": true,
"filepath": "fastapi/params.py",
"new_string": " if example is not _Unset:\n warnings.warn(\n \"`example` has been deprecated, please use `examples` instead\",\n category=FastAPIDeprecationWarning,\n stacklevel=4,\n )\n",
"old_string": " if example is not _Unset:\n warnings.warn(\n \"`example` has been deprecated, please use `examples` instead\",\n category=DeprecationWarning,\n stacklevel=4,\n )\n"
} | {"status": "ok", "filepath": "fastapi/params.py", "occurrences": 2, "strategy": "exact", "diff": "--- a/fastapi/params.py\n+++ b/fastapi/params.py\n@@ -75,7 +75full{"status": "ok", "filepath": "fastapi/params.py", "occurrences": 2, "strategy": "exact", "diff": "--- a/fastapi/params.py\n+++ b/fastapi/params.py\n@@ -75,7 +75,7 @@\n if example is not _Unset:\n warnings.warn(\n \"`example` has been deprecated, please use `examples` instead\",\n- category=DeprecationWarning,\n+ category=FastAPIDeprecationWarning,\n stacklevel=4,\n )\n self.example = example\n@@ -530,7 +530,7 @@\n if example is not _Unset:\n warnings.warn(\n \"`example` has been deprecated, please use `examples` instead\",\n- category=DeprecationWarning,\n+ category=FastAPIDeprecationWarning,\n stacklevel=4,\n )\n self.example = example\n", "is_truncated": false} |
| 29 | edit_file | {
"allow_multiple": true,
"filepath": "fastapi/params.py",
"new_string": " if regex is not None:\n warnings.warn(\n \"`regex` has been deprecated, please use `pattern` instead\",\n category=FastAPIDeprecationWarning,\n stacklevel=4,\n )\n",
"old_string": " if regex is not None:\n warnings.warn(\n \"`regex` has been deprecated, please use `pattern` instead\",\n category=DeprecationWarning,\n stacklevel=4,\n )\n"
} | {"status": "ok", "filepath": "fastapi/params.py", "occurrences": 2, "strategy": "exact", "diff": "--- a/fastapi/params.py\n+++ b/fastapi/params.py\n@@ -105,7 +1full{"status": "ok", "filepath": "fastapi/params.py", "occurrences": 2, "strategy": "exact", "diff": "--- a/fastapi/params.py\n+++ b/fastapi/params.py\n@@ -105,7 +105,7 @@\n if regex is not None:\n warnings.warn(\n \"`regex` has been deprecated, please use `pattern` instead\",\n- category=DeprecationWarning,\n+ category=FastAPIDeprecationWarning,\n stacklevel=4,\n )\n current_json_schema_extra = json_schema_extra or extra\n@@ -560,7 +560,7 @@\n if regex is not None:\n warnings.warn(\n \"`regex` has been deprecated, please use `pattern` instead\",\n- category=DeprecationWarning,\n+ category=FastAPIDeprecationWarning,\n stacklevel=4,\n )\n current_json_schema_extra = json_schema_extra or extra\n", "is_truncated": false} |
| 30 | run_command | {
"command": "grep -rn \"DeprecationWarning\" fastapi"
} | {"status": "ok", "stdout": "fastapi/dependencies/utils.py:330: category=FastAPIDeprecationWarning,\nfastapi/exceptions.py:10:class FastAPIDeprecationWarning(Depfull{"status": "ok", "stdout": "fastapi/dependencies/utils.py:330: category=FastAPIDeprecationWarning,\nfastapi/exceptions.py:10:class FastAPIDeprecationWarning(DeprecationWarning):\nfastapi/temp_pydantic_v1_params.py:66: category=FastAPIDeprecationWarning,\nfastapi/temp_pydantic_v1_params.py:96: category=FastAPIDeprecationWarning,\nfastapi/temp_pydantic_v1_params.py:506: category=FastAPIDeprecationWarning,\nfastapi/temp_pydantic_v1_params.py:536: category=FastAPIDeprecationWarning,\nfastapi/routing.py:643: category=FastAPIDeprecationWarning,\nfastapi/routing.py:683: category=FastAPIDeprecationWarning,\nfastapi/utils.py:200: DeprecationWarning,\nfastapi/params.py:78: category=FastAPIDeprecationWarning,\nfastapi/params.py:108: category=FastAPIDeprecationWarning,\nfastapi/params.py:533: category=FastAPIDeprecationWarning,\nfastapi/params.py:563: category=FastAPIDeprecationWarning,\nfastapi/openapi/utils.py:220: DeprecationWarning,\n", "stderr": "", "exit_code": 0} |
| 31 | read_file | {
"end_line": "210",
"filepath": "fastapi/utils.py",
"start_line": "``"
} | {"status": "error", "error_type": "FileReadError", "error_message": "'>' not supported between instances of 'int' and 'str'"}full{"status": "error", "error_type": "FileReadError", "error_message": "'>' not supported between instances of 'int' and 'str'"} |
| 32 | run_command | {
"command": "sed -n '190,210p' fastapi/utils.py"
} | {"status": "ok", "stdout": " new_field.populate_validators() # type: ignore[attr-defined]\n return new_field\n\n\ndef generate_operation_id_for_path(\n *, name:full{"status": "ok", "stdout": " new_field.populate_validators() # type: ignore[attr-defined]\n return new_field\n\n\ndef generate_operation_id_for_path(\n *, name: str, path: str, method: str\n) -> str: # pragma: nocover\n warnings.warn(\n \"fastapi.utils.generate_operation_id_for_path() was deprecated, \"\n \"it is not used internally, and will be removed soon\",\n DeprecationWarning,\n stacklevel=2,\n )\n operation_id = f\"{name}{path}\"\n operation_id = re.sub(r\"\\W\", \"_\", operation_id)\n operation_id = f\"{operation_id}_{method.lower()}\"\n return operation_id\n\n\ndef generate_unique_id(route: \"APIRoute\") -> str:\n operation_id = f\"{route.name}{route.path_format}\"\n", "stderr": "", "exit_code": 0} |
| 33 | edit_file | {
"filepath": "fastapi/utils.py",
"new_string": " warnings.warn(\n \"fastapi.utils.generate_operation_id_for_path() was deprecated, \"\n \"it is not used internally, and will be removed soon\",\n FastAPIDeprecationWarning,\n stacklevel=2,\n )\n",
"old_string": " warnings.warn(\n \"fastapi.utils.generate_operation_id_for_path() was deprecated, \"\n \"it is not used internally, and will be removed soon\",\n DeprecationWarning,\n stacklevel=2,\n )\n"
} | {"status": "ok", "filepath": "fastapi/utils.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/utils.py\n+++ b/fastapi/utils.py\n@@ -197,7 +197,full{"status": "ok", "filepath": "fastapi/utils.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/utils.py\n+++ b/fastapi/utils.py\n@@ -197,7 +197,7 @@\n warnings.warn(\n \"fastapi.utils.generate_operation_id_for_path() was deprecated, \"\n \"it is not used internally, and will be removed soon\",\n- DeprecationWarning,\n+ FastAPIDeprecationWarning,\n stacklevel=2,\n )\n operation_id = f\"{name}{path}\"\n", "is_truncated": false} |
| 34 | run_command | {
"command": "sed -n '210,230p' fastapi/openapi/utils.py"
} | {"status": "ok", "stdout": " request_body_oai[\"content\"] = {request_media_type: request_media_content}\n return request_body_oai\n\n\ndef generate_operation_ifull{"status": "ok", "stdout": " request_body_oai[\"content\"] = {request_media_type: request_media_content}\n return request_body_oai\n\n\ndef generate_operation_id(\n *, route: routing.APIRoute, method: str\n) -> str: # pragma: nocover\n warnings.warn(\n \"fastapi.openapi.utils.generate_operation_id() was deprecated, \"\n \"it is not used internally, and will be removed soon\",\n DeprecationWarning,\n stacklevel=2,\n )\n if route.operation_id:\n return route.operation_id\n path: str = route.path_format\n return generate_operation_id_for_path(name=route.name, path=path, method=method)\n\n\ndef generate_operation_summary(*, route: routing.APIRoute, method: str) -> str:\n if route.summary:\n", "stderr": "", "exit_code": 0} |
| 35 | edit_file | {
"filepath": "fastapi/openapi/utils.py",
"new_string": " warnings.warn(\n \"fastapi.openapi.utils.generate_operation_id() was deprecated, \"\n \"it is not used internally, and will be removed soon\",\n FastAPIDeprecationWarning,\n stacklevel=2,\n )\n",
"old_string": " warnings.warn(\n \"fastapi.openapi.utils.generate_operation_id() was deprecated, \"\n \"it is not used internally, and will be removed soon\",\n DeprecationWarning,\n stacklevel=2,\n )\n"
} | {"status": "ok", "filepath": "fastapi/openapi/utils.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/openapi/utils.py\n+++ b/fastapi/openapi/ufull{"status": "ok", "filepath": "fastapi/openapi/utils.py", "occurrences": 1, "strategy": "exact", "diff": "--- a/fastapi/openapi/utils.py\n+++ b/fastapi/openapi/utils.py\n@@ -217,7 +217,7 @@\n warnings.warn(\n \"fastapi.openapi.utils.generate_operation_id() was deprecated, \"\n \"it is not used internally, and will be removed soon\",\n- DeprecationWarning,\n+ FastAPIDeprecationWarning,\n stacklevel=2,\n )\n if route.operation_id:\n", "is_truncated": false} |
diff --git a/fastapi/dependencies/utils.py b/fastapi/dependencies/utils.py
index 39d0bd89..d8667c25 100644
--- a/fastapi/dependencies/utils.py
+++ b/fastapi/dependencies/utils.py
@@ -327,7 +327,7 @@ def get_dependant(
warnings.warn(
"pydantic.v1 is deprecated and will soon stop being supported by FastAPI."
f" Please update the param {param_name}: {param_details.type_annotation!r}.",
- category=DeprecationWarning,
+ category=FastAPIDeprecationWarning,
stacklevel=5,
)
if isinstance(
diff --git a/fastapi/exceptions.py b/fastapi/exceptions.py
index 8e0c5590..8ec0f4ba 100644
--- a/fastapi/exceptions.py
+++ b/fastapi/exceptions.py
@@ -7,6 +7,12 @@ from starlette.exceptions import HTTPException as StarletteHTTPException
from starlette.exceptions import WebSocketException as StarletteWebSocketException
+class FastAPIDeprecationWarning(DeprecationWarning):
+ \"\"\"
+ Warning raised when a feature in FastAPI is deprecated.
+ \"\"\"
+
+
class EndpointContext(TypedDict, total=False):
function: str
path: str
diff --git a/fastapi/openapi/utils.py b/fastapi/openapi/utils.py
index a99d4188..813b5d7f 100644
--- a/fastapi/openapi/utils.py
+++ b/fastapi/openapi/utils.py
@@ -217,7 +217,7 @@ def generate_operation_id(
warnings.warn(
"fastapi.openapi.utils.generate_operation_id() was deprecated, "
"it is not used internally, and will be removed soon",
- DeprecationWarning,
+ FastAPIDeprecationWarning,
stacklevel=2,
)
if route.operation_id:
diff --git a/fastapi/params.py b/fastapi/params.py
index c776c4a5..a0f2c2cb 100644
--- a/fastapi/params.py
+++ b/fastapi/params.py
@@ -75,7 +75,7 @@ class Param(FieldInfo): # type: ignore[misc]
if example is not _Unset:
warnings.warn(
"`example` has been deprecated, please use `examples` instead",
- category=DeprecationWarning,
+ category=FastAPIDeprecationWarning,
stacklevel=4,
)
self.example = example
@@ -105,7 +105,7 @@ class Param(FieldInfo): # type: ignore[misc]
if regex is not None:
warnings.warn(
"`regex` has been deprecated, please use `pattern` instead",
- category=DeprecationWarning,
+ category=FastAPIDeprecationWarning,
stacklevel=4,
)
current_json_schema_extra = json_schema_extra or extra
@@ -530,7 +530,7 @@ class Body(FieldInfo): # type: ignore[misc]
if example is not _Unset:
warnings.warn(
"`example` has been deprecated, please use `examples` instead",
- category=DeprecationWarning,
+ category=FastAPIDeprecationWarning,
stacklevel=4,
)
self.example = example
@@ -560,7 +560,7 @@ class Body(FieldInfo): # type: ignore[misc]
if regex is not None:
warnings.warn(
"`regex` has been deprecated, please use `pattern` instead",
- category=DeprecationWarning,
+ category=FastAPIDeprecationWarning,
stacklevel=4,
)
current_json_schema_extra = json_schema_extra or extra
diff --git a/fastapi/routing.py b/fastapi/routing.py
index 2770e325..64bc3d09 100644
--- a/fastapi/routing.py
+++ b/fastapi/routing.py
@@ -640,7 +640,7 @@ class APIRoute(routing.Route):
warnings.warn(
"pydantic.v1 is deprecated and will soon stop being supported by FastAPI."
f" Please update the response model {self.response_model!r}.",
- category=DeprecationWarning,
+ category=FastAPIDeprecationWarning,
stacklevel=4,
)
self.response_field = create_model_field(
@@ -680,7 +680,7 @@ class APIRoute(routing.Route):
warnings.warn(
"pydantic.v1 is deprecated and will soon stop being supported by FastAPI."
f" In responses={{}}, please update {model}.",
- category=DeprecationWarning,
+ category=FastAPIDeprecationWarning,
stacklevel=4,
)
response_field = create_model_field(
diff --git a/fastapi/temp_pydantic_v1_params.py b/fastapi/temp_pydantic_v1_params.py
index 1bda0ea9..1a5c3c40 100644
--- a/fastapi/temp_pydantic_v1_params.py
+++ b/fastapi/temp_pydantic_v1_params.py
@@ -63,7 +63,7 @@ class Param(FieldInfo):
if example is not _Unset:
warnings.warn(
"`example` has been deprecated, please use `examples` instead",
- category=DeprecationWarning,
+ category=FastAPIDeprecationWarning,
stacklevel=4,
)
self.example = example
@@ -93,7 +93,7 @@ class Param(FieldInfo):
if regex is not None:
warnings.warn(
"`regex` has been deprecated, please use `pattern` instead",
- category=DeprecationWarning,
+ category=FastAPIDeprecationWarning,
stacklevel=4,
)
current_json_schema_extra = json_schema_extra or extra
@@ -503,7 +503,7 @@ class Body(FieldInfo):
if example is not _Unset:
warnings.warn(
"`example` has been deprecated, please use `examples` instead",
- category=DeprecationWarning,
+ category=FastAPIDeprecationWarning,
stacklevel=4,
)
self.example = example
@@ -533,7 +533,7 @@ class Body(FieldInfo):
if regex is not None:
warnings.warn(
"`regex` has been deprecated, please use `pattern` instead",
- category=DeprecationWarning,
+ category=FastAPIDeprecationWarning,
stacklevel=4,
)
current_json_schema_extra = json_schema_extra or extra
diff --git a/fastapi/utils.py b/fastapi/utils.py
index c4631d7e..efd72f8b 100644
--- a/fastapi/utils.py
+++ b/fastapi/utils.py
@@ -197,7 +197,7 @@ def generate_operation_id_for_path(
warnings.warn(
"fastapi.utils.generate_operation_id_for_path() was deprecated, "
"it is not used internally, and will be removed soon",
- DeprecationWarning,
+ FastAPIDeprecationWarning,
stacklevel=2,
)
operation_id = f"{name}{path}"
==================================== ERRORS ====================================
________ ERROR collecting tests/benchmarks/test_general_performance.py _________
/kaggle/tmp/envs/fastapi/lib/python3.13/site-packages/_pytest/python.py:508: in importtestmodule
mod = import_path(
/kaggle/tmp/envs/fastapi/lib/python3.13/site-packages/_pytest/pathlib.py:596: in import_path
importlib.import_module(module_name)
/root/.local/share/uv/python/cpython-3.13.14-linux-x86_64-gnu/lib/python3.13/importlib/__init__.py:88: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
<frozen importlib._bootstrap>:1395: in _gcd_import
???
<frozen importlib._bootstrap>:1360: in _find_and_load
???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:935: in _load_unlocked
???
/kaggle/tmp/envs/fastapi/lib/python3.13/site-packages/_pytest/assertion/rewrite.py:188: in exec_module
exec(co, module.__dict__)
tests/benchmarks/test_general_performance.py:8: in <module>
from fastapi import Depends, FastAPI
fastapi/__init__.py:7: in <module>
from .applications import FastAPI as FastAPI
fastapi/applications.py:13: in <module>
from fastapi import routing
fastapi/routing.py:37: in <module>
from fastapi.dependencies.models import Dependant
fastapi/dependencies/models.py:8: in <module>
from fastapi.security.base import SecurityBase
fastapi/security/__init__.py:4: in <module>
from .http import HTTPAuthorizationCredentials as HTTPAuthorizationCredentials
fastapi/security/http.py:6: in <module>
from fastapi.exceptions import HTTPException
E File "/tmp/swe_work/eval6_submission_v1r/fastapi_14605/b/workspace/fastapi/exceptions.py", line 11
E \"\"\"
E ^
E SyntaxError: unexpected character after line continuation character
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 error in 0.67s