diff --git a/tests/conftest.py b/tests/conftest.py index 419e5059..bdf9703f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -4,6 +4,7 @@ The urls import is needed to make sure all urls/subclasses are registered BEFORE fixtures run. """ + from django.urls import clear_script_prefix, set_script_prefix import pytest diff --git a/tests/test_content_type_headers.py b/tests/test_content_type_headers.py index 0b34fd14..3b779ee8 100644 --- a/tests/test_content_type_headers.py +++ b/tests/test_content_type_headers.py @@ -1,6 +1,7 @@ """ Test that the required content type headers are present. """ + from django.urls import path from django.utils.translation import gettext_lazy as _ diff --git a/tests/test_server_errors.py b/tests/test_server_errors.py index f71d0570..1363c442 100644 --- a/tests/test_server_errors.py +++ b/tests/test_server_errors.py @@ -1,6 +1,7 @@ """ Test that server errors generate the appropriate JSON response. """ + from django.utils.translation import gettext as _ from rest_framework import status diff --git a/vng_api_common/audittrails/migrations/_operations.py b/vng_api_common/audittrails/migrations/_operations.py index a744e79c..2ccd322f 100644 --- a/vng_api_common/audittrails/migrations/_operations.py +++ b/vng_api_common/audittrails/migrations/_operations.py @@ -4,6 +4,7 @@ This is needed because of the merge with stable/1.0.x and master where different migrations perform the same schema changes and are thus conflicting. """ + from django.core.exceptions import FieldDoesNotExist from django.db import migrations diff --git a/vng_api_common/caching/__init__.py b/vng_api_common/caching/__init__.py index 81d53e8b..dc2076e5 100644 --- a/vng_api_common/caching/__init__.py +++ b/vng_api_common/caching/__init__.py @@ -12,6 +12,7 @@ and a decorator to enable conditional requests on viewsets. The rest are implementation details. """ + from .decorators import conditional_retrieve from .etags import calculate_etag from .models import ETagMixin diff --git a/vng_api_common/caching/etags.py b/vng_api_common/caching/etags.py index fd9c8408..4d99a613 100644 --- a/vng_api_common/caching/etags.py +++ b/vng_api_common/caching/etags.py @@ -1,6 +1,7 @@ """ Calculate ETag values for API resources. """ + import hashlib import logging from dataclasses import dataclass diff --git a/vng_api_common/caching/signals.py b/vng_api_common/caching/signals.py index cb55ae09..b2c65283 100644 --- a/vng_api_common/caching/signals.py +++ b/vng_api_common/caching/signals.py @@ -6,6 +6,7 @@ The signal does nothing except clearing the calculated value, which will be re-calculated on the next fetch. """ + from typing import Optional, Set from django.core.exceptions import FieldDoesNotExist diff --git a/vng_api_common/client.py b/vng_api_common/client.py index 64cabd95..3781806f 100644 --- a/vng_api_common/client.py +++ b/vng_api_common/client.py @@ -1,6 +1,7 @@ """ Interface to get a zds_client object for a given URL. """ + from typing import Optional from django.apps import apps diff --git a/vng_api_common/exception_handling.py b/vng_api_common/exception_handling.py index 8fe83528..33c41baf 100644 --- a/vng_api_common/exception_handling.py +++ b/vng_api_common/exception_handling.py @@ -35,9 +35,9 @@ def get_validation_errors(validation_errors: dict): for i, nested_error_dict in enumerate(error_list): if isinstance(nested_error_dict, dict): for err in get_validation_errors(nested_error_dict): - err[ - "name" - ] = f"{underscore_to_camel(field_name)}.{i}.{err['name']}" + err["name"] = ( + f"{underscore_to_camel(field_name)}.{i}.{err['name']}" + ) yield err # nested validation - recursively call the function diff --git a/vng_api_common/inspectors/polymorphic.py b/vng_api_common/inspectors/polymorphic.py index 3a092113..b0aed97e 100644 --- a/vng_api_common/inspectors/polymorphic.py +++ b/vng_api_common/inspectors/polymorphic.py @@ -3,6 +3,7 @@ Bulk of the code taken from https://github.com/axnsan12/drf-yasg/issues/100 """ + from drf_yasg import openapi from drf_yasg.errors import SwaggerGenerationError from drf_yasg.inspectors.base import NotHandled diff --git a/vng_api_common/management/commands/patch_error_contenttypes.py b/vng_api_common/management/commands/patch_error_contenttypes.py index f1b76f29..6d502e14 100644 --- a/vng_api_common/management/commands/patch_error_contenttypes.py +++ b/vng_api_common/management/commands/patch_error_contenttypes.py @@ -4,6 +4,7 @@ Due to the changes between Swagger 2.0 and OpenAPI 3.0, we cannot handle this at the Python level. """ + from django.core.management import BaseCommand import oyaml as yaml diff --git a/vng_api_common/management/commands/use_external_components.py b/vng_api_common/management/commands/use_external_components.py index 296ef101..f1cac6f1 100644 --- a/vng_api_common/management/commands/use_external_components.py +++ b/vng_api_common/management/commands/use_external_components.py @@ -3,6 +3,7 @@ Due to the limitations of drf_yasg we cannot handle this at the Python level """ + import os.path from django.conf import settings diff --git a/vng_api_common/oas.py b/vng_api_common/oas.py index e1ec4201..908e3766 100644 --- a/vng_api_common/oas.py +++ b/vng_api_common/oas.py @@ -4,6 +4,7 @@ This should get merged into gemma-zds-client, but some heavy refactoring is needed for that. """ + from typing import Union import requests diff --git a/vng_api_common/polymorphism.py b/vng_api_common/polymorphism.py index d18967ac..d6810305 100644 --- a/vng_api_common/polymorphism.py +++ b/vng_api_common/polymorphism.py @@ -33,6 +33,7 @@ The serializer output will then either contain ``field_for_value2`` or ``field_for_value2``, depending on the value of the field ``type``. """ + import logging from collections import OrderedDict from typing import Any, Dict, Union diff --git a/vng_api_common/validators.py b/vng_api_common/validators.py index 6a73412b..64308c77 100644 --- a/vng_api_common/validators.py +++ b/vng_api_common/validators.py @@ -43,9 +43,11 @@ def __call__(self, value): raise ValidationError( 'Waarde "{0}" mag geen diakrieten of non-ascii tekens bevatten{1}'.format( value, - " na de eerste {0} karakters".format(self.start) - if self.start - else "", + ( + " na de eerste {0} karakters".format(self.start) + if self.start + else "" + ), ) )