mirror of https://github.com/apache/superset.git
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()
|
||||
@safe
|
||||
@statsd_metrics
|
||||
def put( # pylint: disable=too-many-return-statements, arguments-differ
|
||||
self, pk: int
|
||||
) -> Response:
|
||||
def put(self, pk: int) -> Response:
|
||||
"""Changes a Dashboard
|
||||
---
|
||||
put:
|
||||
|
@ -286,24 +284,25 @@ class DashboardRestApi(BaseSupersetModelRestApi):
|
|||
return self.response_400(message=error.messages)
|
||||
try:
|
||||
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:
|
||||
return self.response_404()
|
||||
response = self.response_404()
|
||||
except DashboardForbiddenError:
|
||||
return self.response_403()
|
||||
response = self.response_403()
|
||||
except DashboardInvalidError as ex:
|
||||
return self.response_422(message=ex.normalized_messages())
|
||||
except DashboardUpdateFailedError as ex:
|
||||
logger.error(
|
||||
"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"])
|
||||
@protect()
|
||||
@safe
|
||||
@statsd_metrics
|
||||
def delete(self, pk: int) -> Response: # pylint: disable=arguments-differ
|
||||
def delete(self, pk: int) -> Response:
|
||||
"""Deletes a Dashboard
|
||||
---
|
||||
delete:
|
||||
|
@ -353,9 +352,7 @@ class DashboardRestApi(BaseSupersetModelRestApi):
|
|||
@safe
|
||||
@statsd_metrics
|
||||
@rison(get_delete_ids_schema)
|
||||
def bulk_delete(
|
||||
self, **kwargs: Any
|
||||
) -> Response: # pylint: disable=arguments-differ
|
||||
def bulk_delete(self, **kwargs: Any) -> Response:
|
||||
"""Delete bulk Dashboards
|
||||
---
|
||||
delete:
|
||||
|
|
Loading…
Reference in New Issue