This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 51052bbbce Use `isdisjoint` instead of `not intersection` (#32616)
51052bbbce is described below

commit 51052bbbce159340e962e9fe40b6cae6ce05ab0c
Author: Daniel Standish <[email protected]>
AuthorDate: Sat Jul 15 13:51:16 2023 -0700

    Use `isdisjoint` instead of `not intersection` (#32616)
---
 airflow/utils/task_group.py | 4 ++--
 airflow/www/utils.py        | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/airflow/utils/task_group.py b/airflow/utils/task_group.py
index 2b117ca7da..50fa5ca19a 100644
--- a/airflow/utils/task_group.py
+++ b/airflow/utils/task_group.py
@@ -365,7 +365,7 @@ class TaskGroup(DAGNode):
         tasks = list(self)
         ids = {x.task_id for x in tasks}
         for task in tasks:
-            if not task.upstream_task_ids.intersection(ids):
+            if task.upstream_task_ids.isdisjoint(ids):
                 yield task
 
     def get_leaves(self) -> Generator[BaseOperator, None, None]:
@@ -386,7 +386,7 @@ class TaskGroup(DAGNode):
                     yield upstream_task
 
         for task in tasks:
-            if not task.downstream_task_ids.intersection(ids):
+            if task.downstream_task_ids.isdisjoint(ids):
                 if not (task.is_teardown or task.is_setup):
                     yield task
                 else:
diff --git a/airflow/www/utils.py b/airflow/www/utils.py
index bb48f81ccc..3624fbe841 100644
--- a/airflow/www/utils.py
+++ b/airflow/www/utils.py
@@ -766,7 +766,7 @@ class 
AirflowFilterConverter(fab_sqlafilters.SQLAFilterConverter):
     def __init__(self, datamodel):
         super().__init__(datamodel)
 
-        for (method, filters) in self.conversion_table:
+        for method, filters in self.conversion_table:
             if FilterIsNull not in filters:
                 filters.append(FilterIsNull)
             if FilterIsNotNull not in filters:
@@ -926,6 +926,6 @@ class UIAlert:
                 # Unable to obtain user role - default to not showing
                 return False
 
-            if not user_roles.intersection(set(self.roles)):
+            if user_roles.isdisjoint(self.roles):
                 return False
         return True

Reply via email to