root: reformat with latest black version and fix tests (#8376)
* format files Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix pyright Signed-off-by: Jens Langhammer <jens@goauthentik.io> * revert #8367 Signed-off-by: Jens Langhammer <jens@goauthentik.io> * sigh Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
		| @ -1,4 +1,5 @@ | |||||||
| """authentik root module""" | """authentik root module""" | ||||||
|  |  | ||||||
| from os import environ | from os import environ | ||||||
| from typing import Optional | from typing import Optional | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Meta API""" | """Meta API""" | ||||||
|  |  | ||||||
| from drf_spectacular.utils import extend_schema | from drf_spectacular.utils import extend_schema | ||||||
| from rest_framework.fields import CharField | from rest_framework.fields import CharField | ||||||
| from rest_framework.permissions import IsAuthenticated | from rest_framework.permissions import IsAuthenticated | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """authentik administration metrics""" | """authentik administration metrics""" | ||||||
|  |  | ||||||
| from datetime import timedelta | from datetime import timedelta | ||||||
|  |  | ||||||
| from django.db.models.functions import ExtractHour | from django.db.models.functions import ExtractHour | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """authentik administration overview""" | """authentik administration overview""" | ||||||
|  |  | ||||||
| import platform | import platform | ||||||
| from datetime import datetime | from datetime import datetime | ||||||
| from sys import version as python_version | from sys import version as python_version | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """authentik administration overview""" | """authentik administration overview""" | ||||||
|  |  | ||||||
| from django.core.cache import cache | from django.core.cache import cache | ||||||
| from drf_spectacular.utils import extend_schema | from drf_spectacular.utils import extend_schema | ||||||
| from packaging.version import parse | from packaging.version import parse | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """authentik administration overview""" | """authentik administration overview""" | ||||||
|  |  | ||||||
| from django.conf import settings | from django.conf import settings | ||||||
| from drf_spectacular.utils import extend_schema, inline_serializer | from drf_spectacular.utils import extend_schema, inline_serializer | ||||||
| from rest_framework.fields import IntegerField | from rest_framework.fields import IntegerField | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """authentik admin app config""" | """authentik admin app config""" | ||||||
|  |  | ||||||
| from prometheus_client import Gauge, Info | from prometheus_client import Gauge, Info | ||||||
|  |  | ||||||
| from authentik.blueprints.apps import ManagedAppConfig | from authentik.blueprints.apps import ManagedAppConfig | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """authentik admin settings""" | """authentik admin settings""" | ||||||
|  |  | ||||||
| from celery.schedules import crontab | from celery.schedules import crontab | ||||||
|  |  | ||||||
| from authentik.lib.utils.time import fqdn_rand | from authentik.lib.utils.time import fqdn_rand | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """admin signals""" | """admin signals""" | ||||||
|  |  | ||||||
| from django.dispatch import receiver | from django.dispatch import receiver | ||||||
|  |  | ||||||
| from authentik.admin.apps import GAUGE_WORKERS | from authentik.admin.apps import GAUGE_WORKERS | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """authentik admin tasks""" | """authentik admin tasks""" | ||||||
|  |  | ||||||
| import re | import re | ||||||
|  |  | ||||||
| from django.core.cache import cache | from django.core.cache import cache | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """test admin api""" | """test admin api""" | ||||||
|  |  | ||||||
| from json import loads | from json import loads | ||||||
|  |  | ||||||
| from django.test import TestCase | from django.test import TestCase | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """test admin tasks""" | """test admin tasks""" | ||||||
|  |  | ||||||
| from django.core.cache import cache | from django.core.cache import cache | ||||||
| from django.test import TestCase | from django.test import TestCase | ||||||
| from requests_mock import Mocker | from requests_mock import Mocker | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """API URLs""" | """API URLs""" | ||||||
|  |  | ||||||
| from django.urls import path | from django.urls import path | ||||||
|  |  | ||||||
| from authentik.admin.api.meta import AppsViewSet, ModelViewSet | from authentik.admin.api.meta import AppsViewSet, ModelViewSet | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """API Authentication""" | """API Authentication""" | ||||||
|  |  | ||||||
| from hmac import compare_digest | from hmac import compare_digest | ||||||
| from typing import Any, Optional | from typing import Any, Optional | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """API Authorization""" | """API Authorization""" | ||||||
|  |  | ||||||
| from django.conf import settings | from django.conf import settings | ||||||
| from django.db.models import Model | from django.db.models import Model | ||||||
| from django.db.models.query import QuerySet | from django.db.models.query import QuerySet | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """API Decorators""" | """API Decorators""" | ||||||
|  |  | ||||||
| from functools import wraps | from functools import wraps | ||||||
| from typing import Callable, Optional | from typing import Callable, Optional | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Pagination which includes total pages and current page""" | """Pagination which includes total pages and current page""" | ||||||
|  |  | ||||||
| from rest_framework import pagination | from rest_framework import pagination | ||||||
| from rest_framework.response import Response | from rest_framework.response import Response | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Error Response schema, from https://github.com/axnsan12/drf-yasg/issues/224""" | """Error Response schema, from https://github.com/axnsan12/drf-yasg/issues/224""" | ||||||
|  |  | ||||||
| from django.utils.translation import gettext_lazy as _ | from django.utils.translation import gettext_lazy as _ | ||||||
| from drf_spectacular.generators import SchemaGenerator | from drf_spectacular.generators import SchemaGenerator | ||||||
| from drf_spectacular.plumbing import ( | from drf_spectacular.plumbing import ( | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Test API Authentication""" | """Test API Authentication""" | ||||||
|  |  | ||||||
| import json | import json | ||||||
| from base64 import b64encode | from base64 import b64encode | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Test config API""" | """Test config API""" | ||||||
|  |  | ||||||
| from json import loads | from json import loads | ||||||
|  |  | ||||||
| from django.urls import reverse | from django.urls import reverse | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """test decorators api""" | """test decorators api""" | ||||||
|  |  | ||||||
| from django.urls import reverse | from django.urls import reverse | ||||||
| from guardian.shortcuts import assign_perm | from guardian.shortcuts import assign_perm | ||||||
| from rest_framework.test import APITestCase | from rest_framework.test import APITestCase | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Schema generation tests""" | """Schema generation tests""" | ||||||
|  |  | ||||||
| from django.urls import reverse | from django.urls import reverse | ||||||
| from rest_framework.test import APITestCase | from rest_framework.test import APITestCase | ||||||
| from yaml import safe_load | from yaml import safe_load | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """authentik API Modelviewset tests""" | """authentik API Modelviewset tests""" | ||||||
|  |  | ||||||
| from typing import Callable | from typing import Callable | ||||||
|  |  | ||||||
| from django.test import TestCase | from django.test import TestCase | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """authentik api urls""" | """authentik api urls""" | ||||||
|  |  | ||||||
| from django.urls import include, path | from django.urls import include, path | ||||||
|  |  | ||||||
| from authentik.api.v3.urls import urlpatterns as v3_urls | from authentik.api.v3.urls import urlpatterns as v3_urls | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """core Configs API""" | """core Configs API""" | ||||||
|  |  | ||||||
| from pathlib import Path | from pathlib import Path | ||||||
|  |  | ||||||
| from django.conf import settings | from django.conf import settings | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """api v3 urls""" | """api v3 urls""" | ||||||
|  |  | ||||||
| from importlib import import_module | from importlib import import_module | ||||||
|  |  | ||||||
| from django.urls import path | from django.urls import path | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """General API Views""" | """General API Views""" | ||||||
|  |  | ||||||
| from typing import Any | from typing import Any | ||||||
|  |  | ||||||
| from django.urls import reverse | from django.urls import reverse | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Serializer mixin for managed models""" | """Serializer mixin for managed models""" | ||||||
|  |  | ||||||
| from django.utils.translation import gettext_lazy as _ | from django.utils.translation import gettext_lazy as _ | ||||||
| from drf_spectacular.utils import extend_schema, inline_serializer | from drf_spectacular.utils import extend_schema, inline_serializer | ||||||
| from rest_framework.decorators import action | from rest_framework.decorators import action | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Apply blueprint from commandline""" | """Apply blueprint from commandline""" | ||||||
|  |  | ||||||
| from sys import exit as sys_exit | from sys import exit as sys_exit | ||||||
|  |  | ||||||
| from django.core.management.base import BaseCommand, no_translations | from django.core.management.base import BaseCommand, no_translations | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Export blueprint of current authentik install""" | """Export blueprint of current authentik install""" | ||||||
|  |  | ||||||
| from django.core.management.base import no_translations | from django.core.management.base import no_translations | ||||||
| from structlog.stdlib import get_logger | from structlog.stdlib import get_logger | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Generate JSON Schema for blueprints""" | """Generate JSON Schema for blueprints""" | ||||||
|  |  | ||||||
| from json import dumps | from json import dumps | ||||||
| from typing import Any | from typing import Any | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """blueprint models""" | """blueprint models""" | ||||||
|  |  | ||||||
| from pathlib import Path | from pathlib import Path | ||||||
| from uuid import uuid4 | from uuid import uuid4 | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """blueprint Settings""" | """blueprint Settings""" | ||||||
|  |  | ||||||
| from celery.schedules import crontab | from celery.schedules import crontab | ||||||
|  |  | ||||||
| from authentik.lib.utils.time import fqdn_rand | from authentik.lib.utils.time import fqdn_rand | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Blueprint helpers""" | """Blueprint helpers""" | ||||||
|  |  | ||||||
| from functools import wraps | from functools import wraps | ||||||
| from typing import Callable | from typing import Callable | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """authentik managed models tests""" | """authentik managed models tests""" | ||||||
|  |  | ||||||
| from django.test import TestCase | from django.test import TestCase | ||||||
|  |  | ||||||
| from authentik.blueprints.models import BlueprintInstance, BlueprintRetrievalFailed | from authentik.blueprints.models import BlueprintInstance, BlueprintRetrievalFailed | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Test blueprints OCI""" | """Test blueprints OCI""" | ||||||
|  |  | ||||||
| from django.test import TransactionTestCase | from django.test import TransactionTestCase | ||||||
| from requests_mock import Mocker | from requests_mock import Mocker | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """test packaged blueprints""" | """test packaged blueprints""" | ||||||
|  |  | ||||||
| from pathlib import Path | from pathlib import Path | ||||||
| from typing import Callable | from typing import Callable | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """authentik managed models tests""" | """authentik managed models tests""" | ||||||
|  |  | ||||||
| from typing import Callable, Type | from typing import Callable, Type | ||||||
|  |  | ||||||
| from django.apps import apps | from django.apps import apps | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Test blueprints v1""" | """Test blueprints v1""" | ||||||
|  |  | ||||||
| from os import environ | from os import environ | ||||||
|  |  | ||||||
| from django.test import TransactionTestCase | from django.test import TransactionTestCase | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Test blueprints v1 api""" | """Test blueprints v1 api""" | ||||||
|  |  | ||||||
| from json import loads | from json import loads | ||||||
| from tempfile import NamedTemporaryFile, mkdtemp | from tempfile import NamedTemporaryFile, mkdtemp | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Test blueprints v1""" | """Test blueprints v1""" | ||||||
|  |  | ||||||
| from django.test import TransactionTestCase | from django.test import TransactionTestCase | ||||||
|  |  | ||||||
| from authentik.blueprints.v1.importer import Importer | from authentik.blueprints.v1.importer import Importer | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Test blueprints v1""" | """Test blueprints v1""" | ||||||
|  |  | ||||||
| from django.test import TransactionTestCase | from django.test import TransactionTestCase | ||||||
|  |  | ||||||
| from authentik.blueprints.v1.importer import Importer | from authentik.blueprints.v1.importer import Importer | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Test blueprints v1""" | """Test blueprints v1""" | ||||||
|  |  | ||||||
| from django.test import TransactionTestCase | from django.test import TransactionTestCase | ||||||
|  |  | ||||||
| from authentik.blueprints.v1.importer import Importer | from authentik.blueprints.v1.importer import Importer | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Test blueprints v1 tasks""" | """Test blueprints v1 tasks""" | ||||||
|  |  | ||||||
| from hashlib import sha512 | from hashlib import sha512 | ||||||
| from tempfile import NamedTemporaryFile, mkdtemp | from tempfile import NamedTemporaryFile, mkdtemp | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """API URLs""" | """API URLs""" | ||||||
|  |  | ||||||
| from authentik.blueprints.api import BlueprintInstanceViewSet | from authentik.blueprints.api import BlueprintInstanceViewSet | ||||||
|  |  | ||||||
| api_urlpatterns = [ | api_urlpatterns = [ | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """transfer common classes""" | """transfer common classes""" | ||||||
|  |  | ||||||
| from collections import OrderedDict | from collections import OrderedDict | ||||||
| from copy import copy | from copy import copy | ||||||
| from dataclasses import asdict, dataclass, field, is_dataclass | from dataclasses import asdict, dataclass, field, is_dataclass | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Blueprint exporter""" | """Blueprint exporter""" | ||||||
|  |  | ||||||
| from typing import Iterable | from typing import Iterable | ||||||
| from uuid import UUID | from uuid import UUID | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Blueprint importer""" | """Blueprint importer""" | ||||||
|  |  | ||||||
| from contextlib import contextmanager | from contextlib import contextmanager | ||||||
| from copy import deepcopy | from copy import deepcopy | ||||||
| from typing import Any, Optional | from typing import Any, Optional | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Apply Blueprint meta model""" | """Apply Blueprint meta model""" | ||||||
|  |  | ||||||
| from typing import TYPE_CHECKING | from typing import TYPE_CHECKING | ||||||
|  |  | ||||||
| from rest_framework.exceptions import ValidationError | from rest_framework.exceptions import ValidationError | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Base models""" | """Base models""" | ||||||
|  |  | ||||||
| from django.apps import apps | from django.apps import apps | ||||||
| from django.db.models import Model | from django.db.models import Model | ||||||
| from rest_framework.serializers import Serializer | from rest_framework.serializers import Serializer | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """OCI Client""" | """OCI Client""" | ||||||
|  |  | ||||||
| from typing import Any | from typing import Any | ||||||
| from urllib.parse import ParseResult, urlparse | from urllib.parse import ParseResult, urlparse | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """v1 blueprints tasks""" | """v1 blueprints tasks""" | ||||||
|  |  | ||||||
| from dataclasses import asdict, dataclass, field | from dataclasses import asdict, dataclass, field | ||||||
| from hashlib import sha512 | from hashlib import sha512 | ||||||
| from pathlib import Path | from pathlib import Path | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Serializer for brands models""" | """Serializer for brands models""" | ||||||
|  |  | ||||||
| from typing import Any | from typing import Any | ||||||
|  |  | ||||||
| from django.db import models | from django.db import models | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """authentik brands app""" | """authentik brands app""" | ||||||
|  |  | ||||||
| from django.apps import AppConfig | from django.apps import AppConfig | ||||||
|  |  | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Inject brand into current request""" | """Inject brand into current request""" | ||||||
|  |  | ||||||
| from typing import Callable | from typing import Callable | ||||||
|  |  | ||||||
| from django.http.request import HttpRequest | from django.http.request import HttpRequest | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """brand models""" | """brand models""" | ||||||
|  |  | ||||||
| from uuid import uuid4 | from uuid import uuid4 | ||||||
|  |  | ||||||
| from django.db import models | from django.db import models | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Test brands""" | """Test brands""" | ||||||
|  |  | ||||||
| from django.urls import reverse | from django.urls import reverse | ||||||
| from rest_framework.test import APITestCase | from rest_framework.test import APITestCase | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """API URLs""" | """API URLs""" | ||||||
|  |  | ||||||
| from authentik.brands.api import BrandViewSet | from authentik.brands.api import BrandViewSet | ||||||
|  |  | ||||||
| api_urlpatterns = [ | api_urlpatterns = [ | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Brand utilities""" | """Brand utilities""" | ||||||
|  |  | ||||||
| from typing import Any | from typing import Any | ||||||
|  |  | ||||||
| from django.db.models import F, Q | from django.db.models import F, Q | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Application API Views""" | """Application API Views""" | ||||||
|  |  | ||||||
| from copy import copy | from copy import copy | ||||||
| from datetime import timedelta | from datetime import timedelta | ||||||
| from typing import Optional | from typing import Optional | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """AuthenticatedSessions API Viewset""" | """AuthenticatedSessions API Viewset""" | ||||||
|  |  | ||||||
| from typing import Optional, TypedDict | from typing import Optional, TypedDict | ||||||
|  |  | ||||||
| from django_filters.rest_framework import DjangoFilterBackend | from django_filters.rest_framework import DjangoFilterBackend | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Authenticator Devices API Views""" | """Authenticator Devices API Views""" | ||||||
|  |  | ||||||
| from drf_spectacular.types import OpenApiTypes | from drf_spectacular.types import OpenApiTypes | ||||||
| from drf_spectacular.utils import OpenApiParameter, extend_schema | from drf_spectacular.utils import OpenApiParameter, extend_schema | ||||||
| from rest_framework.fields import BooleanField, CharField, IntegerField, SerializerMethodField | from rest_framework.fields import BooleanField, CharField, IntegerField, SerializerMethodField | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Groups API Viewset""" | """Groups API Viewset""" | ||||||
|  |  | ||||||
| from json import loads | from json import loads | ||||||
| from typing import Optional | from typing import Optional | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """PropertyMapping API Views""" | """PropertyMapping API Views""" | ||||||
|  |  | ||||||
| from json import dumps | from json import dumps | ||||||
|  |  | ||||||
| from drf_spectacular.types import OpenApiTypes | from drf_spectacular.types import OpenApiTypes | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Provider API Views""" | """Provider API Views""" | ||||||
|  |  | ||||||
| from django.db.models import QuerySet | from django.db.models import QuerySet | ||||||
| from django.db.models.query import Q | from django.db.models.query import Q | ||||||
| from django.utils.translation import gettext_lazy as _ | from django.utils.translation import gettext_lazy as _ | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Source API Views""" | """Source API Views""" | ||||||
|  |  | ||||||
| from typing import Iterable | from typing import Iterable | ||||||
|  |  | ||||||
| from django_filters.rest_framework import DjangoFilterBackend | from django_filters.rest_framework import DjangoFilterBackend | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Tokens API Viewset""" | """Tokens API Viewset""" | ||||||
|  |  | ||||||
| from typing import Any | from typing import Any | ||||||
|  |  | ||||||
| from django_filters.rest_framework import DjangoFilterBackend | from django_filters.rest_framework import DjangoFilterBackend | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """transactional application and provider creation""" | """transactional application and provider creation""" | ||||||
|  |  | ||||||
| from django.apps import apps | from django.apps import apps | ||||||
| from drf_spectacular.utils import PolymorphicProxySerializer, extend_schema, extend_schema_field | from drf_spectacular.utils import PolymorphicProxySerializer, extend_schema, extend_schema_field | ||||||
| from rest_framework.exceptions import ValidationError | from rest_framework.exceptions import ValidationError | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """used_by mixin""" | """used_by mixin""" | ||||||
|  |  | ||||||
| from enum import Enum | from enum import Enum | ||||||
| from inspect import getmembers | from inspect import getmembers | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """User API Views""" | """User API Views""" | ||||||
|  |  | ||||||
| from datetime import timedelta | from datetime import timedelta | ||||||
| from json import loads | from json import loads | ||||||
| from typing import Any, Optional | from typing import Any, Optional | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """API Utilities""" | """API Utilities""" | ||||||
|  |  | ||||||
| from typing import Any | from typing import Any | ||||||
|  |  | ||||||
| from django.db.models import Model | from django.db.models import Model | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """authentik core app config""" | """authentik core app config""" | ||||||
|  |  | ||||||
| from django.conf import settings | from django.conf import settings | ||||||
|  |  | ||||||
| from authentik.blueprints.apps import ManagedAppConfig | from authentik.blueprints.apps import ManagedAppConfig | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Channels base classes""" | """Channels base classes""" | ||||||
|  |  | ||||||
| from channels.db import database_sync_to_async | from channels.db import database_sync_to_async | ||||||
| from channels.exceptions import DenyConnection | from channels.exceptions import DenyConnection | ||||||
| from rest_framework.exceptions import AuthenticationFailed | from rest_framework.exceptions import AuthenticationFailed | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """authentik core exceptions""" | """authentik core exceptions""" | ||||||
|  |  | ||||||
| from authentik.lib.sentry import SentryIgnoredException | from authentik.lib.sentry import SentryIgnoredException | ||||||
|  |  | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Property Mapping Evaluator""" | """Property Mapping Evaluator""" | ||||||
|  |  | ||||||
| from typing import Any, Optional | from typing import Any, Optional | ||||||
|  |  | ||||||
| from django.db.models import Model | from django.db.models import Model | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Run bootstrap tasks""" | """Run bootstrap tasks""" | ||||||
|  |  | ||||||
| from django.core.management.base import BaseCommand | from django.core.management.base import BaseCommand | ||||||
| from django_tenants.utils import get_public_schema_name | from django_tenants.utils import get_public_schema_name | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Build source docs""" | """Build source docs""" | ||||||
|  |  | ||||||
| from pathlib import Path | from pathlib import Path | ||||||
|  |  | ||||||
| from django.core.management.base import BaseCommand | from django.core.management.base import BaseCommand | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """custom runserver command""" | """custom runserver command""" | ||||||
|  |  | ||||||
| from daphne.management.commands.runserver import Command as RunServer | from daphne.management.commands.runserver import Command as RunServer | ||||||
|  |  | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Repair missing permissions""" | """Repair missing permissions""" | ||||||
|  |  | ||||||
| from django.apps import apps | from django.apps import apps | ||||||
| from django.contrib.auth.management import create_permissions | from django.contrib.auth.management import create_permissions | ||||||
| from django.core.management.base import BaseCommand, no_translations | from django.core.management.base import BaseCommand, no_translations | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """authentik shell command""" | """authentik shell command""" | ||||||
|  |  | ||||||
| import code | import code | ||||||
| import platform | import platform | ||||||
| import sys | import sys | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Run worker""" | """Run worker""" | ||||||
|  |  | ||||||
| from sys import exit as sysexit | from sys import exit as sysexit | ||||||
| from tempfile import tempdir | from tempfile import tempdir | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """authentik admin Middleware to impersonate users""" | """authentik admin Middleware to impersonate users""" | ||||||
|  |  | ||||||
| from contextvars import ContextVar | from contextvars import ContextVar | ||||||
| from typing import Callable, Optional | from typing import Callable, Optional | ||||||
| from uuid import uuid4 | from uuid import uuid4 | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """authentik core models""" | """authentik core models""" | ||||||
|  |  | ||||||
| from datetime import timedelta | from datetime import timedelta | ||||||
| from hashlib import sha256 | from hashlib import sha256 | ||||||
| from typing import Any, Optional, Self | from typing import Any, Optional, Self | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """authentik core signals""" | """authentik core signals""" | ||||||
|  |  | ||||||
| from django.contrib.auth.signals import user_logged_in, user_logged_out | from django.contrib.auth.signals import user_logged_in, user_logged_out | ||||||
| from django.contrib.sessions.backends.cache import KEY_PREFIX | from django.contrib.sessions.backends.cache import KEY_PREFIX | ||||||
| from django.core.cache import cache | from django.core.cache import cache | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Source decision helper""" | """Source decision helper""" | ||||||
|  |  | ||||||
| from enum import Enum | from enum import Enum | ||||||
| from typing import Any, Optional | from typing import Any, Optional | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Source flow manager stages""" | """Source flow manager stages""" | ||||||
|  |  | ||||||
| from django.http import HttpRequest, HttpResponse | from django.http import HttpRequest, HttpResponse | ||||||
|  |  | ||||||
| from authentik.core.models import User, UserSourceConnection | from authentik.core.models import User, UserSourceConnection | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """authentik core tasks""" | """authentik core tasks""" | ||||||
|  |  | ||||||
| from datetime import datetime, timedelta | from datetime import datetime, timedelta | ||||||
|  |  | ||||||
| from django.contrib.sessions.backends.cache import KEY_PREFIX | from django.contrib.sessions.backends.cache import KEY_PREFIX | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Test API Utils""" | """Test API Utils""" | ||||||
|  |  | ||||||
| from rest_framework.exceptions import ValidationError | from rest_framework.exceptions import ValidationError | ||||||
| from rest_framework.test import APITestCase | from rest_framework.test import APITestCase | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Test Applications API""" | """Test Applications API""" | ||||||
|  |  | ||||||
| from json import loads | from json import loads | ||||||
|  |  | ||||||
| from django.core.files.base import ContentFile | from django.core.files.base import ContentFile | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Test Applications API""" | """Test Applications API""" | ||||||
|  |  | ||||||
| from unittest.mock import MagicMock, patch | from unittest.mock import MagicMock, patch | ||||||
|  |  | ||||||
| from django.urls import reverse | from django.urls import reverse | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Test AuthenticatedSessions API""" | """Test AuthenticatedSessions API""" | ||||||
|  |  | ||||||
| from json import loads | from json import loads | ||||||
|  |  | ||||||
| from django.urls.base import reverse | from django.urls.base import reverse | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """group tests""" | """group tests""" | ||||||
|  |  | ||||||
| from django.test.testcases import TestCase | from django.test.testcases import TestCase | ||||||
|  |  | ||||||
| from authentik.core.models import Group, User | from authentik.core.models import Group, User | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Test Groups API""" | """Test Groups API""" | ||||||
|  |  | ||||||
| from django.urls.base import reverse | from django.urls.base import reverse | ||||||
| from rest_framework.test import APITestCase | from rest_framework.test import APITestCase | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """impersonation tests""" | """impersonation tests""" | ||||||
|  |  | ||||||
| from json import loads | from json import loads | ||||||
|  |  | ||||||
| from django.urls import reverse | from django.urls import reverse | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """authentik core models tests""" | """authentik core models tests""" | ||||||
|  |  | ||||||
| from time import sleep | from time import sleep | ||||||
| from typing import Callable | from typing import Callable | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """authentik core property mapping tests""" | """authentik core property mapping tests""" | ||||||
|  |  | ||||||
| from django.test import RequestFactory, TestCase | from django.test import RequestFactory, TestCase | ||||||
| from guardian.shortcuts import get_anonymous_user | from guardian.shortcuts import get_anonymous_user | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Test property mappings API""" | """Test property mappings API""" | ||||||
|  |  | ||||||
| from json import dumps | from json import dumps | ||||||
|  |  | ||||||
| from django.urls import reverse | from django.urls import reverse | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Test providers API""" | """Test providers API""" | ||||||
|  |  | ||||||
| from django.urls import reverse | from django.urls import reverse | ||||||
| from rest_framework.test import APITestCase | from rest_framework.test import APITestCase | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Test Source flow_manager""" | """Test Source flow_manager""" | ||||||
|  |  | ||||||
| from django.contrib.auth.models import AnonymousUser | from django.contrib.auth.models import AnonymousUser | ||||||
| from django.test import TestCase | from django.test import TestCase | ||||||
| from guardian.utils import get_anonymous_user | from guardian.utils import get_anonymous_user | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| """Test tasks""" | """Test tasks""" | ||||||
|  |  | ||||||
| from time import mktime | from time import mktime | ||||||
|  |  | ||||||
| from django.utils.timezone import now | from django.utils.timezone import now | ||||||
|  | |||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user
	 Jens L
					Jens L