mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
chore: annotate important types (#36034)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -45,7 +45,12 @@ from superset.models.core import Database
|
||||
from superset.models.dashboard import Dashboard
|
||||
from superset.models.slice import Slice
|
||||
from superset.models.sql_lab import Query
|
||||
from superset.superset_typing import FlaskResponse, FormData
|
||||
from superset.superset_typing import (
|
||||
BaseDatasourceData,
|
||||
FlaskResponse,
|
||||
FormData,
|
||||
QueryData,
|
||||
)
|
||||
from superset.utils import json
|
||||
from superset.utils.core import DatasourceType
|
||||
from superset.utils.decorators import stats_timing
|
||||
@@ -86,13 +91,20 @@ def redirect_to_login(next_target: str | None = None) -> FlaskResponse:
|
||||
return redirect(redirect_url)
|
||||
|
||||
|
||||
def sanitize_datasource_data(datasource_data: dict[str, Any]) -> dict[str, Any]:
|
||||
def sanitize_datasource_data(
|
||||
datasource_data: BaseDatasourceData | QueryData,
|
||||
) -> dict[str, Any]:
|
||||
"""
|
||||
Sanitize datasource data by removing sensitive database parameters.
|
||||
|
||||
Accepts TypedDict types (BaseDatasourceData, QueryData).
|
||||
"""
|
||||
if datasource_data:
|
||||
datasource_database = datasource_data.get("database")
|
||||
if datasource_database:
|
||||
datasource_database["parameters"] = {}
|
||||
|
||||
return datasource_data
|
||||
return datasource_data # type: ignore[return-value]
|
||||
|
||||
|
||||
def bootstrap_user_data(user: User, include_perms: bool = False) -> dict[str, Any]:
|
||||
|
||||
Reference in New Issue
Block a user