uranusjr commented on code in PR #58581:
URL: https://github.com/apache/airflow/pull/58581#discussion_r2558086250


##########
airflow-core/src/airflow/models/serialized_dag.py:
##########
@@ -648,11 +654,12 @@ def load_json(deps_data):
             .join(cls.dag_model)
             .where(~DagModel.is_stale)
         )
-        iterator = (
-            [(dag_id, load_json(deps_data)) for dag_id, deps_data in query]
-            if load_json is not None
-            else query.all()
-        )
+        if load_json is not None:
+            iterator: Sequence[tuple[str, dict]] = [
+                (str(dag_id), load_json(deps_data)) for dag_id, deps_data in 
query
+            ]
+        else:
+            iterator = [(str(dag_id), cast("dict[Any, Any]", deps_data)) for 
dag_id, deps_data in query]

Review Comment:
   It would be a lot easier if `load_json` is changed to `Callable` (no None) 
and set to `lambda x: x` where it’s currently set to None. This would then just 
be
   
   ```python
   iterator = [(str(dag_id), load_json(deps_data)) for dag_id, deps_data in 
query]
   ```
   
   Also let’s rename `iterator` to `dag_dependencies` since the value is not 
actually an iterator.



-- 
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]

Reply via email to