103103
104104if TYPE_CHECKING :
105105 from datetime import datetime
106- from typing import Literal , TypeAlias
106+ from typing import Literal
107107
108108 import pendulum
109109 from sqlalchemy .engine import Connection as SAConnection , Engine
114114 from airflow .api_fastapi .execution_api .datamodels .asset import AssetProfile
115115 from airflow .models .dag import DagModel
116116 from airflow .models .dagrun import DagRun
117- from airflow .models .mappedoperator import MappedOperator
118- from airflow .serialization .definitions .baseoperator import SerializedBaseOperator
119117 from airflow .serialization .definitions .dag import SerializedDAG
118+ from airflow .serialization .definitions .mappedoperator import Operator
120119 from airflow .serialization .definitions .taskgroup import SerializedTaskGroup
121120 from airflow .utils .context import Context
122121
123- Operator : TypeAlias = MappedOperator | SerializedBaseOperator
124-
125122
126123PAST_DEPENDS_MET = "past_depends_met"
127124
@@ -1660,7 +1657,6 @@ def get_template_context(
16601657 session = settings .get_session ()()
16611658
16621659 from airflow .exceptions import NotMapped
1663- from airflow .models .mappedoperator import get_mapped_ti_count
16641660 from airflow .sdk .api .datamodels ._generated import (
16651661 DagRun as DagRunSDK ,
16661662 PrevSuccessfulDagRunResponse ,
@@ -1669,6 +1665,7 @@ def get_template_context(
16691665 from airflow .sdk .definitions .param import process_params
16701666 from airflow .sdk .execution_time .context import InletEventsAccessors
16711667 from airflow .sdk .execution_time .task_runner import RuntimeTaskInstance
1668+ from airflow .serialization .definitions .mappedoperator import get_mapped_ti_count
16721669 from airflow .utils .context import (
16731670 ConnectionAccessor ,
16741671 OutletEventAccessors ,
@@ -2193,7 +2190,7 @@ def _find_common_ancestor_mapped_group(node1: Operator, node2: Operator) -> Seri
21932190
21942191def _is_further_mapped_inside (operator : Operator , container : SerializedTaskGroup ) -> bool :
21952192 """Whether given operator is *further* mapped inside a task group."""
2196- from airflow .models .mappedoperator import is_mapped
2193+ from airflow .serialization . definitions .mappedoperator import is_mapped
21972194
21982195 if is_mapped (operator ):
21992196 return True
@@ -2260,7 +2257,7 @@ def tg2(inp):
22602257 :return: Specific map index or map indexes to pull, or ``None`` if we
22612258 want to "whole" return value (i.e. no mapped task groups involved).
22622259 """
2263- from airflow .models .mappedoperator import get_mapped_ti_count
2260+ from airflow .serialization . definitions .mappedoperator import get_mapped_ti_count
22642261
22652262 # This value should never be None since we already know the current task
22662263 # is in a mapped task group, and should have been expanded, despite that,
@@ -2307,7 +2304,7 @@ def find_relevant_relatives(
23072304 run_id : str ,
23082305 session : Session ,
23092306) -> Collection [str | tuple [str , int ]]:
2310- from airflow .models .mappedoperator import get_mapped_ti_count
2307+ from airflow .serialization . definitions .mappedoperator import get_mapped_ti_count
23112308
23122309 visited : set [str | tuple [str , int ]] = set ()
23132310
0 commit comments