From ec263874664e21ad5dbdc787dbfefce6ff0413c3 Mon Sep 17 00:00:00 2001 From: Sean Ghaeli Date: Mon, 22 Jun 2026 19:46:25 +0000 Subject: [PATCH] Fix MyPy providers checks for AWS auth manager after anyio 4.14 bump The CI environment upgrade in #68560 bumped anyio 4.13.0 -> 4.14.0, whose stricter `from_thread.run` stub no longer accepts `request.form` (a method typed `(*, max_files, ...) -> AwaitableOrContextManager[FormData]`) where it expects `Callable[[], Coroutine[Any, Any, Never]]`. This made the unchanged (2025-era) lines in the AWS auth manager `login.py` newly fail mypy with `[arg-type]` and `[var-annotated]` errors, turning `MyPy providers checks` red on main and on every PR that runs it. Wrap the call in a zero-arg lambda and annotate the result as `FormData` so the call site matches the new signature. No runtime behavior change. Generated-by: Claude Code (Opus 4.8) following the guidelines --- .../providers/amazon/aws/auth_manager/routes/login.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/providers/amazon/src/airflow/providers/amazon/aws/auth_manager/routes/login.py b/providers/amazon/src/airflow/providers/amazon/aws/auth_manager/routes/login.py index 3012301b1bbb6..d6c70d122f961 100644 --- a/providers/amazon/src/airflow/providers/amazon/aws/auth_manager/routes/login.py +++ b/providers/amazon/src/airflow/providers/amazon/aws/auth_manager/routes/login.py @@ -23,6 +23,7 @@ import anyio from fastapi import HTTPException, Request, status +from fastapi.datastructures import FormData from fastapi.responses import RedirectResponse from airflow.api_fastapi.app import ( @@ -101,7 +102,7 @@ def login_callback(request: Request): url = conf.get("api", "base_url", fallback="/") token = get_auth_manager().generate_jwt(user) - form_data = anyio.from_thread.run(request.form) + form_data: FormData = anyio.from_thread.run(lambda: request.form()) relay_state = form_data["RelayState"] if relay_state == "login-redirect": @@ -151,7 +152,7 @@ def _prepare_request(request: Request) -> dict: "get_data": request.query_params, "post_data": {}, } - form_data = anyio.from_thread.run(request.form) + form_data: FormData = anyio.from_thread.run(lambda: request.form()) if "SAMLResponse" in form_data: data["post_data"]["SAMLResponse"] = form_data["SAMLResponse"] if "RelayState" in form_data: