chore: format files using isort (pre-commit)
This commit is contained in:
parent
20ed5f0d52
commit
cff619679b
|
@ -4,8 +4,8 @@ from rest_framework.urlpatterns import format_suffix_patterns
|
|||
|
||||
from funkwhale_api.activity import views as activity_views
|
||||
from funkwhale_api.audio import views as audio_views
|
||||
from funkwhale_api.common import views as common_views
|
||||
from funkwhale_api.common import routers as common_routers
|
||||
from funkwhale_api.common import views as common_views
|
||||
from funkwhale_api.music import views
|
||||
from funkwhale_api.playlists import views as playlists_views
|
||||
from funkwhale_api.subsonic.views import SubsonicViewSet
|
||||
|
|
|
@ -7,7 +7,6 @@ import sys
|
|||
import persisting_theory
|
||||
from django.core.cache import cache
|
||||
from django.db.models import Q
|
||||
|
||||
from rest_framework import serializers
|
||||
|
||||
logger = logging.getLogger("plugins")
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from channels.auth import AuthMiddlewareStack
|
||||
from channels.routing import ProtocolTypeRouter, URLRouter
|
||||
|
||||
from django.conf.urls import url
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
from funkwhale_api.instance import consumers
|
||||
|
||||
application = ProtocolTypeRouter(
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import os
|
||||
|
||||
from drf_spectacular.contrib.django_oauth_toolkit import OpenApiAuthenticationExtension
|
||||
from drf_spectacular.plumbing import build_bearer_security_scheme_object
|
||||
import os
|
||||
|
||||
|
||||
class CustomOAuthExt(OpenApiAuthenticationExtension):
|
||||
|
@ -8,9 +9,8 @@ class CustomOAuthExt(OpenApiAuthenticationExtension):
|
|||
name = "oauth2"
|
||||
|
||||
def get_security_definition(self, auto_schema):
|
||||
from oauth2_provider.scopes import get_scopes_backend
|
||||
|
||||
from drf_spectacular.settings import spectacular_settings
|
||||
from oauth2_provider.scopes import get_scopes_backend
|
||||
|
||||
flows = {}
|
||||
for flow_type in spectacular_settings.OAUTH2_FLOWS:
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from collections import OrderedDict
|
||||
import logging.config
|
||||
import sys
|
||||
|
||||
from collections import OrderedDict
|
||||
from urllib.parse import urlsplit
|
||||
|
||||
import environ
|
||||
|
@ -21,8 +20,9 @@ LOGLEVEL = env("LOGLEVEL", default="info").upper()
|
|||
|
||||
if env("FUNKWHALE_SENTRY_DSN", default=None) is not None:
|
||||
import sentry_sdk
|
||||
from sentry_sdk.integrations.django import DjangoIntegration
|
||||
from sentry_sdk.integrations.celery import CeleryIntegration
|
||||
from sentry_sdk.integrations.django import DjangoIntegration
|
||||
|
||||
from funkwhale_api import __version__ as version
|
||||
|
||||
sentry_sdk.init(
|
||||
|
@ -686,7 +686,7 @@ if AUTH_LDAP_ENABLED:
|
|||
# This way, we don't need the dependency unless someone
|
||||
# actually enables the LDAP support
|
||||
import ldap
|
||||
from django_auth_ldap.config import LDAPSearch, LDAPSearchUnion, GroupOfNamesType
|
||||
from django_auth_ldap.config import GroupOfNamesType, LDAPSearch, LDAPSearchUnion
|
||||
|
||||
# Add LDAP to the authentication backends
|
||||
AUTHENTICATION_BACKENDS += ("django_auth_ldap.backend.LDAPBackend",)
|
||||
|
|
|
@ -8,9 +8,9 @@ Local settings
|
|||
- Add django-extensions as app
|
||||
"""
|
||||
|
||||
from .common import * # noqa
|
||||
from funkwhale_api import __version__ as funkwhale_version
|
||||
|
||||
from .common import * # noqa
|
||||
|
||||
# DEBUG
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
|
@ -3,12 +3,12 @@ from __future__ import unicode_literals
|
|||
|
||||
from django.conf import settings
|
||||
from django.conf.urls import url
|
||||
from django.urls import include, path
|
||||
from django.conf.urls.static import static
|
||||
from funkwhale_api.common import admin
|
||||
from django.urls import include, path
|
||||
from django.views import defaults as default_views
|
||||
|
||||
from config import plugins
|
||||
from funkwhale_api.common import admin
|
||||
|
||||
plugins_patterns = plugins.trigger_filter(plugins.URLS, [], enabled=True)
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@ from django.conf.urls import include, url
|
|||
|
||||
from funkwhale_api.activity import views as activity_views
|
||||
from funkwhale_api.audio import views as audio_views
|
||||
from funkwhale_api.common import views as common_views
|
||||
from funkwhale_api.common import routers as common_routers
|
||||
from funkwhale_api.common import views as common_views
|
||||
from funkwhale_api.music import views
|
||||
from funkwhale_api.playlists import views as playlists_views
|
||||
from funkwhale_api.tags import views as tags_views
|
||||
|
|
|
@ -4,7 +4,6 @@ from funkwhale_api.audio import spa_views as audio_spa_views
|
|||
from funkwhale_api.federation import spa_views as federation_spa_views
|
||||
from funkwhale_api.music import spa_views
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
urls.re_path(
|
||||
r"^library/tracks/(?P<pk>\d+)/?$", spa_views.library_track, name="library_track"
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
from drf_spectacular.utils import extend_schema
|
||||
from rest_framework import viewsets
|
||||
from rest_framework.response import Response
|
||||
|
||||
from drf_spectacular.utils import extend_schema
|
||||
|
||||
from funkwhale_api.common.permissions import ConditionalAuthentication
|
||||
from funkwhale_api.favorites.models import TrackFavorite
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import uuid
|
|||
|
||||
import factory
|
||||
|
||||
from funkwhale_api.factories import registry, NoUpdateOnCreate
|
||||
from funkwhale_api.factories import NoUpdateOnCreate, registry
|
||||
from funkwhale_api.federation import actors
|
||||
from funkwhale_api.federation import factories as federation_factories
|
||||
from funkwhale_api.music import factories as music_factories
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from django.db.models import Q
|
||||
|
||||
import django_filters
|
||||
from django.db.models import Q
|
||||
|
||||
from funkwhale_api.common import fields
|
||||
from funkwhale_api.common import filters as common_filters
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
import uuid
|
||||
|
||||
|
||||
from django.contrib.contenttypes.fields import GenericRelation
|
||||
from django.db.models import JSONField
|
||||
from django.core.serializers.json import DjangoJSONEncoder
|
||||
from django.db import models
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
from django.db.models import JSONField
|
||||
from django.db.models.signals import post_delete
|
||||
from django.dispatch import receiver
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
|
||||
from funkwhale_api.federation import keys
|
||||
from funkwhale_api.federation import models as federation_models
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import xml.etree.ElementTree as ET
|
||||
|
||||
from rest_framework import negotiation
|
||||
from rest_framework import renderers
|
||||
from rest_framework import negotiation, renderers
|
||||
|
||||
from funkwhale_api.subsonic.renderers import dict_to_xml_tree
|
||||
|
||||
|
|
|
@ -3,42 +3,35 @@ import logging
|
|||
import time
|
||||
import uuid
|
||||
|
||||
import feedparser
|
||||
import pytz
|
||||
import requests
|
||||
from django.conf import settings
|
||||
from django.db import transaction
|
||||
from django.db.models import Q
|
||||
from django.utils import timezone
|
||||
|
||||
import feedparser
|
||||
import requests
|
||||
import pytz
|
||||
|
||||
from rest_framework import serializers
|
||||
|
||||
from django.templatetags.static import static
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
from drf_spectacular.types import OpenApiTypes
|
||||
from drf_spectacular.utils import extend_schema_field
|
||||
from rest_framework import serializers
|
||||
|
||||
from funkwhale_api.common import locales, preferences
|
||||
from funkwhale_api.common import serializers as common_serializers
|
||||
from funkwhale_api.common import utils as common_utils
|
||||
from funkwhale_api.common import locales
|
||||
from funkwhale_api.common import preferences
|
||||
from funkwhale_api.common import session
|
||||
from funkwhale_api.common import utils as common_utils
|
||||
from funkwhale_api.federation import actors
|
||||
from funkwhale_api.federation import models as federation_models
|
||||
from funkwhale_api.federation import serializers as federation_serializers
|
||||
from funkwhale_api.federation import utils as federation_utils
|
||||
from funkwhale_api.moderation import mrf
|
||||
from funkwhale_api.music import models as music_models
|
||||
from funkwhale_api.music.serializers import SimpleArtistSerializer, COVER_WRITE_FIELD
|
||||
from funkwhale_api.music.serializers import COVER_WRITE_FIELD, SimpleArtistSerializer
|
||||
from funkwhale_api.tags import models as tags_models
|
||||
from funkwhale_api.tags import serializers as tags_serializers
|
||||
from funkwhale_api.users import serializers as users_serializers
|
||||
|
||||
from drf_spectacular.utils import extend_schema_field
|
||||
from drf_spectacular.types import OpenApiTypes
|
||||
|
||||
from . import categories
|
||||
from . import models
|
||||
|
||||
from . import categories, models
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -3,12 +3,9 @@ import urllib.parse
|
|||
from django.conf import settings
|
||||
from django.db.models import Q
|
||||
from django.urls import reverse
|
||||
|
||||
from rest_framework import serializers
|
||||
|
||||
from funkwhale_api.common import preferences
|
||||
from funkwhale_api.common import middleware
|
||||
from funkwhale_api.common import utils
|
||||
from funkwhale_api.common import middleware, preferences, utils
|
||||
from funkwhale_api.federation import utils as federation_utils
|
||||
from funkwhale_api.music import spa_views
|
||||
|
||||
|
|
|
@ -7,8 +7,7 @@ from django.utils import timezone
|
|||
|
||||
from funkwhale_api.taskapp import celery
|
||||
|
||||
from . import models
|
||||
from . import serializers
|
||||
from . import models, serializers
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,20 +1,13 @@
|
|||
from rest_framework import decorators
|
||||
from rest_framework import exceptions
|
||||
from rest_framework import mixins
|
||||
from rest_framework import permissions as rest_permissions
|
||||
from rest_framework import response
|
||||
from rest_framework import viewsets
|
||||
|
||||
from drf_spectacular.utils import extend_schema, extend_schema_view
|
||||
|
||||
from django import http
|
||||
from django.db import transaction
|
||||
from django.db.models import Count, Prefetch, Q, Sum
|
||||
from django.utils import timezone
|
||||
from drf_spectacular.utils import extend_schema, extend_schema_view
|
||||
from rest_framework import decorators, exceptions, mixins
|
||||
from rest_framework import permissions as rest_permissions
|
||||
from rest_framework import response, viewsets
|
||||
|
||||
from funkwhale_api.common import locales
|
||||
from funkwhale_api.common import permissions
|
||||
from funkwhale_api.common import preferences
|
||||
from funkwhale_api.common import locales, permissions, preferences
|
||||
from funkwhale_api.common import utils as common_utils
|
||||
from funkwhale_api.common.mixins import MultipleLookupDetailMixin
|
||||
from funkwhale_api.federation import actors
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import click
|
||||
import functools
|
||||
|
||||
import click
|
||||
|
||||
|
||||
@click.group()
|
||||
def cli():
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import click
|
||||
import sys
|
||||
|
||||
from . import base
|
||||
import click
|
||||
from rest_framework.exceptions import ValidationError
|
||||
|
||||
from . import library # noqa
|
||||
from . import media # noqa
|
||||
from . import plugins # noqa
|
||||
from . import users # noqa
|
||||
|
||||
from rest_framework.exceptions import ValidationError
|
||||
from . import base
|
||||
|
||||
|
||||
def invoke():
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
import click
|
||||
|
||||
from django.core.cache import cache
|
||||
from django.conf import settings
|
||||
from django.core.cache import cache
|
||||
from django.core.files.storage import default_storage
|
||||
|
||||
from versatileimagefield.image_warmer import VersatileImageFieldWarmer
|
||||
from versatileimagefield import settings as vif_settings
|
||||
from versatileimagefield.image_warmer import VersatileImageFieldWarmer
|
||||
|
||||
from funkwhale_api.common import utils as common_utils
|
||||
from funkwhale_api.common.models import Attachment
|
||||
|
|
|
@ -5,7 +5,6 @@ import sys
|
|||
import click
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
from . import base
|
||||
|
||||
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
import click
|
||||
|
||||
from django.db import transaction
|
||||
|
||||
from funkwhale_api.federation import models as federation_models
|
||||
from funkwhale_api.users import models
|
||||
from funkwhale_api.users import serializers
|
||||
from funkwhale_api.users import tasks
|
||||
from funkwhale_api.users import models, serializers, tasks
|
||||
|
||||
from . import base
|
||||
from . import utils
|
||||
from . import base, utils
|
||||
|
||||
|
||||
class FakeRequest(object):
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
from django.contrib.admin import register as initial_register, site, ModelAdmin # noqa
|
||||
from django.contrib.admin import site # noqa: F401
|
||||
from django.contrib.admin import ModelAdmin
|
||||
from django.contrib.admin import register as initial_register
|
||||
from django.db.models.fields.related import RelatedField
|
||||
|
||||
from . import models
|
||||
from . import tasks
|
||||
from . import models, tasks
|
||||
|
||||
|
||||
def register(model):
|
||||
|
|
|
@ -3,8 +3,7 @@ from django.conf import settings
|
|||
|
||||
from config import plugins
|
||||
|
||||
from . import mutations
|
||||
from . import utils
|
||||
from . import mutations, utils
|
||||
|
||||
|
||||
class CommonConfig(AppConfig):
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
from django.utils.translation import ugettext as _
|
||||
|
||||
from django.core.cache import cache
|
||||
|
||||
from allauth.account.utils import send_email_confirmation
|
||||
from django.core.cache import cache
|
||||
from django.utils.translation import ugettext as _
|
||||
from oauth2_provider.contrib.rest_framework.authentication import (
|
||||
OAuth2Authentication as BaseOAuth2Authentication,
|
||||
)
|
||||
|
|
|
@ -1,19 +1,10 @@
|
|||
from django.db import transaction
|
||||
from drf_spectacular.utils import OpenApiParameter, extend_schema
|
||||
from rest_framework import decorators, exceptions, response, status
|
||||
|
||||
from rest_framework import decorators
|
||||
from rest_framework import exceptions
|
||||
from rest_framework import response
|
||||
from rest_framework import status
|
||||
|
||||
from drf_spectacular.utils import extend_schema, OpenApiParameter
|
||||
|
||||
from . import filters
|
||||
from . import models
|
||||
from . import filters, models
|
||||
from . import mutations as common_mutations
|
||||
from . import serializers
|
||||
from . import signals
|
||||
from . import tasks
|
||||
from . import utils
|
||||
from . import serializers, signals, tasks, utils
|
||||
|
||||
|
||||
def action_route(serializer_class):
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import factory
|
||||
|
||||
from funkwhale_api.factories import registry, NoUpdateOnCreate
|
||||
|
||||
from funkwhale_api.factories import NoUpdateOnCreate, registry
|
||||
from funkwhale_api.federation import factories as federation_factories
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ import django_filters
|
|||
from django import forms
|
||||
from django.core.serializers.json import DjangoJSONEncoder
|
||||
from django.db import models
|
||||
|
||||
from rest_framework import serializers
|
||||
|
||||
from . import search
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
from django import forms
|
||||
from django.db.models import Q
|
||||
|
||||
from django_filters import rest_framework as filters
|
||||
from django_filters import widgets
|
||||
from drf_spectacular.utils import extend_schema_field
|
||||
|
||||
from django_filters import widgets
|
||||
from django_filters import rest_framework as filters
|
||||
|
||||
from . import fields
|
||||
from . import models
|
||||
from . import search
|
||||
from . import utils
|
||||
from . import fields, models, search, utils
|
||||
|
||||
|
||||
class NoneObject(object):
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
from django.core.management.commands.migrate import Command as BaseCommand
|
||||
import os
|
||||
|
||||
import debugpy
|
||||
import uvicorn
|
||||
from django.core.management import call_command
|
||||
from django.core.management.commands.migrate import Command as BaseCommand
|
||||
|
||||
from funkwhale_api.common import preferences
|
||||
from funkwhale_api.music.models import Library
|
||||
from funkwhale_api.users.models import User
|
||||
from funkwhale_api.common import preferences
|
||||
import uvicorn
|
||||
import debugpy
|
||||
import os
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
|
|
@ -5,14 +5,12 @@ from django.conf import settings
|
|||
from django.core.management.base import BaseCommand
|
||||
from django.db import transaction
|
||||
|
||||
|
||||
from funkwhale_api.federation import keys
|
||||
from funkwhale_api.federation import models as federation_models
|
||||
from funkwhale_api.music import models as music_models
|
||||
from funkwhale_api.tags import models as tags_models
|
||||
from funkwhale_api.users import models as users_models
|
||||
|
||||
|
||||
BATCH_SIZE = 500
|
||||
|
||||
|
||||
|
@ -238,6 +236,7 @@ class Command(BaseCommand):
|
|||
|
||||
def handle(self, *args, **options):
|
||||
from django.apps import apps
|
||||
|
||||
from funkwhale_api import factories
|
||||
|
||||
app_names = [app.name for app in apps.app_configs.values()]
|
||||
|
|
|
@ -1,27 +1,23 @@
|
|||
import html
|
||||
import logging
|
||||
import io
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import time
|
||||
import tracemalloc
|
||||
import urllib.parse
|
||||
import xml.sax.saxutils
|
||||
|
||||
from django import http
|
||||
from django import http, urls
|
||||
from django.conf import settings
|
||||
from django.contrib import auth
|
||||
from django.core.cache import caches
|
||||
from django.middleware import csrf
|
||||
from django.contrib import auth
|
||||
from django import urls
|
||||
from rest_framework import views
|
||||
import tracemalloc
|
||||
|
||||
from funkwhale_api.federation import utils as federation_utils
|
||||
|
||||
from . import preferences
|
||||
from . import session
|
||||
from . import throttling
|
||||
from . import utils
|
||||
from . import preferences, session, throttling, utils
|
||||
|
||||
EXCLUDED_PATHS = ["/api", "/federation", "/.well-known"]
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from rest_framework import serializers
|
||||
|
||||
from django.db.models import Q
|
||||
from django.shortcuts import get_object_or_404
|
||||
from rest_framework import serializers
|
||||
|
||||
|
||||
class MultipleLookupDetailMixin(object):
|
||||
|
|
|
@ -1,28 +1,24 @@
|
|||
import uuid
|
||||
import magic
|
||||
import mimetypes
|
||||
import uuid
|
||||
|
||||
from django.db.models import JSONField
|
||||
import magic
|
||||
from django.conf import settings
|
||||
from django.contrib.contenttypes.fields import GenericForeignKey
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.conf import settings
|
||||
from django.core.serializers.json import DjangoJSONEncoder
|
||||
from django.db import connections, models, transaction
|
||||
from django.db.models import Lookup
|
||||
from django.db.models import JSONField, Lookup
|
||||
from django.db.models.fields import Field
|
||||
from django.db.models.sql.compiler import SQLCompiler
|
||||
from django.dispatch import receiver
|
||||
from django.utils import timezone
|
||||
from django.urls import reverse
|
||||
|
||||
from django.utils import timezone
|
||||
from versatileimagefield.fields import VersatileImageField
|
||||
from versatileimagefield.image_warmer import VersatileImageFieldWarmer
|
||||
|
||||
from funkwhale_api.federation import utils as federation_utils
|
||||
|
||||
from . import utils
|
||||
from . import validators
|
||||
|
||||
from . import utils, validators
|
||||
|
||||
CONTENT_TEXT_MAX_LENGTH = 5000
|
||||
CONTENT_TEXT_SUPPORTED_TYPES = [
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import persisting_theory
|
||||
|
||||
from rest_framework import serializers
|
||||
|
||||
from django.db import models, transaction
|
||||
from rest_framework import serializers
|
||||
|
||||
|
||||
class ConfNotFound(KeyError):
|
||||
|
|
|
@ -2,7 +2,6 @@ import operator
|
|||
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.http import Http404
|
||||
|
||||
from rest_framework.permissions import BasePermission
|
||||
|
||||
from funkwhale_api.common import preferences
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import json
|
||||
|
||||
from django import forms
|
||||
from django.contrib.postgres.forms import JSONField
|
||||
from django.conf import settings
|
||||
from django.contrib.postgres.forms import JSONField
|
||||
from dynamic_preferences import serializers, types
|
||||
from dynamic_preferences.registries import global_preferences_registry
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
from . import create_actors
|
||||
from . import django_permissions_to_user_permissions
|
||||
from . import migrate_to_user_libraries
|
||||
from . import delete_pre_017_federated_uploads
|
||||
from . import test
|
||||
|
||||
from . import (
|
||||
create_actors,
|
||||
delete_pre_017_federated_uploads,
|
||||
django_permissions_to_user_permissions,
|
||||
migrate_to_user_libraries,
|
||||
test,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"create_actors",
|
||||
|
|
|
@ -6,7 +6,6 @@ from versatileimagefield.image_warmer import VersatileImageFieldWarmer
|
|||
|
||||
from funkwhale_api.common.models import Attachment
|
||||
|
||||
|
||||
MODELS = [
|
||||
(Attachment, "file", "attachment_square"),
|
||||
]
|
||||
|
|
|
@ -12,12 +12,12 @@ This command will also generate federation ids for existing resources.
|
|||
"""
|
||||
|
||||
from django.conf import settings
|
||||
from django.db.models import functions, CharField, F, Value
|
||||
from django.db.models import CharField, F, Value, functions
|
||||
|
||||
from funkwhale_api.common import preferences
|
||||
from funkwhale_api.federation import models as federation_models
|
||||
from funkwhale_api.music import models
|
||||
from funkwhale_api.users.models import User
|
||||
from funkwhale_api.federation import models as federation_models
|
||||
from funkwhale_api.common import preferences
|
||||
|
||||
|
||||
def create_libraries(open_api, stdout):
|
||||
|
|
|
@ -5,7 +5,6 @@ from django.db.models import Q
|
|||
|
||||
from . import utils
|
||||
|
||||
|
||||
QUERY_REGEX = re.compile(r'(((?P<key>\w+):)?(?P<value>"[^"]+"|[\S]+))')
|
||||
|
||||
|
||||
|
|
|
@ -1,20 +1,17 @@
|
|||
import collections
|
||||
import io
|
||||
import PIL
|
||||
import os
|
||||
|
||||
from rest_framework import serializers
|
||||
|
||||
import PIL
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||
from django.utils.encoding import smart_text
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from drf_spectacular.utils import extend_schema_field
|
||||
from drf_spectacular.types import OpenApiTypes
|
||||
from drf_spectacular.utils import extend_schema_field
|
||||
from rest_framework import serializers
|
||||
|
||||
from . import models
|
||||
from . import utils
|
||||
from . import models, utils
|
||||
|
||||
|
||||
class RelatedField(serializers.RelatedField):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import os
|
||||
import shutil
|
||||
import slugify
|
||||
|
||||
import slugify
|
||||
from django.core.files.storage import FileSystemStorage
|
||||
from storages.backends.s3boto3 import S3Boto3Storage
|
||||
|
||||
|
|
|
@ -11,10 +11,7 @@ from django.utils import timezone
|
|||
from funkwhale_api.common import channels
|
||||
from funkwhale_api.taskapp import celery
|
||||
|
||||
from . import models
|
||||
from . import serializers
|
||||
from . import session
|
||||
from . import signals
|
||||
from . import models, serializers, session, signals
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import collections
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.cache import cache
|
||||
from rest_framework import throttling as rest_throttling
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
def get_ident(user, request):
|
||||
if user and user.is_authenticated:
|
||||
|
|
|
@ -1,24 +1,21 @@
|
|||
import datetime
|
||||
import hashlib
|
||||
|
||||
from django.core.files.base import ContentFile
|
||||
from django.http import request
|
||||
from django.utils.deconstruct import deconstructible
|
||||
|
||||
import bleach.sanitizer
|
||||
import logging
|
||||
import markdown
|
||||
import os
|
||||
import shutil
|
||||
import uuid
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
from urllib.parse import parse_qs, urlencode, urlsplit, urlunsplit
|
||||
|
||||
from django.conf import settings
|
||||
import bleach.sanitizer
|
||||
import markdown
|
||||
from django import urls
|
||||
from django.conf import settings
|
||||
from django.core.files.base import ContentFile
|
||||
from django.db import models, transaction
|
||||
from django.http import request
|
||||
from django.utils import timezone
|
||||
from django.utils.deconstruct import deconstructible
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -379,8 +376,7 @@ def attach_content(obj, field, content_data):
|
|||
|
||||
@transaction.atomic
|
||||
def attach_file(obj, field, file_data, fetch=False):
|
||||
from . import models
|
||||
from . import tasks
|
||||
from . import models, tasks
|
||||
|
||||
existing = getattr(obj, "{}_id".format(field))
|
||||
if existing:
|
||||
|
|
|
@ -3,36 +3,26 @@ import time
|
|||
|
||||
from django.conf import settings
|
||||
from django.db import transaction
|
||||
|
||||
from rest_framework.decorators import action
|
||||
from rest_framework import exceptions
|
||||
from rest_framework import mixins
|
||||
from rest_framework import permissions
|
||||
from rest_framework import response
|
||||
from rest_framework import views
|
||||
from rest_framework import viewsets
|
||||
from rest_framework import generics
|
||||
|
||||
from drf_spectacular.utils import extend_schema
|
||||
from rest_framework import (
|
||||
exceptions,
|
||||
generics,
|
||||
mixins,
|
||||
permissions,
|
||||
response,
|
||||
views,
|
||||
viewsets,
|
||||
)
|
||||
from rest_framework.decorators import action
|
||||
|
||||
from config import plugins
|
||||
|
||||
from funkwhale_api.users.oauth import permissions as oauth_permissions
|
||||
|
||||
from funkwhale_api.common.serializers import (
|
||||
ErrorDetailSerializer,
|
||||
TextPreviewSerializer,
|
||||
)
|
||||
from funkwhale_api.users.oauth import permissions as oauth_permissions
|
||||
|
||||
from . import filters
|
||||
from . import models
|
||||
from . import mutations
|
||||
from . import serializers
|
||||
from . import signals
|
||||
from . import tasks
|
||||
from . import throttling
|
||||
from . import utils
|
||||
|
||||
from . import filters, models, mutations, serializers, signals, tasks, throttling, utils
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
from config import plugins
|
||||
import funkwhale_api
|
||||
from .funkwhale_startup import PLUGIN
|
||||
from config import plugins
|
||||
|
||||
from .client import ListenBrainzClient, Track
|
||||
from .funkwhale_startup import PLUGIN
|
||||
|
||||
|
||||
@plugins.register_hook(plugins.LISTENING_CREATED, PLUGIN)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from config import plugins
|
||||
|
||||
|
||||
PLUGIN = plugins.get_plugin_config(
|
||||
name="listenbrainz",
|
||||
label="ListenBrainz",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import json
|
||||
|
||||
from config import plugins
|
||||
|
||||
from .funkwhale_startup import PLUGIN
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import hashlib
|
||||
|
||||
from config import plugins
|
||||
from .funkwhale_startup import PLUGIN
|
||||
|
||||
from . import scrobbler
|
||||
from .funkwhale_startup import PLUGIN
|
||||
|
||||
# https://listenbrainz.org/lastfm-proxy
|
||||
DEFAULT_SCROBBLER_URL = "http://post.audioscrobbler.com"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import hashlib
|
||||
import time
|
||||
|
||||
|
||||
# https://github.com/jlieth/legacy-scrobbler
|
||||
from .funkwhale_startup import PLUGIN
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import uuid
|
||||
import factory
|
||||
import random
|
||||
import uuid
|
||||
|
||||
import factory
|
||||
import persisting_theory
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from faker.providers import internet as internet_provider
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import factory
|
||||
|
||||
from funkwhale_api.factories import registry, NoUpdateOnCreate
|
||||
from funkwhale_api.factories import NoUpdateOnCreate, registry
|
||||
from funkwhale_api.music.factories import TrackFactory
|
||||
from funkwhale_api.users.factories import UserFactory
|
||||
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
from drf_spectacular.utils import extend_schema_field
|
||||
from rest_framework import serializers
|
||||
|
||||
from funkwhale_api.activity import serializers as activity_serializers
|
||||
from funkwhale_api.federation import serializers as federation_serializers
|
||||
from funkwhale_api.music.serializers import (
|
||||
TrackActivitySerializer,
|
||||
TrackSerializer,
|
||||
)
|
||||
from funkwhale_api.music.serializers import TrackActivitySerializer, TrackSerializer
|
||||
from funkwhale_api.users.serializers import UserActivitySerializer, UserBasicSerializer
|
||||
|
||||
from drf_spectacular.utils import extend_schema_field
|
||||
|
||||
from . import models
|
||||
|
||||
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
from django.db.models import Prefetch
|
||||
from drf_spectacular.utils import extend_schema
|
||||
from rest_framework import mixins, status, viewsets
|
||||
from rest_framework.decorators import action
|
||||
from rest_framework.response import Response
|
||||
|
||||
from drf_spectacular.utils import extend_schema
|
||||
|
||||
from django.db.models import Prefetch
|
||||
|
||||
from funkwhale_api.activity import record
|
||||
from funkwhale_api.common import fields, permissions
|
||||
from funkwhale_api.music.models import Track
|
||||
from funkwhale_api.music import utils as music_utils
|
||||
from funkwhale_api.music.models import Track
|
||||
from funkwhale_api.users.oauth import permissions as oauth_permissions
|
||||
|
||||
from . import filters, models, serializers
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import uuid
|
||||
import logging
|
||||
import urllib.parse
|
||||
import uuid
|
||||
|
||||
from django.core.cache import cache
|
||||
from django.conf import settings
|
||||
from django.db import transaction, IntegrityError
|
||||
from django.core.cache import cache
|
||||
from django.db import IntegrityError, transaction
|
||||
from django.db.models import Q
|
||||
|
||||
from funkwhale_api.common import channels
|
||||
|
@ -119,12 +119,11 @@ def should_reject(fid, actor_id=None, payload={}):
|
|||
|
||||
@transaction.atomic
|
||||
def receive(activity, on_behalf_of, inbox_actor=None):
|
||||
from . import models
|
||||
from . import serializers
|
||||
from . import tasks
|
||||
from .routes import inbox
|
||||
from funkwhale_api.moderation import mrf
|
||||
|
||||
from . import models, serializers, tasks
|
||||
from .routes import inbox
|
||||
|
||||
logger.debug(
|
||||
"[federation] Received activity from %s : %s", on_behalf_of.fid, activity
|
||||
)
|
||||
|
@ -223,8 +222,7 @@ class InboxRouter(Router):
|
|||
call_handlers should be False when are delivering a local activity, because
|
||||
we want only want to bind activities to their recipients, not reapply the changes.
|
||||
"""
|
||||
from . import api_serializers
|
||||
from . import models
|
||||
from . import api_serializers, models
|
||||
|
||||
handlers = self.get_matching_handlers(payload)
|
||||
for handler in handlers:
|
||||
|
@ -305,8 +303,8 @@ class OutboxRouter(Router):
|
|||
for further delivery.
|
||||
"""
|
||||
from funkwhale_api.common import preferences
|
||||
from . import models
|
||||
from . import tasks
|
||||
|
||||
from . import models, tasks
|
||||
|
||||
allow_list_enabled = preferences.get("moderation__allow_list_enabled")
|
||||
allowed_domains = None
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from funkwhale_api.common import admin
|
||||
|
||||
from . import models
|
||||
from . import tasks
|
||||
from . import models, tasks
|
||||
|
||||
|
||||
def redeliver_deliveries(modeladmin, request, queryset):
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import datetime
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.core import validators
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.utils import timezone
|
||||
|
||||
from drf_spectacular.types import OpenApiTypes
|
||||
from drf_spectacular.utils import extend_schema_field
|
||||
from rest_framework import serializers
|
||||
|
||||
from funkwhale_api.audio import models as audio_models
|
||||
|
@ -13,11 +14,7 @@ from funkwhale_api.common import serializers as common_serializers
|
|||
from funkwhale_api.music import models as music_models
|
||||
from funkwhale_api.users import serializers as users_serializers
|
||||
|
||||
from drf_spectacular.utils import extend_schema_field
|
||||
from drf_spectacular.types import OpenApiTypes
|
||||
|
||||
from . import filters
|
||||
from . import models
|
||||
from . import filters, models
|
||||
from . import serializers as federation_serializers
|
||||
|
||||
|
||||
|
|
|
@ -1,34 +1,29 @@
|
|||
import requests.exceptions
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import transaction
|
||||
from django.db.models import Count, Q
|
||||
|
||||
from rest_framework import decorators
|
||||
from rest_framework import mixins
|
||||
from rest_framework import permissions
|
||||
from rest_framework import response
|
||||
from rest_framework import viewsets
|
||||
|
||||
from drf_spectacular.utils import extend_schema, extend_schema_view
|
||||
from rest_framework import decorators, mixins, permissions, response, viewsets
|
||||
|
||||
from funkwhale_api.common import preferences
|
||||
from funkwhale_api.common import utils as common_utils
|
||||
from funkwhale_api.common.permissions import ConditionalAuthentication
|
||||
from funkwhale_api.music import models as music_models
|
||||
from funkwhale_api.music import views as music_views
|
||||
from funkwhale_api.music import serializers as music_serializers
|
||||
from funkwhale_api.music import views as music_views
|
||||
from funkwhale_api.users.oauth import permissions as oauth_permissions
|
||||
|
||||
from . import activity
|
||||
from . import api_serializers
|
||||
from . import exceptions
|
||||
from . import filters
|
||||
from . import models
|
||||
from . import routes
|
||||
from . import serializers
|
||||
from . import tasks
|
||||
from . import utils
|
||||
from . import (
|
||||
activity,
|
||||
api_serializers,
|
||||
exceptions,
|
||||
filters,
|
||||
models,
|
||||
routes,
|
||||
serializers,
|
||||
tasks,
|
||||
utils,
|
||||
)
|
||||
|
||||
|
||||
@transaction.atomic
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
import cryptography
|
||||
import logging
|
||||
import datetime
|
||||
import logging
|
||||
import urllib.parse
|
||||
|
||||
import cryptography
|
||||
from django.contrib.auth.models import AnonymousUser
|
||||
from django.utils import timezone
|
||||
from rest_framework import authentication
|
||||
from rest_framework import exceptions as rest_exceptions
|
||||
|
||||
from rest_framework import authentication, exceptions as rest_exceptions
|
||||
from funkwhale_api.common import preferences
|
||||
from funkwhale_api.moderation import models as moderation_models
|
||||
from . import actors, exceptions, keys, models, signing, tasks, utils
|
||||
|
||||
from . import actors, exceptions, keys, models, signing, tasks, utils
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,19 +1,10 @@
|
|||
from django.db import transaction
|
||||
|
||||
from rest_framework import decorators
|
||||
from rest_framework import permissions
|
||||
from rest_framework import response
|
||||
from rest_framework import status
|
||||
|
||||
from drf_spectacular.utils import extend_schema, OpenApiParameter
|
||||
from drf_spectacular.utils import OpenApiParameter, extend_schema
|
||||
from rest_framework import decorators, permissions, response, status
|
||||
|
||||
from funkwhale_api.common import utils as common_utils
|
||||
|
||||
from . import api_serializers
|
||||
from . import filters
|
||||
from . import models
|
||||
from . import tasks
|
||||
from . import utils
|
||||
from . import api_serializers, filters, models, tasks, utils
|
||||
|
||||
|
||||
def fetches_route():
|
||||
|
|
|
@ -7,7 +7,7 @@ from django.conf import settings
|
|||
from django.utils import timezone
|
||||
from django.utils.http import http_date
|
||||
|
||||
from funkwhale_api.factories import registry, NoUpdateOnCreate
|
||||
from funkwhale_api.factories import NoUpdateOnCreate, registry
|
||||
from funkwhale_api.users import factories as user_factories
|
||||
|
||||
from . import keys, models
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import django_filters
|
||||
|
||||
from rest_framework import serializers
|
||||
|
||||
from . import models
|
||||
from . import utils
|
||||
from . import models, utils
|
||||
|
||||
|
||||
class ActorRelatedField(serializers.EmailField):
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
import aiohttp
|
||||
import asyncio
|
||||
import functools
|
||||
|
||||
import aiohttp
|
||||
import pyld.documentloader.requests
|
||||
import pyld.jsonld
|
||||
from django.conf import settings
|
||||
import pyld.documentloader.requests
|
||||
from rest_framework import serializers
|
||||
from rest_framework.fields import empty
|
||||
|
||||
from . import contexts
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import re
|
||||
import urllib.parse
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from cryptography.hazmat.backends import default_backend as crypto_default_backend
|
||||
from cryptography.hazmat.primitives import serialization as crypto_serialization
|
||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
||||
from django.conf import settings
|
||||
|
||||
KEY_ID_REGEX = re.compile(r"keyId=\"(?P<id>.*)\"")
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ from funkwhale_api.common import utils
|
|||
from funkwhale_api.federation import models as federation_models
|
||||
from funkwhale_api.music import models as music_models
|
||||
|
||||
|
||||
MODELS = [
|
||||
(music_models.Artist, ["fid"]),
|
||||
(music_models.Album, ["fid"]),
|
||||
|
|
|
@ -3,16 +3,16 @@ import urllib.parse
|
|||
import uuid
|
||||
|
||||
from django.conf import settings
|
||||
from django.db.models import JSONField
|
||||
from django.contrib.contenttypes.fields import GenericForeignKey
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.core.serializers.json import DjangoJSONEncoder
|
||||
from django.db import models
|
||||
from django.db.models.signals import post_save, pre_save, post_delete
|
||||
from django.db.models import JSONField
|
||||
from django.db.models.signals import post_delete, post_save, pre_save
|
||||
from django.dispatch import receiver
|
||||
from django.utils import timezone
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
|
||||
from funkwhale_api.common import session
|
||||
from funkwhale_api.common import utils as common_utils
|
||||
|
@ -283,8 +283,8 @@ class Actor(models.Model):
|
|||
return data
|
||||
|
||||
def get_stats(self):
|
||||
from funkwhale_api.music import models as music_models
|
||||
from funkwhale_api.moderation import models as moderation_models
|
||||
from funkwhale_api.music import models as music_models
|
||||
|
||||
data = Actor.objects.filter(pk=self.pk).aggregate(
|
||||
outbox_activities=models.Count("outbox_activities", distinct=True),
|
||||
|
@ -389,8 +389,7 @@ class Fetch(models.Model):
|
|||
|
||||
@property
|
||||
def serializers(self):
|
||||
from . import contexts
|
||||
from . import serializers
|
||||
from . import contexts, serializers
|
||||
|
||||
return {
|
||||
contexts.FW.Artist: [serializers.ArtistSerializer],
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from funkwhale_api.moderation import mrf
|
||||
|
||||
|
||||
from . import activity
|
||||
|
||||
|
||||
|
|
|
@ -5,10 +5,7 @@ from django.db.models import Q
|
|||
|
||||
from funkwhale_api.music import models as music_models
|
||||
|
||||
from . import activity
|
||||
from . import actors
|
||||
from . import models
|
||||
from . import serializers
|
||||
from . import activity, actors, models, serializers
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
inbox = activity.InboxRouter()
|
||||
|
|
|
@ -10,8 +10,8 @@ from django.urls import reverse
|
|||
from django.utils import timezone
|
||||
from rest_framework import serializers
|
||||
|
||||
from funkwhale_api.common import utils as common_utils
|
||||
from funkwhale_api.common import models as common_models
|
||||
from funkwhale_api.common import utils as common_utils
|
||||
from funkwhale_api.moderation import models as moderation_models
|
||||
from funkwhale_api.moderation import serializers as moderation_serializers
|
||||
from funkwhale_api.moderation import signals as moderation_signals
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
import cryptography.exceptions
|
||||
import datetime
|
||||
import logging
|
||||
import pytz
|
||||
|
||||
import cryptography.exceptions
|
||||
import pytz
|
||||
import requests
|
||||
import requests_http_message_signatures
|
||||
from django import forms
|
||||
from django.utils import timezone
|
||||
from django.utils.http import parse_http_date
|
||||
|
||||
import requests
|
||||
import requests_http_message_signatures
|
||||
|
||||
from . import exceptions, utils
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
from django.conf import settings
|
||||
|
||||
from rest_framework import serializers
|
||||
|
||||
from funkwhale_api.common import preferences
|
||||
from funkwhale_api.common import middleware
|
||||
from funkwhale_api.common import utils
|
||||
from funkwhale_api.common import middleware, preferences, utils
|
||||
from funkwhale_api.federation import utils as federation_utils
|
||||
|
||||
from . import models
|
||||
|
|
|
@ -2,35 +2,37 @@ import datetime
|
|||
import json
|
||||
import logging
|
||||
import os
|
||||
import requests
|
||||
|
||||
import requests
|
||||
from django.conf import settings
|
||||
from django.db import transaction
|
||||
from django.db.models import Q, F
|
||||
from django.db.models import F, Q
|
||||
from django.db.models.deletion import Collector
|
||||
from django.utils import timezone
|
||||
from dynamic_preferences.registries import global_preferences_registry
|
||||
from requests.exceptions import RequestException
|
||||
|
||||
from funkwhale_api.audio import models as audio_models
|
||||
from funkwhale_api.common import preferences
|
||||
from funkwhale_api.common import models as common_models
|
||||
from funkwhale_api.common import session
|
||||
from funkwhale_api.common import preferences, session
|
||||
from funkwhale_api.common import utils as common_utils
|
||||
from funkwhale_api.moderation import mrf
|
||||
from funkwhale_api.music import models as music_models
|
||||
from funkwhale_api.taskapp import celery
|
||||
|
||||
from . import activity
|
||||
from . import actors
|
||||
from . import exceptions
|
||||
from . import jsonld
|
||||
from . import keys
|
||||
from . import models, signing
|
||||
from . import serializers
|
||||
from . import routes
|
||||
from . import utils
|
||||
from . import webfinger
|
||||
from . import (
|
||||
activity,
|
||||
actors,
|
||||
exceptions,
|
||||
jsonld,
|
||||
keys,
|
||||
models,
|
||||
routes,
|
||||
serializers,
|
||||
signing,
|
||||
utils,
|
||||
webfinger,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import html.parser
|
||||
import re
|
||||
import unicodedata
|
||||
import urllib.parse
|
||||
import re
|
||||
|
||||
from django.apps import apps
|
||||
from django.conf import settings
|
||||
|
@ -11,8 +11,7 @@ from django.db.models import CharField, Q, Value
|
|||
from funkwhale_api.common import session
|
||||
from funkwhale_api.moderation import mrf
|
||||
|
||||
from . import exceptions
|
||||
from . import signing
|
||||
from . import exceptions, signing
|
||||
|
||||
|
||||
def full_url(path):
|
||||
|
|
|
@ -15,8 +15,8 @@ from funkwhale_api.music import models as music_models
|
|||
from funkwhale_api.music import utils as music_utils
|
||||
|
||||
from . import (
|
||||
actors,
|
||||
activity,
|
||||
actors,
|
||||
authentication,
|
||||
models,
|
||||
renderers,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import factory
|
||||
|
||||
from funkwhale_api.factories import registry, NoUpdateOnCreate
|
||||
from funkwhale_api.factories import NoUpdateOnCreate, registry
|
||||
from funkwhale_api.music import factories
|
||||
from funkwhale_api.users.factories import UserFactory
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from drf_spectacular.utils import extend_schema_field
|
||||
from rest_framework import serializers
|
||||
|
||||
from funkwhale_api.activity import serializers as activity_serializers
|
||||
|
@ -5,8 +6,6 @@ from funkwhale_api.federation import serializers as federation_serializers
|
|||
from funkwhale_api.music.serializers import TrackActivitySerializer, TrackSerializer
|
||||
from funkwhale_api.users.serializers import UserActivitySerializer, UserBasicSerializer
|
||||
|
||||
from drf_spectacular.utils import extend_schema_field
|
||||
|
||||
from . import models
|
||||
|
||||
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
from django.db.models import Prefetch
|
||||
from rest_framework import mixins, viewsets
|
||||
|
||||
from django.db.models import Prefetch
|
||||
|
||||
from config import plugins
|
||||
|
||||
from funkwhale_api.activity import record
|
||||
from funkwhale_api.common import fields, permissions
|
||||
from funkwhale_api.music.models import Track
|
||||
from funkwhale_api.music import utils as music_utils
|
||||
from . import filters, models, serializers
|
||||
|
||||
from funkwhale_api.music.models import Track
|
||||
from funkwhale_api.users.oauth import permissions as oauth_permissions
|
||||
|
||||
from . import filters, models, serializers
|
||||
|
||||
|
||||
class ListeningViewSet(
|
||||
mixins.CreateModelMixin,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from django.forms import widgets
|
||||
from django.core.validators import FileExtensionValidator
|
||||
|
||||
from django.forms import widgets
|
||||
from dynamic_preferences import types
|
||||
from dynamic_preferences.registries import global_preferences_registry
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from drf_spectacular.utils import extend_schema_field
|
||||
from rest_framework import serializers
|
||||
|
||||
from funkwhale_api.federation.utils import full_url
|
||||
from drf_spectacular.utils import extend_schema_field
|
||||
|
||||
|
||||
class SoftwareSerializer(serializers.Serializer):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from django.conf.urls import url
|
||||
|
||||
from funkwhale_api.common import routers
|
||||
|
||||
from . import views
|
||||
|
|
|
@ -1,31 +1,26 @@
|
|||
import json
|
||||
import logging
|
||||
from cache_memoize import cache_memoize
|
||||
|
||||
from cache_memoize import cache_memoize
|
||||
from django.conf import settings
|
||||
from django.urls import reverse
|
||||
|
||||
from dynamic_preferences.api.serializers import GlobalPreferenceSerializer
|
||||
from drf_spectacular.utils import extend_schema
|
||||
from dynamic_preferences.api import viewsets as preferences_viewsets
|
||||
from dynamic_preferences.api.serializers import GlobalPreferenceSerializer
|
||||
from dynamic_preferences.registries import global_preferences_registry
|
||||
from rest_framework import generics
|
||||
from rest_framework import views
|
||||
from rest_framework import generics, views
|
||||
from rest_framework.response import Response
|
||||
|
||||
from funkwhale_api import __version__ as funkwhale_version
|
||||
from funkwhale_api.common import middleware
|
||||
from funkwhale_api.common import preferences
|
||||
from funkwhale_api.common import middleware, preferences
|
||||
from funkwhale_api.common.renderers import ActivityStreamRenderer
|
||||
from funkwhale_api.federation.models import Domain
|
||||
from funkwhale_api.federation.actors import get_service_actor
|
||||
from funkwhale_api.users.oauth import permissions as oauth_permissions
|
||||
from funkwhale_api.music.utils import SUPPORTED_EXTENSIONS
|
||||
from funkwhale_api.federation.models import Domain
|
||||
from funkwhale_api.moderation.models import REPORT_TYPES
|
||||
from funkwhale_api.music.utils import SUPPORTED_EXTENSIONS
|
||||
from funkwhale_api.users.oauth import permissions as oauth_permissions
|
||||
|
||||
from drf_spectacular.utils import extend_schema
|
||||
|
||||
from . import serializers
|
||||
from . import stats
|
||||
from . import serializers, stats
|
||||
|
||||
NODEINFO_2_CONTENT_TYPE = "application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.0#; charset=utf-8" # noqa
|
||||
|
||||
|
|
|
@ -1,22 +1,20 @@
|
|||
import django_filters
|
||||
from django import forms
|
||||
from django.db.models import Q
|
||||
|
||||
import django_filters
|
||||
from django_filters import rest_framework as filters
|
||||
|
||||
from funkwhale_api.audio import models as audio_models
|
||||
from funkwhale_api.common import fields
|
||||
from funkwhale_api.common import filters as common_filters
|
||||
from funkwhale_api.common import search
|
||||
|
||||
from funkwhale_api.audio import models as audio_models
|
||||
from funkwhale_api.federation import models as federation_models
|
||||
from funkwhale_api.federation import utils as federation_utils
|
||||
from funkwhale_api.moderation import models as moderation_models
|
||||
from funkwhale_api.moderation import serializers as moderation_serializers
|
||||
from funkwhale_api.moderation import utils as moderation_utils
|
||||
from funkwhale_api.music import models as music_models
|
||||
from funkwhale_api.users import models as users_models
|
||||
from funkwhale_api.tags import models as tags_models
|
||||
from funkwhale_api.users import models as users_models
|
||||
|
||||
|
||||
class ActorField(forms.CharField):
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
from django.conf import settings
|
||||
from django.db import transaction
|
||||
|
||||
from drf_spectacular.types import OpenApiTypes
|
||||
from drf_spectacular.utils import extend_schema_field
|
||||
from rest_framework import serializers
|
||||
|
||||
from funkwhale_api.audio import models as audio_models
|
||||
from funkwhale_api.common import fields as common_fields
|
||||
from funkwhale_api.common import serializers as common_serializers
|
||||
from funkwhale_api.common import utils as common_utils
|
||||
from funkwhale_api.federation import models as federation_models
|
||||
from funkwhale_api.federation import fields as federation_fields
|
||||
from funkwhale_api.federation import models as federation_models
|
||||
from funkwhale_api.federation import tasks as federation_tasks
|
||||
from funkwhale_api.moderation import models as moderation_models
|
||||
from funkwhale_api.moderation import serializers as moderation_serializers
|
||||
|
@ -18,9 +19,6 @@ from funkwhale_api.music import serializers as music_serializers
|
|||
from funkwhale_api.tags import models as tags_models
|
||||
from funkwhale_api.users import models as users_models
|
||||
|
||||
from drf_spectacular.utils import extend_schema_field
|
||||
from drf_spectacular.types import OpenApiTypes
|
||||
|
||||
from . import filters
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from django.conf.urls import include, url
|
||||
|
||||
from funkwhale_api.common import routers
|
||||
|
||||
from . import views
|
||||
|
|
|
@ -1,32 +1,30 @@
|
|||
from rest_framework import mixins, response, viewsets
|
||||
from rest_framework import decorators as rest_decorators
|
||||
|
||||
from drf_spectacular.utils import extend_schema
|
||||
|
||||
from django.db import transaction
|
||||
from django.db.models import Count, Prefetch, Q, Sum, OuterRef, Subquery
|
||||
from django.db.models import Count, OuterRef, Prefetch, Q, Subquery, Sum
|
||||
from django.db.models.functions import Coalesce, Length
|
||||
from django.shortcuts import get_object_or_404
|
||||
from drf_spectacular.utils import extend_schema
|
||||
from rest_framework import decorators as rest_decorators
|
||||
from rest_framework import mixins, response, viewsets
|
||||
|
||||
from funkwhale_api.audio import models as audio_models
|
||||
from funkwhale_api.common.mixins import MultipleLookupDetailMixin
|
||||
from funkwhale_api.common import decorators
|
||||
from funkwhale_api.common import models as common_models
|
||||
from funkwhale_api.common import preferences, decorators
|
||||
from funkwhale_api.common import preferences
|
||||
from funkwhale_api.common import utils as common_utils
|
||||
from funkwhale_api.common.mixins import MultipleLookupDetailMixin
|
||||
from funkwhale_api.favorites import models as favorites_models
|
||||
from funkwhale_api.federation import models as federation_models
|
||||
from funkwhale_api.federation import tasks as federation_tasks
|
||||
from funkwhale_api.federation import utils as federation_utils
|
||||
from funkwhale_api.history import models as history_models
|
||||
from funkwhale_api.music import models as music_models
|
||||
from funkwhale_api.music import views as music_views
|
||||
from funkwhale_api.moderation import models as moderation_models
|
||||
from funkwhale_api.moderation import tasks as moderation_tasks
|
||||
from funkwhale_api.music import models as music_models
|
||||
from funkwhale_api.music import views as music_views
|
||||
from funkwhale_api.playlists import models as playlists_models
|
||||
from funkwhale_api.tags import models as tags_models
|
||||
from funkwhale_api.users import models as users_models
|
||||
|
||||
|
||||
from . import filters, serializers
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from dynamic_preferences import types
|
||||
from dynamic_preferences.registries import global_preferences_registry
|
||||
|
||||
from rest_framework import serializers
|
||||
|
||||
from funkwhale_api.common import preferences as common_preferences
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import factory
|
||||
|
||||
from funkwhale_api.factories import registry, NoUpdateOnCreate
|
||||
from funkwhale_api.factories import NoUpdateOnCreate, registry
|
||||
from funkwhale_api.federation import factories as federation_factories
|
||||
from funkwhale_api.music import factories as music_factories
|
||||
from funkwhale_api.users import factories as users_factories
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
from django.db.models import Q
|
||||
|
||||
from django_filters import rest_framework as filters
|
||||
|
||||
|
||||
USER_FILTER_CONFIG = {
|
||||
"ARTIST": {"target_artist": ["pk"]},
|
||||
"CHANNEL": {"target_artist": ["artist__pk"]},
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import json
|
||||
import logging
|
||||
import sys
|
||||
import uuid
|
||||
import logging
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.core import validators
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
|
||||
from funkwhale_api.common import session
|
||||
from funkwhale_api.federation import models
|
||||
|
|
|
@ -3,8 +3,8 @@ import uuid
|
|||
|
||||
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.db.models import JSONField
|
||||
from django.db import models
|
||||
from django.db.models import JSONField
|
||||
from django.db.models.signals import pre_save
|
||||
from django.dispatch import receiver
|
||||
from django.urls import reverse
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import urllib.parse
|
||||
|
||||
from funkwhale_api.common import preferences
|
||||
from funkwhale_api.common import utils
|
||||
from funkwhale_api.common import preferences, utils
|
||||
from funkwhale_api.federation import models as federation_models
|
||||
from funkwhale_api.moderation import mrf
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import json
|
||||
import urllib.parse
|
||||
|
||||
import persisting_theory
|
||||
from django.conf import settings
|
||||
from django.core.serializers.json import DjangoJSONEncoder
|
||||
import persisting_theory
|
||||
from rest_framework import serializers
|
||||
|
||||
from funkwhale_api.audio import models as audio_models
|
||||
|
@ -14,8 +14,7 @@ from funkwhale_api.federation import utils as federation_utils
|
|||
from funkwhale_api.music import models as music_models
|
||||
from funkwhale_api.playlists import models as playlists_models
|
||||
|
||||
from . import models
|
||||
from . import tasks
|
||||
from . import models, tasks
|
||||
|
||||
|
||||
class FilteredArtistSerializer(serializers.ModelSerializer):
|
||||
|
|
|
@ -1,18 +1,16 @@
|
|||
import logging
|
||||
from django.core import mail
|
||||
|
||||
from django.conf import settings
|
||||
from django.core import mail
|
||||
from django.db import transaction
|
||||
from django.dispatch import receiver
|
||||
|
||||
from funkwhale_api.common import channels
|
||||
from funkwhale_api.common import preferences
|
||||
from funkwhale_api.common import utils
|
||||
from funkwhale_api.taskapp import celery
|
||||
from funkwhale_api.common import channels, preferences, utils
|
||||
from funkwhale_api.federation import utils as federation_utils
|
||||
from funkwhale_api.taskapp import celery
|
||||
from funkwhale_api.users import models as users_models
|
||||
|
||||
from . import models
|
||||
from . import signals
|
||||
from . import models, signals
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ from funkwhale_api.federation import models as federation_models
|
|||
from . import models
|
||||
from . import serializers as moderation_serializers
|
||||
|
||||
|
||||
NOTE_TARGET_FIELDS = {
|
||||
"report": {
|
||||
"queryset": models.Report.objects.all(),
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
from django.db import IntegrityError
|
||||
|
||||
from rest_framework import mixins
|
||||
from rest_framework import response
|
||||
from rest_framework import status
|
||||
from rest_framework import viewsets
|
||||
from rest_framework import mixins, response, status, viewsets
|
||||
|
||||
from funkwhale_api.federation import routes
|
||||
from funkwhale_api.federation import utils as federation_utils
|
||||
|
||||
from . import models
|
||||
from . import serializers
|
||||
from . import models, serializers
|
||||
|
||||
|
||||
class UserFilterViewSet(
|
||||
|
|
|
@ -2,9 +2,8 @@ import os
|
|||
|
||||
import factory
|
||||
|
||||
from funkwhale_api.factories import registry, NoUpdateOnCreate
|
||||
|
||||
from funkwhale_api.common import factories as common_factories
|
||||
from funkwhale_api.factories import NoUpdateOnCreate, registry
|
||||
from funkwhale_api.federation import factories as federation_factories
|
||||
from funkwhale_api.music import licenses
|
||||
from funkwhale_api.tags import factories as tags_factories
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from django.db.models import Q
|
||||
|
||||
import django_filters
|
||||
from django.db.models import Q
|
||||
from django_filters import rest_framework as filters
|
||||
|
||||
from funkwhale_api.audio import filters as audio_filters
|
||||
|
@ -11,8 +10,7 @@ from funkwhale_api.common import search
|
|||
from funkwhale_api.moderation import filters as moderation_filters
|
||||
from funkwhale_api.tags import filters as tags_filters
|
||||
|
||||
from . import models
|
||||
from . import utils
|
||||
from . import models, utils
|
||||
|
||||
|
||||
def filter_tags(queryset, name, value):
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue