[flake8-type-checking] Improve flexibility of runtime-evaluated-decorators (#15204)

Co-authored-by: Micha Reiser <micha@reiser.io>
This commit is contained in:
David Salvisberg
2024-12-31 17:28:10 +01:00
committed by GitHub
parent 7ca3f9515c
commit 1ef0f615f1
12 changed files with 192 additions and 10 deletions

2
ruff.schema.json generated
View File

@@ -1387,7 +1387,7 @@
}
},
"runtime-evaluated-decorators": {
"description": "Exempt classes and functions decorated with any of the enumerated decorators from being moved into type-checking blocks.\n\nCommon examples include Pydantic's `@pydantic.validate_call` decorator (for functions) and attrs' `@attrs.define` decorator (for classes).",
"description": "Exempt classes and functions decorated with any of the enumerated decorators from being moved into type-checking blocks.\n\nCommon examples include Pydantic's `@pydantic.validate_call` decorator (for functions) and attrs' `@attrs.define` decorator (for classes).\n\nThis also supports framework decorators like FastAPI's `fastapi.FastAPI.get` which will work across assignments in the same module.\n\nFor example: ```python import fastapi\n\napp = FastAPI(\"app\")\n\n@app.get(\"/home\") def home() -> str: ... ```\n\nHere `app.get` will correctly be identified as `fastapi.FastAPI.get`.",
"type": [
"array",
"null"