From 674927d9edb6e047c69c15ab51dc1121b1eb20a3 Mon Sep 17 00:00:00 2001 From: bart-maykin Date: Fri, 2 Aug 2024 10:48:30 +0200 Subject: [PATCH] :art: [#50] fixed black formating --- src/objects/api/kanalen.py | 8 +++++--- src/objects/api/v1/views.py | 12 ++++++------ src/objects/api/v2/views.py | 12 ++++++------ src/objects/conf/ci.py | 1 + src/objects/conf/staging.py | 1 + src/objects/setup.py | 1 + src/objects/tests/v1/test_stuf.py | 1 + src/objects/tests/v2/test_stuf.py | 1 + src/objects/wsgi.py | 1 + 9 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/objects/api/kanalen.py b/src/objects/api/kanalen.py index d2b29bb1..71d27719 100644 --- a/src/objects/api/kanalen.py +++ b/src/objects/api/kanalen.py @@ -23,9 +23,11 @@ def __init__( def get_kenmerken(self, obj: models.Model, data: dict = None) -> dict: data = data or {} return { - kenmerk: data.get("type") or obj.object.object_type.url - if kenmerk == "object_type" - else data.get(kenmerk, getattr(obj, kenmerk)) + kenmerk: ( + data.get("type") or obj.object.object_type.url + if kenmerk == "object_type" + else data.get(kenmerk, getattr(obj, kenmerk)) + ) for kenmerk in self.kenmerken } diff --git a/src/objects/api/v1/views.py b/src/objects/api/v1/views.py index cbc994b4..85a0f265 100644 --- a/src/objects/api/v1/views.py +++ b/src/objects/api/v1/views.py @@ -147,13 +147,13 @@ def finalize_response(self, request, response, *args, **kwargs): if serializer and response.status_code == 200: if self.action == "retrieve" and serializer.not_allowed: - self.headers[ - settings.UNAUTHORIZED_FIELDS_HEADER - ] = serializer.not_allowed.pretty() + self.headers[settings.UNAUTHORIZED_FIELDS_HEADER] = ( + serializer.not_allowed.pretty() + ) elif self.action in ("list", "search") and serializer.child.not_allowed: - self.headers[ - settings.UNAUTHORIZED_FIELDS_HEADER - ] = serializer.child.not_allowed.pretty() + self.headers[settings.UNAUTHORIZED_FIELDS_HEADER] = ( + serializer.child.not_allowed.pretty() + ) return super().finalize_response(request, response, *args, **kwargs) diff --git a/src/objects/api/v2/views.py b/src/objects/api/v2/views.py index 1cca735f..4c7aae33 100644 --- a/src/objects/api/v2/views.py +++ b/src/objects/api/v2/views.py @@ -157,14 +157,14 @@ def finalize_response(self, request, response, *args, **kwargs): response.data.get("results"), "serializer", None ) if self.action == "retrieve" and serializer.not_allowed: - self.headers[ - settings.UNAUTHORIZED_FIELDS_HEADER - ] = serializer.not_allowed.pretty() + self.headers[settings.UNAUTHORIZED_FIELDS_HEADER] = ( + serializer.not_allowed.pretty() + ) elif self.action in ("list", "search") and serializer.child.not_allowed: - self.headers[ - settings.UNAUTHORIZED_FIELDS_HEADER - ] = serializer.child.not_allowed.pretty() + self.headers[settings.UNAUTHORIZED_FIELDS_HEADER] = ( + serializer.child.not_allowed.pretty() + ) return super().finalize_response(request, response, *args, **kwargs) diff --git a/src/objects/conf/ci.py b/src/objects/conf/ci.py index def866cd..019c705b 100644 --- a/src/objects/conf/ci.py +++ b/src/objects/conf/ci.py @@ -1,6 +1,7 @@ """ Continuous integration settings module. """ + import logging import os diff --git a/src/objects/conf/staging.py b/src/objects/conf/staging.py index 23de7696..f2058007 100644 --- a/src/objects/conf/staging.py +++ b/src/objects/conf/staging.py @@ -2,6 +2,7 @@ Staging environment settings module. This *should* be nearly identical to production. """ + import os os.environ.setdefault("ENVIRONMENT", "staging") diff --git a/src/objects/setup.py b/src/objects/setup.py index 36a1751c..5e410b90 100644 --- a/src/objects/setup.py +++ b/src/objects/setup.py @@ -9,6 +9,7 @@ do NOT import anything Django related here, as this file needs to be loaded before Django is initialized. """ + import os from dotenv import load_dotenv diff --git a/src/objects/tests/v1/test_stuf.py b/src/objects/tests/v1/test_stuf.py index 33da0bd5..f601f4fe 100644 --- a/src/objects/tests/v1/test_stuf.py +++ b/src/objects/tests/v1/test_stuf.py @@ -3,6 +3,7 @@ material and formal history defined in the StUF 03.01 (Standaard Uitwisseling Formaat) https://www.gemmaonline.nl/images/gemmaonline/f/fa/Stuf0301.pdf """ + from datetime import date from rest_framework import status diff --git a/src/objects/tests/v2/test_stuf.py b/src/objects/tests/v2/test_stuf.py index 33da0bd5..f601f4fe 100644 --- a/src/objects/tests/v2/test_stuf.py +++ b/src/objects/tests/v2/test_stuf.py @@ -3,6 +3,7 @@ material and formal history defined in the StUF 03.01 (Standaard Uitwisseling Formaat) https://www.gemmaonline.nl/images/gemmaonline/f/fa/Stuf0301.pdf """ + from datetime import date from rest_framework import status diff --git a/src/objects/wsgi.py b/src/objects/wsgi.py index 8fd6e705..6076faee 100644 --- a/src/objects/wsgi.py +++ b/src/objects/wsgi.py @@ -6,6 +6,7 @@ For more information on this file, see https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/ """ + from django.core.wsgi import get_wsgi_application from objects.setup import setup_env