XD-DENG commented on a change in pull request #4833: [AIRFLOW-4006] Make better 
use of Set in AirflowSecurityManager
URL: https://github.com/apache/airflow/pull/4833#discussion_r262290814
 
 

 ##########
 File path: airflow/www/security.py
 ##########
 @@ -233,8 +233,8 @@ def get_all_permissions_views(self):
         """
         perms_views = set()
         for role in self.get_user_roles():
-            for perm_view in role.permissions:
-                perms_views.add((perm_view.permission.name, 
perm_view.view_menu.name))
+            perms_views = perms_views | {(perm_view.permission.name, 
perm_view.view_menu.name)
+                                         for perm_view in role.permissions}
 
 Review comment:
   Hi @feng-tao , please correct me if I'm wrong: the difference is mainly 
between adding "one-by-one" or "adding in bulk".
   
   I just realise `a.update({d for d in data})` may be more neat than `a = a | 
{d for d in data}`, while they're equivalent. Will make this change and push to 
trigger CI again (CI failed because of the RedisPy issue).

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


With regards,
Apache Git Services

Reply via email to