This is an automated email from the ASF dual-hosted git repository.
bugraoz 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 6a21460f0cf Clean up stale Python 3.9 workaround in airflow-ctl CLI
config parser (#62206)
6a21460f0cf is described below
commit 6a21460f0cf72f2411eece28e34d81d4e55c517b
Author: Haseeb Malik <[email protected]>
AuthorDate: Thu Feb 26 15:36:36 2026 -0500
Clean up stale Python 3.9 workaround in airflow-ctl CLI config parser
(#62206)
---
airflow-ctl/src/airflowctl/ctl/cli_config.py | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/airflow-ctl/src/airflowctl/ctl/cli_config.py
b/airflow-ctl/src/airflowctl/ctl/cli_config.py
index fcc0762b9f6..ff5fe3ab772 100755
--- a/airflow-ctl/src/airflowctl/ctl/cli_config.py
+++ b/airflow-ctl/src/airflowctl/ctl/cli_config.py
@@ -408,6 +408,12 @@ class CommandFactory:
def _inspect_operations(self) -> None:
"""Parse file and return matching Operation Method with details."""
+ def _union_members(node: ast.expr) -> list[str]:
+ """Get individual type names from a union type annotation."""
+ if isinstance(node, ast.BinOp) and isinstance(node.op, ast.BitOr):
+ return _union_members(node.left) + _union_members(node.right)
+ return [ast.unparse(node)]
+
def get_function_details(node: ast.FunctionDef, parent_node:
ast.ClassDef) -> dict:
"""Extract function name, arguments, and return annotation."""
func_name = node.name
@@ -422,10 +428,7 @@ class CommandFactory:
if node.returns:
return_annotation = [
- t.strip()
- # TODO change this while removing Python 3.9 support
- for t in ast.unparse(node.returns).split("|")
- if t.strip() != ServerResponseError.__name__
+ t for t in _union_members(node.returns) if t !=
ServerResponseError.__name__
].pop()
return {