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