This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 61d99c0374e Fix mypy error in common.ai decision helper with
pydantic-ai 2.46 (#73652)
61d99c0374e is described below
commit 61d99c0374e77cefdc8f4bad495cb5d6c0bfc43b
Author: Andrew Chang <[email protected]>
AuthorDate: Thu Sep 24 18:04:47 2026 +0800
Fix mypy error in common.ai decision helper with pydantic-ai 2.46 (#73652)
pydantic-ai-slim 2.46.0 exports Choice and Choices, so mypy now infers
the aliased import names as those types and rejects the None fallback
assigned to them when the import fails. The CI environment upgrade to
2.46.0 fails the providers mypy check on this line.
---
.../common/ai/src/airflow/providers/common/ai/utils/decision.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git
a/providers/common/ai/src/airflow/providers/common/ai/utils/decision.py
b/providers/common/ai/src/airflow/providers/common/ai/utils/decision.py
index aaf1bc504a0..6d7a94d49a3 100644
--- a/providers/common/ai/src/airflow/providers/common/ai/utils/decision.py
+++ b/providers/common/ai/src/airflow/providers/common/ai/utils/decision.py
@@ -99,8 +99,9 @@ def _choice_types() -> tuple[Any, Any]:
Choices as loaded_choices,
)
except ImportError: # pydantic-ai < 2.46.0: build the same schema
from an Enum instead
- loaded_choice = loaded_choices = None
- Choice, Choices = loaded_choice, loaded_choices
+ Choice = Choices = None
+ else:
+ Choice, Choices = loaded_choice, loaded_choices
return Choice, Choices