From bf0141acc6d702d023b5fe826a189b988384b21e Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 3 Jul 2021 19:55:53 +0200 Subject: [PATCH] crypto: fix linting Signed-off-by: Jens Langhammer --- authentik/crypto/models.py | 6 +++--- authentik/flows/views.py | 6 ++++-- authentik/stages/user_write/stage.py | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/authentik/crypto/models.py b/authentik/crypto/models.py index 6351887ea..37d875dc9 100644 --- a/authentik/crypto/models.py +++ b/authentik/crypto/models.py @@ -77,9 +77,9 @@ class CertificateKeyPair(CreatedUpdatedModel): @property def fingerprint_sha1(self) -> str: """Get SHA1 Fingerprint of certificate_data""" - return hexlify(self.certificate.fingerprint(hashes.SHA1()), ":").decode( - "utf-8" - ) + return hexlify( + self.certificate.fingerprint(hashes.SHA1()), ":" # nosec + ).decode("utf-8") @property def kid(self): diff --git a/authentik/flows/views.py b/authentik/flows/views.py index ea44daa1f..2a6ab7b39 100644 --- a/authentik/flows/views.py +++ b/authentik/flows/views.py @@ -134,7 +134,7 @@ class FlowExecutorView(APIView): message = exc.__doc__ if exc.__doc__ else str(exc) return self.stage_invalid(error_message=message) - # pylint: disable=unused-argument + # pylint: disable=unused-argument, too-many-return-statements def dispatch(self, request: HttpRequest, flow_slug: str) -> HttpResponse: # Early check if theres an active Plan for the current session if SESSION_KEY_PLAN in self.request.session: @@ -173,7 +173,9 @@ class FlowExecutorView(APIView): # in which case we just delete the plan and invalidate everything next_binding = self.plan.next(self.request) except Exception as exc: # pylint: disable=broad-except - self._logger.warning("f(exec): found incompatible flow plan, invalidating run", exc=exc) + self._logger.warning( + "f(exec): found incompatible flow plan, invalidating run", exc=exc + ) keys = cache.keys("flow_*") cache.delete_many(keys) return self.stage_invalid() diff --git a/authentik/stages/user_write/stage.py b/authentik/stages/user_write/stage.py index 36fea982f..0e726e05f 100644 --- a/authentik/stages/user_write/stage.py +++ b/authentik/stages/user_write/stage.py @@ -25,6 +25,7 @@ class UserWriteStageView(StageView): """Finalise Enrollment flow by creating a user object.""" def post(self, request: HttpRequest) -> HttpResponse: + """Wrapper for post requests""" return self.get(request) def get(self, request: HttpRequest) -> HttpResponse: