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


##########
airflow-core/src/airflow/serialization/definitions/notset.py:
##########
@@ -18,7 +18,26 @@
 
 from __future__ import annotations
 
-from airflow.sdk.definitions._internal.types import NOTSET, ArgNotSet
+from typing import TYPE_CHECKING, TypeVar
 
-# TODO (GH-52141): Have different NOTSET and ArgNotSet in the scheduler.
-__all__ = ["NOTSET", "ArgNotSet"]
+if TYPE_CHECKING:
+    from typing_extensions import TypeIs
+
+    T = TypeVar("T")
+
+__all__ = ["NOTSET", "ArgNotSet", "is_set"]
+
+
+try:
+    # If core and SDK exist together, use the SDK to avoid identity issues.
+    from airflow.sdk.definitions._internal.types import NOTSET, ArgNotSet
+except ModuleNotFoundError:
+
+    class ArgNotSet:  # type: ignore[no-redef]
+        """Sentinel type for annotations, useful when None is not viable."""
+
+    NOTSET = ArgNotSet()
+
+
+def is_set(value: T | ArgNotSet) -> TypeIs[T]:

Review Comment:
   nit: `is_arg_set`?



##########
task-sdk/src/airflow/sdk/definitions/_internal/types.py:
##########
@@ -36,19 +43,15 @@ def is_arg_passed(arg: Union[ArgNotSet, None] = NOTSET) -> 
bool:
         is_arg_passed(None)  # True.
     """
 
-    @staticmethod
-    def serialize():
-        return "NOTSET"
-
-    @classmethod
-    def deserialize(cls):
-        return cls
-
 
 NOTSET = ArgNotSet()
 """Sentinel value for argument default. See ``ArgNotSet``."""
 
 
+def is_set(value: T | ArgNotSet) -> TypeIs[T]:

Review Comment:
   Same as above



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