mirror of
https://github.com/apache/superset.git
synced 2026-07-20 05:36:00 +00:00
style: ruff-format auto-format fix
This commit is contained in:
@@ -650,8 +650,9 @@ class DatabaseRestApi(BaseSupersetModelRestApi):
|
||||
@protect()
|
||||
@statsd_metrics
|
||||
@event_logger.log_this_with_context(
|
||||
action=lambda self, *args, **kwargs: f"{self.__class__.__name__}"
|
||||
f".sync-permissions",
|
||||
action=lambda self, *args, **kwargs: (
|
||||
f"{self.__class__.__name__}.sync-permissions"
|
||||
),
|
||||
log_to_statsd=False,
|
||||
)
|
||||
def sync_permissions(self, pk: int, **kwargs: Any) -> FlaskResponse:
|
||||
@@ -909,8 +910,9 @@ class DatabaseRestApi(BaseSupersetModelRestApi):
|
||||
@safe
|
||||
@statsd_metrics
|
||||
@event_logger.log_this_with_context(
|
||||
action=lambda self, *args, **kwargs: f"{self.__class__.__name__}"
|
||||
f".table_metadata_deprecated",
|
||||
action=lambda self, *args, **kwargs: (
|
||||
f"{self.__class__.__name__}.table_metadata_deprecated"
|
||||
),
|
||||
log_to_statsd=False,
|
||||
)
|
||||
def table_metadata_deprecated(
|
||||
@@ -973,8 +975,9 @@ class DatabaseRestApi(BaseSupersetModelRestApi):
|
||||
@statsd_metrics
|
||||
@deprecated(deprecated_in="4.0")
|
||||
@event_logger.log_this_with_context(
|
||||
action=lambda self, *args, **kwargs: f"{self.__class__.__name__}"
|
||||
f".table_extra_metadata_deprecated",
|
||||
action=lambda self, *args, **kwargs: (
|
||||
f"{self.__class__.__name__}.table_extra_metadata_deprecated"
|
||||
),
|
||||
log_to_statsd=False,
|
||||
)
|
||||
def table_extra_metadata_deprecated(
|
||||
@@ -1036,8 +1039,9 @@ class DatabaseRestApi(BaseSupersetModelRestApi):
|
||||
@protect()
|
||||
@statsd_metrics
|
||||
@event_logger.log_this_with_context(
|
||||
action=lambda self, *args, **kwargs: f"{self.__class__.__name__}"
|
||||
f".table_metadata",
|
||||
action=lambda self, *args, **kwargs: (
|
||||
f"{self.__class__.__name__}.table_metadata"
|
||||
),
|
||||
log_to_statsd=False,
|
||||
)
|
||||
def table_metadata(self, pk: int) -> FlaskResponse:
|
||||
@@ -1125,8 +1129,9 @@ class DatabaseRestApi(BaseSupersetModelRestApi):
|
||||
@protect()
|
||||
@statsd_metrics
|
||||
@event_logger.log_this_with_context(
|
||||
action=lambda self, *args, **kwargs: f"{self.__class__.__name__}"
|
||||
f".table_extra_metadata",
|
||||
action=lambda self, *args, **kwargs: (
|
||||
f"{self.__class__.__name__}.table_extra_metadata"
|
||||
),
|
||||
log_to_statsd=False,
|
||||
)
|
||||
def table_extra_metadata(self, pk: int) -> FlaskResponse:
|
||||
@@ -1268,8 +1273,9 @@ class DatabaseRestApi(BaseSupersetModelRestApi):
|
||||
@protect()
|
||||
@statsd_metrics
|
||||
@event_logger.log_this_with_context(
|
||||
action=lambda self, *args, **kwargs: f"{self.__class__.__name__}"
|
||||
f".test_connection",
|
||||
action=lambda self, *args, **kwargs: (
|
||||
f"{self.__class__.__name__}.test_connection"
|
||||
),
|
||||
log_to_statsd=False,
|
||||
)
|
||||
@requires_json
|
||||
@@ -1322,8 +1328,9 @@ class DatabaseRestApi(BaseSupersetModelRestApi):
|
||||
@safe
|
||||
@statsd_metrics
|
||||
@event_logger.log_this_with_context(
|
||||
action=lambda self, *args, **kwargs: f"{self.__class__.__name__}"
|
||||
f".related_objects",
|
||||
action=lambda self, *args, **kwargs: (
|
||||
f"{self.__class__.__name__}.related_objects"
|
||||
),
|
||||
log_to_statsd=False,
|
||||
)
|
||||
def related_objects(self, pk: int) -> Response:
|
||||
@@ -1853,8 +1860,9 @@ class DatabaseRestApi(BaseSupersetModelRestApi):
|
||||
@safe
|
||||
@statsd_metrics
|
||||
@event_logger.log_this_with_context(
|
||||
action=lambda self, *args, **kwargs: f"{self.__class__.__name__}"
|
||||
f".function_names",
|
||||
action=lambda self, *args, **kwargs: (
|
||||
f"{self.__class__.__name__}.function_names"
|
||||
),
|
||||
log_to_statsd=False,
|
||||
)
|
||||
def function_names(self, pk: int) -> Response:
|
||||
@@ -2008,8 +2016,9 @@ class DatabaseRestApi(BaseSupersetModelRestApi):
|
||||
@protect()
|
||||
@statsd_metrics
|
||||
@event_logger.log_this_with_context(
|
||||
action=lambda self, *args, **kwargs: f"{self.__class__.__name__}"
|
||||
f".validate_parameters",
|
||||
action=lambda self, *args, **kwargs: (
|
||||
f"{self.__class__.__name__}.validate_parameters"
|
||||
),
|
||||
log_to_statsd=False,
|
||||
)
|
||||
@requires_json
|
||||
@@ -2065,8 +2074,9 @@ class DatabaseRestApi(BaseSupersetModelRestApi):
|
||||
@safe
|
||||
@statsd_metrics
|
||||
@event_logger.log_this_with_context(
|
||||
action=lambda self, *args, **kwargs: f"{self.__class__.__name__}"
|
||||
f".schemas_access_for_file_upload",
|
||||
action=lambda self, *args, **kwargs: (
|
||||
f"{self.__class__.__name__}.schemas_access_for_file_upload"
|
||||
),
|
||||
log_to_statsd=False,
|
||||
)
|
||||
def schemas_access_for_file_upload(self, pk: int) -> Response:
|
||||
|
||||
@@ -577,7 +577,9 @@ def serialize_chart_object(chart: ChartLike | None) -> ChartInfo | None:
|
||||
|
||||
_display_name = display_name_for_viz_type(_viz_type) if _viz_type else None
|
||||
except Exception as exc: # noqa: BLE001
|
||||
logger.debug("Failed to resolve display name for viz_type=%r: %s", _viz_type, exc)
|
||||
logger.debug(
|
||||
"Failed to resolve display name for viz_type=%r: %s", _viz_type, exc
|
||||
)
|
||||
_display_name = None
|
||||
|
||||
return sanitize_chart_info_for_llm_context(
|
||||
|
||||
@@ -182,8 +182,9 @@ class QueryRestApi(BaseSupersetModelRestApi):
|
||||
@parse_rison(queries_get_updated_since_schema)
|
||||
@statsd_metrics
|
||||
@event_logger.log_this_with_context(
|
||||
action=lambda self, *args, **kwargs: f"{self.__class__.__name__}"
|
||||
f".get_updated_since",
|
||||
action=lambda self, *args, **kwargs: (
|
||||
f"{self.__class__.__name__}.get_updated_since"
|
||||
),
|
||||
log_to_statsd=False,
|
||||
)
|
||||
def get_updated_since(self, **kwargs: Any) -> FlaskResponse:
|
||||
|
||||
@@ -621,9 +621,9 @@ class ReportScheduleRestApi(BaseSupersetModelRestApi):
|
||||
@safe
|
||||
@statsd_metrics
|
||||
@event_logger.log_this_with_context(
|
||||
action=lambda self,
|
||||
*args,
|
||||
**kwargs: f"{self.__class__.__name__}.slack_channels",
|
||||
action=lambda self, *args, **kwargs: (
|
||||
f"{self.__class__.__name__}.slack_channels"
|
||||
),
|
||||
log_to_statsd=False,
|
||||
)
|
||||
def slack_channels(self, **kwargs: Any) -> Response:
|
||||
|
||||
@@ -617,8 +617,9 @@ class TagRestApi(BaseSupersetModelRestApi):
|
||||
@statsd_metrics
|
||||
@parse_rison({"type": "array", "items": {"type": "integer"}})
|
||||
@event_logger.log_this_with_context(
|
||||
action=lambda self, *args, **kwargs: f"{self.__class__.__name__}"
|
||||
f".favorite_status",
|
||||
action=lambda self, *args, **kwargs: (
|
||||
f"{self.__class__.__name__}.favorite_status"
|
||||
),
|
||||
log_to_statsd=False,
|
||||
)
|
||||
def favorite_status(self, **kwargs: Any) -> Response:
|
||||
@@ -715,8 +716,9 @@ class TagRestApi(BaseSupersetModelRestApi):
|
||||
@safe
|
||||
@statsd_metrics
|
||||
@event_logger.log_this_with_context(
|
||||
action=lambda self, *args, **kwargs: f"{self.__class__.__name__}"
|
||||
f".remove_favorite",
|
||||
action=lambda self, *args, **kwargs: (
|
||||
f"{self.__class__.__name__}.remove_favorite"
|
||||
),
|
||||
log_to_statsd=False,
|
||||
)
|
||||
def remove_favorite(self, pk: int) -> Response:
|
||||
|
||||
@@ -380,8 +380,9 @@ class TaskRestApi(BaseSupersetModelRestApi):
|
||||
@safe
|
||||
@statsd_metrics
|
||||
@event_logger.log_this_with_context(
|
||||
action=lambda self, *args, **kwargs: f"{self.__class__.__name__}"
|
||||
".related_subscribers",
|
||||
action=lambda self, *args, **kwargs: (
|
||||
f"{self.__class__.__name__}.related_subscribers"
|
||||
),
|
||||
log_to_statsd=False,
|
||||
)
|
||||
def related_subscribers(self) -> Response:
|
||||
|
||||
@@ -560,9 +560,9 @@ class ThemeRestApi(BaseSupersetModelRestApi):
|
||||
@safe
|
||||
@statsd_metrics
|
||||
@event_logger.log_this_with_context(
|
||||
action=lambda self,
|
||||
*args,
|
||||
**kwargs: f"{self.__class__.__name__}.set_system_default",
|
||||
action=lambda self, *args, **kwargs: (
|
||||
f"{self.__class__.__name__}.set_system_default"
|
||||
),
|
||||
log_to_statsd=False,
|
||||
)
|
||||
def set_system_default(self, pk: int) -> Response:
|
||||
@@ -627,9 +627,9 @@ class ThemeRestApi(BaseSupersetModelRestApi):
|
||||
@safe
|
||||
@statsd_metrics
|
||||
@event_logger.log_this_with_context(
|
||||
action=lambda self,
|
||||
*args,
|
||||
**kwargs: f"{self.__class__.__name__}.set_system_dark",
|
||||
action=lambda self, *args, **kwargs: (
|
||||
f"{self.__class__.__name__}.set_system_dark"
|
||||
),
|
||||
log_to_statsd=False,
|
||||
)
|
||||
def set_system_dark(self, pk: int) -> Response:
|
||||
@@ -694,9 +694,9 @@ class ThemeRestApi(BaseSupersetModelRestApi):
|
||||
@safe
|
||||
@statsd_metrics
|
||||
@event_logger.log_this_with_context(
|
||||
action=lambda self,
|
||||
*args,
|
||||
**kwargs: f"{self.__class__.__name__}.unset_system_default",
|
||||
action=lambda self, *args, **kwargs: (
|
||||
f"{self.__class__.__name__}.unset_system_default"
|
||||
),
|
||||
log_to_statsd=False,
|
||||
)
|
||||
def unset_system_default(self) -> Response:
|
||||
@@ -744,9 +744,9 @@ class ThemeRestApi(BaseSupersetModelRestApi):
|
||||
@safe
|
||||
@statsd_metrics
|
||||
@event_logger.log_this_with_context(
|
||||
action=lambda self,
|
||||
*args,
|
||||
**kwargs: f"{self.__class__.__name__}.unset_system_dark",
|
||||
action=lambda self, *args, **kwargs: (
|
||||
f"{self.__class__.__name__}.unset_system_dark"
|
||||
),
|
||||
log_to_statsd=False,
|
||||
)
|
||||
def unset_system_dark(self) -> Response:
|
||||
|
||||
@@ -229,8 +229,8 @@ class TestDatasource(SupersetTestCase):
|
||||
def test_external_metadata_by_name_for_virtual_table_uses_mutator(self):
|
||||
self.login(ADMIN_USERNAME)
|
||||
with create_and_cleanup_table() as tbl:
|
||||
current_app.config["SQL_QUERY_MUTATOR"] = (
|
||||
lambda sql, **kwargs: "SELECT 456 as intcol, 'def' as mutated_strcol"
|
||||
current_app.config["SQL_QUERY_MUTATOR"] = lambda sql, **kwargs: (
|
||||
"SELECT 456 as intcol, 'def' as mutated_strcol"
|
||||
)
|
||||
|
||||
params = rison.dumps(
|
||||
@@ -365,10 +365,12 @@ class TestDatasource(SupersetTestCase):
|
||||
|
||||
pytest.raises(
|
||||
SupersetGenericDBErrorException,
|
||||
lambda: db.session.query(SqlaTable)
|
||||
.filter_by(id=tbl.id)
|
||||
.one_or_none()
|
||||
.external_metadata(),
|
||||
lambda: (
|
||||
db.session.query(SqlaTable)
|
||||
.filter_by(id=tbl.id)
|
||||
.one_or_none()
|
||||
.external_metadata()
|
||||
),
|
||||
)
|
||||
|
||||
resp = self.client.get(url)
|
||||
|
||||
Reference in New Issue
Block a user