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 b8165941d0 replace loop by any when looking for a positive value in
core (#33985)
b8165941d0 is described below
commit b8165941d007081f0b7b24458d461a8760909ac8
Author: Hussein Awala <[email protected]>
AuthorDate: Fri Sep 1 14:35:43 2023 +0200
replace loop by any when looking for a positive value in core (#33985)
---
airflow/www/extensions/init_appbuilder.py | 5 +----
airflow/www/fab_security/sqla/manager.py | 5 +----
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/airflow/www/extensions/init_appbuilder.py
b/airflow/www/extensions/init_appbuilder.py
index 5ad9f0eabc..37c86b5fb0 100644
--- a/airflow/www/extensions/init_appbuilder.py
+++ b/airflow/www/extensions/init_appbuilder.py
@@ -645,10 +645,7 @@ class AirflowAppBuilder:
)
def _view_exists(self, view):
- for baseview in self.baseviews:
- if baseview.__class__ == view.__class__:
- return True
- return False
+ return any(baseview.__class__ == view.__class__ for baseview in
self.baseviews)
def _process_inner_views(self):
for view in self.baseviews:
diff --git a/airflow/www/fab_security/sqla/manager.py
b/airflow/www/fab_security/sqla/manager.py
index 5084a24be8..4dabf9dcdd 100644
--- a/airflow/www/fab_security/sqla/manager.py
+++ b/airflow/www/fab_security/sqla/manager.py
@@ -113,7 +113,4 @@ class SecurityManager(BaseSecurityManager):
).all()
def perms_include_action(self, perms, action_name):
- for perm in perms:
- if perm.action and perm.action.name == action_name:
- return True
- return False
+ return any(perm.action and perm.action.name == action_name for perm in
perms)