dstandish commented on code in PR #37016:
URL: https://github.com/apache/airflow/pull/37016#discussion_r1498013678


##########
airflow/models/dataset.py:
##########
@@ -336,3 +337,49 @@ def __repr__(self) -> str:
         ]:
             args.append(f"{attr}={getattr(self, attr)!r}")
         return f"{self.__class__.__name__}({', '.join(args)})"
+
+
+class DatasetBooleanCondition:
+    """
+    Base class for boolean logic for dataset triggers.
+
+    :meta private:
+    """
+
+    agg_func: Callable
+
+    def __init__(self, *objects):
+        self.objects = objects
+
+    def evaluate(self, statuses: dict[str, bool]):
+        return self.agg_func(self.eval_one(x, statuses) for x in self.objects)
+
+    def eval_one(self, obj: Dataset | DatasetAny | DatasetAll, statuses):
+        if isinstance(obj, Dataset):
+            return statuses.get(obj.uri, False)
+        return obj.evaluate(statuses=statuses)
+
+    def all_datasets(self) -> dict[str, Dataset]:

Review Comment:
   it's a good suggestion.  this will be changed in followup refactor from TP, 
so i'll leave it for now to make rebasing easier if that's alright with you



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