failed NO_PATCH NO_PATCH UNSUBMITTED empty_patch(budget) · 4 tool calls · 309 s · fastapi/fastapi
♻️ Make the result of `Depends()` and `Security()` hashable, as a workaround for other tools interacting with these internal parts ♻️ Make the result of `Depends()` and `Security()` hashable, as a workaround for other tools interacting with these internal parts --- This comes from https://github.com/fastapi/fastapi/pull/14320 As a note, FastAPI doesn't really have official support for extending its internals in ways that are not documented in the docs. So this is not a long-term commitment to keep some specific behavior, but a quick workaround to make things easier for current tools that interact with FastAPI internals in some way. --- At some point in the future, I'll refactor the internals of FastAPI to make them more explicitly private, and then also figure out the right ways to expose any points of connection with external components that currently need to interact with the internals in some way, and formalize that better. --- Before that, I need to handle a few issues, bugs, features, refactors, deprecations, etc. And then I'll be able to come back to this idea of figuring out how and what to expose. :nerd_face:
| # | Tool | Arguments | Result |
|---|---|---|---|
| 1 | run_command | {
"command": "grep -rn \"class Depends\" fastapi | head -20"
} | {"status": "ok", "stdout": "fastapi/params.py:766:class Depends:\n", "exit_code": 0}full{"status": "ok", "stdout": "fastapi/params.py:766:class Depends:\n", "exit_code": 0} |
| 2 | run_command | {
"command": "grep -rn \"class Security\" fastapi | head -20"
} | {"status": "ok", "stdout": "fastapi/dependencies/models.py:19:class SecurityRequirement:\nfastapi/security/oauth2.py:614:class SecurityScopes:\nfastapi/securityfull{"status": "ok", "stdout": "fastapi/dependencies/models.py:19:class SecurityRequirement:\nfastapi/security/oauth2.py:614:class SecurityScopes:\nfastapi/security/base.py:4:class SecurityBase:\nfastapi/params.py:773:class Security(Depends):\nfastapi/openapi/models.py:337:class SecuritySchemeType(Enum):\nfastapi/openapi/models.py:344:class SecurityBase(BaseModelWithConfig):\n", "exit_code": 0} |
| 3 | read_file | {
"filepath": "fastapi/params.py",
"start_line": 760,
"end_line": 790
} | {"status": "ok", "filepath": "fastapi/params.py", "content": " json_schema_extra=json_schema_extra,\n **extra,\n )\n\n\n@dataclass\nclass Depends:\n dependency:full{"status": "ok", "filepath": "fastapi/params.py", "content": " json_schema_extra=json_schema_extra,\n **extra,\n )\n\n\n@dataclass\nclass Depends:\n dependency: Optional[Callable[..., Any]] = None\n use_cache: bool = True\n scope: Union[Literal[\"function\", \"request\"], None] = None\n\n\n@dataclass\nclass Security(Depends):\n scopes: Optional[Sequence[str]] = None\n", "start_line": 760, "end_line": 774, "total_lines": 774, "is_truncated": false} |
| 4 | run_command | {
"command": "python3 -c \"from fastapi.params import Depends, Security; d1 = Depends(lambda: 1); d2 = Depends(lambda: 1); print(f'Depends hashable: {hash(d1) == hash(d1)}'); print(f'Depends equality: {d1 == d2}'); s1 = Security(lambda: 1, scopes=['a']); s2 = Security(lambda: 1, scopes=['a']); print(f'Security hashable: {hash(s1) == hash(s1)}'); print(f'Security equality: {s1 == s2}')\""
} | {"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 1", "details": {"stdout": "", "stderr": "Traceback (most recenfull{"status": "error", "error_type": "CommandError", "error_message": "Command failed with exit code 1", "details": {"stdout": "", "stderr": "Traceback (most recent call last):\n File \"<string>\", line 1, in <module>\n from fastapi.params import Depends, Security; d1 = Depends(lambda: 1); d2 = Depends(lambda: 1); print(f'Depends hashable: {hash(d1) == hash(d1)}'); print(f'Depends equality: {d1 == d2}'); s1 = Security(lambda: 1, scopes=['a']); s2 = Security(lambda: 1, scopes=['a']); print(f'Security hashable: {hash(s1) == hash(s1)}'); print(f'Security equality: {s1 == s2}')\n ~~~~^^^^\nTypeError: unhashable type: 'Depends'\n", "exit_code": 1}} |