uranusjr commented on code in PR #57700:
URL: https://github.com/apache/airflow/pull/57700#discussion_r2496848512
##########
airflow-core/src/airflow/serialization/serialized_objects.py:
##########
@@ -2565,40 +2572,43 @@ def _deserialize_dag_internal(
# Note: Context is passed explicitly through method parameters, no
class attributes needed
- for k, v in encoded_dag.items():
- if k == "_downstream_task_ids":
- v = set(v)
- elif k == "tasks":
+ for k_in, v_in in encoded_dag.items():
+ v: Any
+ k = k_in
+ if k_in == "_downstream_task_ids":
+ v = set(v_in)
+ elif k_in == "tasks":
SerializedBaseOperator._load_operator_extra_links =
cls._load_operator_extra_links
tasks = {}
- for obj in v:
+ for obj in v_in:
if obj.get(Encoding.TYPE) == DAT.OP:
deser = SerializedBaseOperator.deserialize_operator(
obj[Encoding.VAR], client_defaults
)
tasks[deser.task_id] = deser
k = "task_dict"
v = tasks
- elif k == "timezone":
- v = cls._deserialize_timezone(v)
- elif k == "dagrun_timeout":
- v = cls._deserialize_timedelta(v)
- elif k.endswith("_date"):
- v = cls._deserialize_datetime(v)
- elif k == "edge_info":
+ elif k_in == "timezone":
+ v = cls._deserialize_timezone(v_in)
+ elif k_in == "dagrun_timeout":
+ v = cls._deserialize_timedelta(v_in)
+ elif k_in.endswith("_date"):
+ v = cls._deserialize_datetime(v_in)
+ elif k_in == "edge_info":
# Value structure matches exactly
- pass
- elif k == "timetable":
- v = decode_timetable(v)
- elif k == "weight_rule":
- v = decode_priority_weight_strategy(v)
- elif k in cls._decorated_fields:
- v = cls.deserialize(v)
- elif k == "params":
- v = cls._deserialize_params_dict(v)
- elif k == "tags":
- v = set(v)
- # else use v as it is
+ v = v_in
+ elif k_in == "timetable":
+ v = decode_timetable(v_in)
+ elif k_in == "weight_rule":
+ v = decode_priority_weight_strategy(v_in)
+ elif k_in in cls._decorated_fields:
+ v = cls.deserialize(v_in)
+ elif k_in == "params":
+ v = cls._deserialize_params_dict(v_in)
+ elif k_in == "tags":
+ v = set(v_in)
+ else:
+ v = v_in
Review Comment:
It’s -0 so I’d not block this, but personally I’m not into this loop
variable reuse rule in general.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]