fix: methods incorrect type and update deprecated targets (#23935)

This commit is contained in:
Daniel Vaz Gaspar
2023-05-05 18:57:27 +01:00
committed by GitHub
parent 841726d432
commit 694f93326d
45 changed files with 253 additions and 192 deletions

View File

@@ -138,7 +138,7 @@ def _get_owner_id(tab_state_id: int) -> int:
class TabStateView(BaseSupersetView):
@has_access_api
@expose("/", methods=["POST"])
@expose("/", methods=("POST",))
def post(self) -> FlaskResponse: # pylint: disable=no-self-use
query_editor = json.loads(request.form["queryEditor"])
tab_state = TabState(
@@ -165,7 +165,7 @@ class TabStateView(BaseSupersetView):
return json_success(json.dumps({"id": tab_state.id}))
@has_access_api
@expose("/<int:tab_state_id>", methods=["DELETE"])
@expose("/<int:tab_state_id>", methods=("DELETE",))
def delete(self, tab_state_id: int) -> FlaskResponse: # pylint: disable=no-self-use
if _get_owner_id(tab_state_id) != get_user_id():
return Response(status=403)
@@ -180,7 +180,7 @@ class TabStateView(BaseSupersetView):
return json_success(json.dumps("OK"))
@has_access_api
@expose("/<int:tab_state_id>", methods=["GET"])
@expose("/<int:tab_state_id>", methods=("GET",))
def get(self, tab_state_id: int) -> FlaskResponse: # pylint: disable=no-self-use
if _get_owner_id(tab_state_id) != get_user_id():
return Response(status=403)
@@ -193,7 +193,7 @@ class TabStateView(BaseSupersetView):
)
@has_access_api
@expose("<int:tab_state_id>/activate", methods=["POST"])
@expose("<int:tab_state_id>/activate", methods=("POST",))
def activate( # pylint: disable=no-self-use
self, tab_state_id: int
) -> FlaskResponse:
@@ -212,7 +212,7 @@ class TabStateView(BaseSupersetView):
return json_success(json.dumps(tab_state_id))
@has_access_api
@expose("<int:tab_state_id>", methods=["PUT"])
@expose("<int:tab_state_id>", methods=("PUT",))
def put(self, tab_state_id: int) -> FlaskResponse: # pylint: disable=no-self-use
if _get_owner_id(tab_state_id) != get_user_id():
return Response(status=403)
@@ -223,7 +223,7 @@ class TabStateView(BaseSupersetView):
return json_success(json.dumps(tab_state_id))
@has_access_api
@expose("<int:tab_state_id>/migrate_query", methods=["POST"])
@expose("<int:tab_state_id>/migrate_query", methods=("POST",))
def migrate_query( # pylint: disable=no-self-use
self, tab_state_id: int
) -> FlaskResponse:
@@ -238,7 +238,7 @@ class TabStateView(BaseSupersetView):
return json_success(json.dumps(tab_state_id))
@has_access_api
@expose("<int:tab_state_id>/query/<client_id>", methods=["DELETE"])
@expose("<int:tab_state_id>/query/<client_id>", methods=("DELETE",))
def delete_query( # pylint: disable=no-self-use
self, tab_state_id: int, client_id: str
) -> FlaskResponse:
@@ -276,7 +276,7 @@ class TabStateView(BaseSupersetView):
class TableSchemaView(BaseSupersetView):
@has_access_api
@expose("/", methods=["POST"])
@expose("/", methods=("POST",))
def post(self) -> FlaskResponse: # pylint: disable=no-self-use
table = json.loads(request.form["table"])
@@ -301,7 +301,7 @@ class TableSchemaView(BaseSupersetView):
return json_success(json.dumps({"id": table_schema.id}))
@has_access_api
@expose("/<int:table_schema_id>", methods=["DELETE"])
@expose("/<int:table_schema_id>", methods=("DELETE",))
def delete( # pylint: disable=no-self-use
self, table_schema_id: int
) -> FlaskResponse:
@@ -312,7 +312,7 @@ class TableSchemaView(BaseSupersetView):
return json_success(json.dumps("OK"))
@has_access_api
@expose("/<int:table_schema_id>/expanded", methods=["POST"])
@expose("/<int:table_schema_id>/expanded", methods=("POST",))
def expanded( # pylint: disable=no-self-use
self, table_schema_id: int
) -> FlaskResponse: