mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
fix: pylint disabled rules in dashboard/api.py (#10976)
* Refactored `put` method in dashboards/api.py: - changed retun statements - removed lint disabled rule * `arguments-differ` disabled rule is not anymore valid - put argiments don't differ * `delete()` method in dashboards/api has now same list of argiments: - removing unecessary pylint check disabled * `bulk_delete()` method in dashboards/api has now same list of argiments: - removing unecessary pylint check disabled
This commit is contained in:
parent
fd0f6e1541
commit
9d7b3536e1
@ -232,9 +232,7 @@ class DashboardRestApi(BaseSupersetModelRestApi):
|
|||||||
@protect()
|
@protect()
|
||||||
@safe
|
@safe
|
||||||
@statsd_metrics
|
@statsd_metrics
|
||||||
def put( # pylint: disable=too-many-return-statements, arguments-differ
|
def put(self, pk: int) -> Response:
|
||||||
self, pk: int
|
|
||||||
) -> Response:
|
|
||||||
"""Changes a Dashboard
|
"""Changes a Dashboard
|
||||||
---
|
---
|
||||||
put:
|
put:
|
||||||
@ -286,24 +284,25 @@ class DashboardRestApi(BaseSupersetModelRestApi):
|
|||||||
return self.response_400(message=error.messages)
|
return self.response_400(message=error.messages)
|
||||||
try:
|
try:
|
||||||
changed_model = UpdateDashboardCommand(g.user, pk, item).run()
|
changed_model = UpdateDashboardCommand(g.user, pk, item).run()
|
||||||
return self.response(200, id=changed_model.id, result=item)
|
response = self.response(200, id=changed_model.id, result=item)
|
||||||
except DashboardNotFoundError:
|
except DashboardNotFoundError:
|
||||||
return self.response_404()
|
response = self.response_404()
|
||||||
except DashboardForbiddenError:
|
except DashboardForbiddenError:
|
||||||
return self.response_403()
|
response = self.response_403()
|
||||||
except DashboardInvalidError as ex:
|
except DashboardInvalidError as ex:
|
||||||
return self.response_422(message=ex.normalized_messages())
|
return self.response_422(message=ex.normalized_messages())
|
||||||
except DashboardUpdateFailedError as ex:
|
except DashboardUpdateFailedError as ex:
|
||||||
logger.error(
|
logger.error(
|
||||||
"Error updating model %s: %s", self.__class__.__name__, str(ex)
|
"Error updating model %s: %s", self.__class__.__name__, str(ex)
|
||||||
)
|
)
|
||||||
return self.response_422(message=str(ex))
|
response = self.response_422(message=str(ex))
|
||||||
|
return response
|
||||||
|
|
||||||
@expose("/<pk>", methods=["DELETE"])
|
@expose("/<pk>", methods=["DELETE"])
|
||||||
@protect()
|
@protect()
|
||||||
@safe
|
@safe
|
||||||
@statsd_metrics
|
@statsd_metrics
|
||||||
def delete(self, pk: int) -> Response: # pylint: disable=arguments-differ
|
def delete(self, pk: int) -> Response:
|
||||||
"""Deletes a Dashboard
|
"""Deletes a Dashboard
|
||||||
---
|
---
|
||||||
delete:
|
delete:
|
||||||
@ -353,9 +352,7 @@ class DashboardRestApi(BaseSupersetModelRestApi):
|
|||||||
@safe
|
@safe
|
||||||
@statsd_metrics
|
@statsd_metrics
|
||||||
@rison(get_delete_ids_schema)
|
@rison(get_delete_ids_schema)
|
||||||
def bulk_delete(
|
def bulk_delete(self, **kwargs: Any) -> Response:
|
||||||
self, **kwargs: Any
|
|
||||||
) -> Response: # pylint: disable=arguments-differ
|
|
||||||
"""Delete bulk Dashboards
|
"""Delete bulk Dashboards
|
||||||
---
|
---
|
||||||
delete:
|
delete:
|
||||||
|
Loading…
Reference in New Issue
Block a user