ashb commented on a change in pull request #8772:
URL: https://github.com/apache/airflow/pull/8772#discussion_r421826962
##########
File path: airflow/serialization/serialized_objects.py
##########
@@ -395,6 +411,59 @@ def deserialize_operator(cls, encoded_op: Dict[str, Any])
-> BaseOperator:
return op
+ @classmethod
+ def _is_constcutor_param(cls, attrname: str, instance: Any) -> bool:
+ # Check all super classes too
+ return any(
+ attrname in cls.__constructor_params_for_subclass(typ)
+ for typ in type(instance).mro()
+ )
+
+ @classmethod
+ def _value_is_hardcoded_default(cls, attrname: str, value: Any, instance:
Any) -> bool:
+ """
+ Check if ``value`` is the default value for ``attrname`` as set by the
+ constructor of ``instance``, or any of it's parent classes up
+ to-and-including BaseOperator.
+
+ .. seealso::
+
+ :py:meth:`BaseSerialization._value_is_hardcoded_default`
+ """
+
+ def _is_default():
+ nonlocal ctor_params, attrname, value
Review comment:
I went through a number of iterations of way of doing this, it may be
clearer just to pass them in anyway on Py3. WDYT?
----------------------------------------------------------------
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]