bolkedebruin commented on code in PR #31565:
URL: https://github.com/apache/airflow/pull/31565#discussion_r1206432937


##########
airflow/serialization/serde.py:
##########
@@ -302,6 +308,11 @@ def _stringify(classname: str, version: int, value: T | 
None) -> str:
     return s
 
 
+def _is_pydantic(cls: Any) -> bool:
+    """Return True if the class is a pydantic model."""
+    return hasattr(cls, "validate") and hasattr(cls, "json") and hasattr(cls, 
"dict")

Review Comment:
   isinstance is slower than checking for attributes, it will need to walk the 
tree of objects to find out whether it is an instance. It is one of the reasons 
the new serde code is faster than the old serialization code.



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