amoghrajesh commented on code in PR #53004:
URL: https://github.com/apache/airflow/pull/53004#discussion_r2196750736


##########
airflow-core/src/airflow/models/baseoperator.py:
##########
@@ -296,7 +296,7 @@ def __init__(self, **kwargs):
         def dag(self) -> SchedulerDAG:  # type: ignore[override]
             return super().dag  # type: ignore[return-value]
 
-        @dag.setter
+        @dag.setter  # type: ignore[override]

Review Comment:
   We could create a protocol for this, but this should be ok for time being as 
we will eventually separate it out



##########
airflow-core/src/airflow/serialization/serde.py:
##########
@@ -284,7 +284,12 @@ def deserialize(o: T | None, full=True, type_hint: Any = 
None) -> object:
                 class_version,
             )
 
-        return cls(**deserialize(value))
+        deserialize_value = deserialize(value)
+        if not isinstance(deserialize_value, dict):
+            raise TypeError(
+                f"deserialized value for {classname} is not a dict, got 
{type(deserialize_value)}"
+            )
+        return cls(**deserialize_value)  # type: ignore[operator]

Review Comment:
   You need to let mypy know that its a class and not an object somehow, so 
maybe try this:
   
   ```
   cls: Type[Any] = import_string(classname)
   ```
   
   here: 
https://github.com/apache/airflow/pull/53004/files#diff-5d7a43b9860e3c6d80d8feadce5ae76a3a56698fd8dff389fb6095c01153e74eR263



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