Avoid redundant SET conversion (#11091)
* Avoid redundant SET conversion get_accessible_dag_ids() returns a SET, so no need to apply set() again * Add type annotation for get_accessible_dag_ids()
This commit is contained in:
Родитель
1a149827a2
Коммит
35c43987e5
|
@ -17,6 +17,8 @@
|
|||
# under the License.
|
||||
#
|
||||
|
||||
from typing import Set
|
||||
|
||||
from flask import current_app, g
|
||||
from flask_appbuilder.security.sqla import models as sqla_models
|
||||
from flask_appbuilder.security.sqla.manager import SecurityManager
|
||||
|
@ -307,7 +309,7 @@ class AirflowSecurityManager(SecurityManager, LoggingMixin):
|
|||
|
||||
return session.query(DagModel).filter(DagModel.dag_id.in_(resources))
|
||||
|
||||
def get_accessible_dag_ids(self, username=None):
|
||||
def get_accessible_dag_ids(self, username=None) -> Set[str]:
|
||||
"""
|
||||
Return a set of dags that user has access to(either read or write).
|
||||
|
||||
|
|
|
@ -588,7 +588,7 @@ class Airflow(AirflowBaseView): # noqa: D101 pylint: disable=too-many-public-m
|
|||
@provide_session
|
||||
def task_stats(self, session=None):
|
||||
"""Task Statistics"""
|
||||
allowed_dag_ids = set(current_app.appbuilder.sm.get_accessible_dag_ids())
|
||||
allowed_dag_ids = current_app.appbuilder.sm.get_accessible_dag_ids()
|
||||
|
||||
if not allowed_dag_ids:
|
||||
return wwwutils.json_response({})
|
||||
|
|
Загрузка…
Ссылка в новой задаче