potiuk commented on a change in pull request #6601: [AIRFLOW-6010] Remove 
cyclic imports and pylint disables
URL: https://github.com/apache/airflow/pull/6601#discussion_r350401480
 
 

 ##########
 File path: airflow/serialization/base_serialization.py
 ##########
 @@ -123,6 +122,27 @@ def _is_excluded(cls, var, attrname, instance):
             cls._value_is_hardcoded_default(attrname, var)
         )
 
+    @classmethod
+    def serialize_to_json(cls, object_to_serialize: Union[BaseOperator, DAG], 
decorated_fields: Set):
+        """Serializes an object to json"""
+        serialized_object = {}
+        keys_to_serialize = object_to_serialize.get_serialized_fields()
+        for key in keys_to_serialize:
+            # None is ignored in serialized form and is added back in 
deserialization.
+            value = getattr(object_to_serialize, key, None)
+            if cls._is_excluded(value, key, object_to_serialize):
+                continue
+
+            if key in decorated_fields:
+                serialized_object[key] = cls._serialize(value)
+            else:
+                value = cls._serialize(value)
+                # TODO: Why?
 
 Review comment:
   Yeah.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to