chore: upgrade black (#19410)

This commit is contained in:
Ville Brofeldt
2022-03-29 20:03:09 +03:00
committed by GitHub
parent 816a2c3e1e
commit a619cb4ea9
204 changed files with 2125 additions and 608 deletions

View File

@@ -104,14 +104,19 @@ class DashboardPermalinkRestApi(BaseApi):
try:
state = self.add_model_schema.load(request.json)
key = CreateDashboardPermalinkCommand(
actor=g.user, dashboard_id=pk, state=state,
actor=g.user,
dashboard_id=pk,
state=state,
).run()
http_origin = request.headers.environ.get("HTTP_ORIGIN")
url = f"{http_origin}/superset/dashboard/p/{key}/"
return self.response(201, key=key, url=url)
except (ValidationError, DashboardPermalinkInvalidStateError) as ex:
return self.response(400, message=str(ex))
except (DashboardAccessDeniedError, KeyValueAccessDeniedError,) as ex:
except (
DashboardAccessDeniedError,
KeyValueAccessDeniedError,
) as ex:
return self.response(403, message=str(ex))
except DashboardNotFoundError as ex:
return self.response(404, message=str(ex))

View File

@@ -31,7 +31,10 @@ logger = logging.getLogger(__name__)
class CreateDashboardPermalinkCommand(BaseDashboardPermalinkCommand):
def __init__(
self, actor: User, dashboard_id: str, state: DashboardPermalinkState,
self,
actor: User,
dashboard_id: str,
state: DashboardPermalinkState,
):
self.actor = actor
self.dashboard_id = dashboard_id
@@ -46,7 +49,9 @@ class CreateDashboardPermalinkCommand(BaseDashboardPermalinkCommand):
"state": self.state,
}
key = CreateKeyValueCommand(
actor=self.actor, resource=self.resource, value=value,
actor=self.actor,
resource=self.resource,
value=value,
).run()
return encode_permalink_key(key=key.id, salt=self.salt)
except SQLAlchemyError as ex:

View File

@@ -19,7 +19,9 @@ from marshmallow import fields, Schema
class DashboardPermalinkPostSchema(Schema):
filterState = fields.Dict(
required=False, allow_none=True, description="Native filter state",
required=False,
allow_none=True,
description="Native filter state",
)
urlParams = fields.List(
fields.Tuple(