See #297: sorted imports
This commit is contained in:
parent
9427f8b56e
commit
9bea804f14
|
@ -4,8 +4,7 @@ from rest_framework.response import Response
|
|||
from funkwhale_api.common.permissions import ConditionalAuthentication
|
||||
from funkwhale_api.favorites.models import TrackFavorite
|
||||
|
||||
from . import serializers
|
||||
from . import utils
|
||||
from . import serializers, utils
|
||||
|
||||
|
||||
class ActivityViewSet(viewsets.GenericViewSet):
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
from urllib.parse import parse_qs
|
||||
|
||||
|
||||
from django.contrib.auth.models import AnonymousUser
|
||||
|
||||
from rest_framework import exceptions
|
||||
from rest_framework_jwt.authentication import BaseJSONWebTokenAuthentication
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from django.utils.encoding import smart_text
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from rest_framework import exceptions
|
||||
from rest_framework_jwt import authentication
|
||||
from rest_framework_jwt.settings import api_settings
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from channels.generic.websocket import JsonWebsocketConsumer
|
||||
|
||||
from funkwhale_api.common import channels
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import django_filters
|
||||
|
||||
from django.db import models
|
||||
|
||||
from funkwhale_api.music import utils
|
||||
|
||||
|
||||
PRIVACY_LEVEL_CHOICES = [
|
||||
("me", "Only me"),
|
||||
("followers", "Me and my followers"),
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import operator
|
||||
|
||||
from django.http import Http404
|
||||
|
||||
from rest_framework.permissions import BasePermission
|
||||
|
||||
from funkwhale_api.common import preferences
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
from django.conf import settings
|
||||
from django import forms
|
||||
|
||||
from dynamic_preferences import serializers
|
||||
from dynamic_preferences import types
|
||||
from django.conf import settings
|
||||
from dynamic_preferences import serializers, types
|
||||
from dynamic_preferences.registries import global_preferences_registry
|
||||
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
Convert django permissions to user permissions in the database,
|
||||
following the work done in #152.
|
||||
"""
|
||||
from django.db.models import Q
|
||||
from funkwhale_api.users import models
|
||||
|
||||
from django.contrib.auth.models import Permission
|
||||
from django.db.models import Q
|
||||
|
||||
from funkwhale_api.users import models
|
||||
|
||||
mapping = {
|
||||
"dynamic_preferences.change_globalpreferencemodel": "settings",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import requests
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
import funkwhale_api
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from urllib.parse import urlencode, parse_qs, urlsplit, urlunsplit
|
||||
import os
|
||||
import shutil
|
||||
from urllib.parse import parse_qs, urlencode, urlsplit, urlunsplit
|
||||
|
||||
from django.db import transaction
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import os
|
||||
|
||||
import youtube_dl
|
||||
from django.conf import settings
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from funkwhale_api.common import channels
|
||||
from funkwhale_api.activity import record
|
||||
from funkwhale_api.common import channels
|
||||
|
||||
from . import serializers
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import factory
|
||||
|
||||
from funkwhale_api.factories import registry
|
||||
|
||||
from funkwhale_api.music.factories import TrackFactory
|
||||
from funkwhale_api.users.factories import UserFactory
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from . import views
|
||||
|
||||
from rest_framework import routers
|
||||
|
||||
from . import views
|
||||
|
||||
router = routers.SimpleRouter()
|
||||
router.register(r"tracks", views.TrackFavoriteViewSet, "tracks")
|
||||
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
from rest_framework import mixins, viewsets
|
||||
from rest_framework import status
|
||||
from rest_framework.response import Response
|
||||
from rest_framework import mixins, status, viewsets
|
||||
from rest_framework.decorators import list_route
|
||||
from rest_framework.response import Response
|
||||
|
||||
from funkwhale_api.activity import record
|
||||
from funkwhale_api.music.models import Track
|
||||
from funkwhale_api.common.permissions import ConditionalAuthentication
|
||||
from funkwhale_api.music.models import Track
|
||||
|
||||
from . import models
|
||||
from . import serializers
|
||||
from . import models, serializers
|
||||
|
||||
|
||||
class TrackFavoriteViewSet(
|
||||
|
|
|
@ -6,22 +6,14 @@ from django.conf import settings
|
|||
from django.db import transaction
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
|
||||
from rest_framework.exceptions import PermissionDenied
|
||||
|
||||
|
||||
from funkwhale_api.common import preferences
|
||||
from funkwhale_api.common import session
|
||||
from funkwhale_api.common import preferences, session
|
||||
from funkwhale_api.common import utils as funkwhale_utils
|
||||
from funkwhale_api.music import models as music_models
|
||||
from funkwhale_api.music import tasks as music_tasks
|
||||
|
||||
from . import activity
|
||||
from . import keys
|
||||
from . import models
|
||||
from . import serializers
|
||||
from . import signing
|
||||
from . import utils
|
||||
from . import activity, keys, models, serializers, signing, utils
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,14 +1,8 @@
|
|||
import cryptography
|
||||
|
||||
from django.contrib.auth.models import AnonymousUser
|
||||
from rest_framework import authentication, exceptions
|
||||
|
||||
from rest_framework import authentication
|
||||
from rest_framework import exceptions
|
||||
|
||||
from . import actors
|
||||
from . import keys
|
||||
from . import signing
|
||||
from . import utils
|
||||
from . import actors, keys, signing, utils
|
||||
|
||||
|
||||
class SignatureAuthentication(authentication.BaseAuthentication):
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
import uuid
|
||||
|
||||
import factory
|
||||
import requests
|
||||
import requests_http_signature
|
||||
import uuid
|
||||
|
||||
from django.utils import timezone
|
||||
from django.conf import settings
|
||||
from django.utils import timezone
|
||||
|
||||
from funkwhale_api.factories import registry
|
||||
|
||||
from . import keys
|
||||
from . import models
|
||||
|
||||
from . import keys, models
|
||||
|
||||
registry.register(keys.get_key_pair, name="federation.KeyPair")
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
from cryptography.hazmat.primitives import serialization as crypto_serialization
|
||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
||||
from cryptography.hazmat.backends import default_backend as crypto_default_backend
|
||||
|
||||
import re
|
||||
import urllib.parse
|
||||
|
||||
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
|
||||
|
||||
KEY_ID_REGEX = re.compile(r"keyId=\"(?P<id>.*)\"")
|
||||
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
import json
|
||||
import requests
|
||||
|
||||
import requests
|
||||
from django.conf import settings
|
||||
|
||||
from funkwhale_api.common import session
|
||||
|
||||
from . import actors
|
||||
from . import models
|
||||
from . import serializers
|
||||
from . import signing
|
||||
from . import webfinger
|
||||
from . import actors, models, serializers, signing, webfinger
|
||||
|
||||
|
||||
def scan_from_account_name(account_name):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import os
|
||||
import uuid
|
||||
import tempfile
|
||||
import uuid
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
from rest_framework.permissions import BasePermission
|
||||
|
||||
from funkwhale_api.common import preferences
|
||||
|
||||
from . import actors
|
||||
|
||||
|
||||
|
|
|
@ -3,18 +3,14 @@ import urllib.parse
|
|||
|
||||
from django.core.paginator import Paginator
|
||||
from django.db import transaction
|
||||
|
||||
from rest_framework import serializers
|
||||
|
||||
from funkwhale_api.common import utils as funkwhale_utils
|
||||
from funkwhale_api.common import serializers as common_serializers
|
||||
from funkwhale_api.common import utils as funkwhale_utils
|
||||
from funkwhale_api.music import models as music_models
|
||||
from funkwhale_api.music import tasks as music_tasks
|
||||
from . import activity
|
||||
from . import filters
|
||||
from . import models
|
||||
from . import utils
|
||||
|
||||
from . import activity, filters, models, utils
|
||||
|
||||
AP_CONTEXT = [
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import logging
|
||||
|
||||
import requests
|
||||
import requests_http_signature
|
||||
|
||||
from . import exceptions
|
||||
from . import utils
|
||||
from . import exceptions, utils
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -6,18 +6,15 @@ import os
|
|||
from django.conf import settings
|
||||
from django.db.models import Q
|
||||
from django.utils import timezone
|
||||
|
||||
from requests.exceptions import RequestException
|
||||
from dynamic_preferences.registries import global_preferences_registry
|
||||
from requests.exceptions import RequestException
|
||||
|
||||
from funkwhale_api.common import session
|
||||
from funkwhale_api.taskapp import celery
|
||||
|
||||
from . import actors
|
||||
from . import library as lb
|
||||
from . import models
|
||||
from . import signing
|
||||
|
||||
from . import models, signing
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from django.conf.urls import include, url
|
||||
|
||||
from rest_framework import routers
|
||||
|
||||
from . import views
|
||||
|
||||
router = routers.SimpleRouter(trailing_slash=False)
|
||||
|
|
|
@ -3,27 +3,26 @@ from django.core import paginator
|
|||
from django.db import transaction
|
||||
from django.http import HttpResponse
|
||||
from django.urls import reverse
|
||||
|
||||
from rest_framework import mixins
|
||||
from rest_framework import response
|
||||
from rest_framework import viewsets
|
||||
from rest_framework.decorators import list_route, detail_route
|
||||
from rest_framework import mixins, response, viewsets
|
||||
from rest_framework.decorators import detail_route, list_route
|
||||
|
||||
from funkwhale_api.common import preferences
|
||||
from funkwhale_api.music import models as music_models
|
||||
from funkwhale_api.users.permissions import HasUserPermission
|
||||
|
||||
from . import actors
|
||||
from . import authentication
|
||||
from . import filters
|
||||
from . import library
|
||||
from . import models
|
||||
from . import permissions
|
||||
from . import renderers
|
||||
from . import serializers
|
||||
from . import tasks
|
||||
from . import utils
|
||||
from . import webfinger
|
||||
from . import (
|
||||
actors,
|
||||
authentication,
|
||||
filters,
|
||||
library,
|
||||
models,
|
||||
permissions,
|
||||
renderers,
|
||||
serializers,
|
||||
tasks,
|
||||
utils,
|
||||
webfinger
|
||||
)
|
||||
|
||||
|
||||
class FederationMixin(object):
|
||||
|
|
|
@ -3,8 +3,7 @@ from django.conf import settings
|
|||
|
||||
from funkwhale_api.common import session
|
||||
|
||||
from . import actors
|
||||
from . import serializers
|
||||
from . import actors, serializers
|
||||
|
||||
VALID_RESOURCE_TYPES = ["acct"]
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from funkwhale_api.common import channels
|
||||
from funkwhale_api.activity import record
|
||||
from funkwhale_api.common import channels
|
||||
|
||||
from . import serializers
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from django.utils import timezone
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
|
||||
from funkwhale_api.music.models import Track
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from . import views
|
||||
|
||||
from rest_framework import routers
|
||||
|
||||
from . import views
|
||||
|
||||
router = routers.SimpleRouter()
|
||||
router.register(r"listenings", views.ListeningViewSet, "listenings")
|
||||
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
from rest_framework import mixins, viewsets
|
||||
from rest_framework import permissions
|
||||
from rest_framework import mixins, permissions, viewsets
|
||||
|
||||
from funkwhale_api.activity import record
|
||||
|
||||
from . import models
|
||||
from . import serializers
|
||||
from . import models, serializers
|
||||
|
||||
|
||||
class ListeningViewSet(
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from django.forms import widgets
|
||||
|
||||
from dynamic_preferences import types
|
||||
from dynamic_preferences.registries import global_preferences_registry
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ from funkwhale_api.common import preferences
|
|||
|
||||
from . import stats
|
||||
|
||||
|
||||
store = memoize.djangocache.Cache("default")
|
||||
memo = memoize.Memoizer(store, namespace="instance:stats")
|
||||
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
from rest_framework import views
|
||||
from rest_framework.response import Response
|
||||
|
||||
from dynamic_preferences.api import serializers
|
||||
from dynamic_preferences.api import viewsets as preferences_viewsets
|
||||
from dynamic_preferences.registries import global_preferences_registry
|
||||
from rest_framework import views
|
||||
from rest_framework.response import Response
|
||||
|
||||
from funkwhale_api.common import preferences
|
||||
from funkwhale_api.users.permissions import HasUserPermission
|
||||
|
||||
from . import nodeinfo
|
||||
|
||||
|
||||
NODEINFO_2_CONTENT_TYPE = "application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.0#; charset=utf-8" # noqa
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from django.conf.urls import include, url
|
||||
from . import views
|
||||
|
||||
from rest_framework import routers
|
||||
|
||||
from . import views
|
||||
|
||||
library_router = routers.SimpleRouter()
|
||||
library_router.register(r"track-files", views.ManageTrackFileViewSet, "track-files")
|
||||
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
from rest_framework import mixins
|
||||
from rest_framework import response
|
||||
from rest_framework import viewsets
|
||||
from rest_framework import mixins, response, viewsets
|
||||
from rest_framework.decorators import list_route
|
||||
|
||||
from funkwhale_api.music import models as music_models
|
||||
from funkwhale_api.users.permissions import HasUserPermission
|
||||
|
||||
from . import filters
|
||||
from . import serializers
|
||||
from . import filters, serializers
|
||||
|
||||
|
||||
class ManageTrackFileViewSet(
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import factory
|
||||
import os
|
||||
|
||||
from funkwhale_api.factories import registry, ManyToManyFromList
|
||||
import factory
|
||||
|
||||
from funkwhale_api.factories import ManyToManyFromList, registry
|
||||
from funkwhale_api.federation.factories import LibraryTrackFactory
|
||||
from funkwhale_api.users.factories import UserFactory
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from django.db.models import Count
|
||||
|
||||
from django_filters import rest_framework as filters
|
||||
|
||||
from funkwhale_api.common import fields
|
||||
|
||||
from . import models
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import urllib.request
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import cacheops
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.db import transaction
|
||||
from django.db.models import Q
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from funkwhale_api.music import models, utils
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from django import forms
|
||||
import arrow
|
||||
import mutagen
|
||||
from django import forms
|
||||
|
||||
NODEFAULT = object()
|
||||
|
||||
|
|
|
@ -1,29 +1,26 @@
|
|||
import os
|
||||
import arrow
|
||||
import datetime
|
||||
import tempfile
|
||||
import os
|
||||
import shutil
|
||||
import markdown
|
||||
import tempfile
|
||||
import uuid
|
||||
|
||||
import arrow
|
||||
import markdown
|
||||
from django.conf import settings
|
||||
from django.db import models
|
||||
from django.core.files.base import ContentFile
|
||||
from django.core.files import File
|
||||
from django.core.files.base import ContentFile
|
||||
from django.db import models
|
||||
from django.db.models.signals import post_save
|
||||
from django.dispatch import receiver
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
|
||||
from taggit.managers import TaggableManager
|
||||
from versatileimagefield.fields import VersatileImageField
|
||||
|
||||
from funkwhale_api import downloader
|
||||
from funkwhale_api import musicbrainz
|
||||
from funkwhale_api import downloader, musicbrainz
|
||||
from funkwhale_api.federation import utils as federation_utils
|
||||
from . import importers
|
||||
from . import metadata
|
||||
from . import utils
|
||||
|
||||
from . import importers, metadata, utils
|
||||
|
||||
|
||||
class APIModelMixin(models.Model):
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
from rest_framework.permissions import BasePermission
|
||||
|
||||
from funkwhale_api.common import preferences
|
||||
from funkwhale_api.federation import actors
|
||||
from funkwhale_api.federation import models
|
||||
from funkwhale_api.federation import actors, models
|
||||
|
||||
|
||||
class Listen(BasePermission):
|
||||
|
|
|
@ -5,8 +5,7 @@ from taggit.models import Tag
|
|||
from funkwhale_api.activity import serializers as activity_serializers
|
||||
from funkwhale_api.users.serializers import UserBasicSerializer
|
||||
|
||||
from . import models
|
||||
from . import tasks
|
||||
from . import models, tasks
|
||||
|
||||
|
||||
class ArtistAlbumSerializer(serializers.ModelSerializer):
|
||||
|
|
|
@ -1,21 +1,19 @@
|
|||
import logging
|
||||
import os
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.files.base import ContentFile
|
||||
|
||||
from musicbrainzngs import ResponseError
|
||||
|
||||
from funkwhale_api.common import preferences
|
||||
from funkwhale_api.federation import activity
|
||||
from funkwhale_api.federation import actors
|
||||
from funkwhale_api.federation import activity, actors
|
||||
from funkwhale_api.federation import serializers as federation_serializers
|
||||
from funkwhale_api.taskapp import celery
|
||||
from funkwhale_api.providers.acoustid import get_acoustid_client
|
||||
from funkwhale_api.providers.audiofile import tasks as audiofile_tasks
|
||||
from funkwhale_api.taskapp import celery
|
||||
|
||||
from django.conf import settings
|
||||
from . import models
|
||||
from . import lyrics as lyrics_utils
|
||||
from . import models
|
||||
from . import utils as music_utils
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import magic
|
||||
import mimetypes
|
||||
import mutagen
|
||||
import re
|
||||
|
||||
import magic
|
||||
import mutagen
|
||||
from django.db.models import Q
|
||||
|
||||
|
||||
|
|
|
@ -2,35 +2,31 @@ import json
|
|||
import logging
|
||||
import urllib
|
||||
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.db import models, transaction
|
||||
from django.db.models.functions import Length
|
||||
from django.db.models import Count
|
||||
from django.db.models.functions import Length
|
||||
from django.utils import timezone
|
||||
|
||||
from rest_framework import viewsets, views, mixins
|
||||
from musicbrainzngs import ResponseError
|
||||
from rest_framework import mixins
|
||||
from rest_framework import settings as rest_settings
|
||||
from rest_framework import views, viewsets
|
||||
from rest_framework.decorators import detail_route, list_route
|
||||
from rest_framework.response import Response
|
||||
from rest_framework import settings as rest_settings
|
||||
from musicbrainzngs import ResponseError
|
||||
from taggit.models import Tag
|
||||
|
||||
from funkwhale_api.common import utils as funkwhale_utils
|
||||
from funkwhale_api.common.permissions import ConditionalAuthentication
|
||||
from funkwhale_api.users.permissions import HasUserPermission
|
||||
from taggit.models import Tag
|
||||
from funkwhale_api.federation.authentication import SignatureAuthentication
|
||||
from funkwhale_api.federation.models import LibraryTrack
|
||||
from funkwhale_api.musicbrainz import api
|
||||
from funkwhale_api.requests.models import ImportRequest
|
||||
from funkwhale_api.users.permissions import HasUserPermission
|
||||
|
||||
from . import filters
|
||||
from . import importers
|
||||
from . import models
|
||||
from . import filters, importers, models
|
||||
from . import permissions as music_permissions
|
||||
from . import serializers
|
||||
from . import tasks
|
||||
from . import utils
|
||||
from . import serializers, tasks, utils
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import musicbrainzngs
|
||||
import memoize.djangocache
|
||||
|
||||
import musicbrainzngs
|
||||
from django.conf import settings
|
||||
|
||||
from funkwhale_api import __version__
|
||||
|
||||
_api = musicbrainzngs
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
from rest_framework import viewsets
|
||||
from rest_framework.views import APIView
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.decorators import list_route
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.views import APIView
|
||||
|
||||
from funkwhale_api.common.permissions import ConditionalAuthentication
|
||||
|
||||
|
||||
from .client import api
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
from django.db import models
|
||||
from django.db import transaction
|
||||
from django.db import models, transaction
|
||||
from django.utils import timezone
|
||||
|
||||
from rest_framework import exceptions
|
||||
|
||||
from funkwhale_api.common import fields
|
||||
from funkwhale_api.common import preferences
|
||||
from funkwhale_api.common import fields, preferences
|
||||
|
||||
|
||||
class PlaylistQuerySet(models.QuerySet):
|
||||
|
|
|
@ -5,6 +5,7 @@ from funkwhale_api.common import preferences
|
|||
from funkwhale_api.music.models import Track
|
||||
from funkwhale_api.music.serializers import TrackSerializer
|
||||
from funkwhale_api.users.serializers import UserBasicSerializer
|
||||
|
||||
from . import models
|
||||
|
||||
|
||||
|
|
|
@ -1,18 +1,13 @@
|
|||
from django.db.models import Count
|
||||
from django.db import transaction
|
||||
|
||||
from rest_framework import exceptions
|
||||
from rest_framework import mixins, viewsets
|
||||
from django.db.models import Count
|
||||
from rest_framework import exceptions, mixins, viewsets
|
||||
from rest_framework.decorators import detail_route
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.permissions import IsAuthenticatedOrReadOnly
|
||||
from rest_framework.response import Response
|
||||
|
||||
from funkwhale_api.common import permissions
|
||||
from funkwhale_api.common import fields
|
||||
from funkwhale_api.common import fields, permissions
|
||||
|
||||
from . import filters
|
||||
from . import models
|
||||
from . import serializers
|
||||
from . import filters, models, serializers
|
||||
|
||||
|
||||
class PlaylistViewSet(
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from django import forms
|
||||
|
||||
from dynamic_preferences.types import StringPreference, Section
|
||||
from dynamic_preferences.registries import global_preferences_registry
|
||||
from dynamic_preferences.types import Section, StringPreference
|
||||
|
||||
acoustid = Section("providers_acoustid")
|
||||
|
||||
|
|
|
@ -5,8 +5,7 @@ from django.conf import settings
|
|||
from django.core.files import File
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
|
||||
from funkwhale_api.music import models
|
||||
from funkwhale_api.music import tasks
|
||||
from funkwhale_api.music import models, tasks
|
||||
from funkwhale_api.users.models import User
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
import acoustid
|
||||
import os
|
||||
|
||||
import acoustid
|
||||
from django.core.files import File
|
||||
from django.db import transaction
|
||||
|
||||
from funkwhale_api.taskapp import celery
|
||||
from funkwhale_api.music import metadata, models
|
||||
from funkwhale_api.providers.acoustid import get_acoustid_client
|
||||
from funkwhale_api.music import models, metadata
|
||||
from funkwhale_api.taskapp import celery
|
||||
|
||||
|
||||
@transaction.atomic
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import threading
|
||||
|
||||
from apiclient.discovery import build
|
||||
|
||||
from dynamic_preferences.registries import global_preferences_registry as registry
|
||||
|
||||
YOUTUBE_API_SERVICE_NAME = "youtube"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from django import forms
|
||||
|
||||
from dynamic_preferences.types import StringPreference, Section
|
||||
from dynamic_preferences.registries import global_preferences_registry
|
||||
from dynamic_preferences.types import Section, StringPreference
|
||||
|
||||
youtube = Section("providers_youtube")
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from django.conf.urls import url
|
||||
from .views import APISearch, APISearchs
|
||||
|
||||
from .views import APISearch, APISearchs
|
||||
|
||||
urlpatterns = [
|
||||
url(r"^search/$", APISearch.as_view(), name="search"),
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from rest_framework.views import APIView
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.views import APIView
|
||||
|
||||
from funkwhale_api.common.permissions import ConditionalAuthentication
|
||||
|
||||
from .client import client
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import collections
|
||||
|
||||
import persisting_theory
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db.models import Q
|
||||
from django.urls import reverse_lazy
|
||||
|
||||
import persisting_theory
|
||||
|
||||
from funkwhale_api.music import models
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from django.db import models
|
||||
from django.utils import timezone
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.contrib.contenttypes.fields import GenericForeignKey
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.contrib.postgres.fields import JSONField
|
||||
from django.core.serializers.json import DjangoJSONEncoder
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
|
||||
from funkwhale_api.music.models import Track
|
||||
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
import random
|
||||
from rest_framework import serializers
|
||||
from django.db.models import Count
|
||||
from django.core.exceptions import ValidationError
|
||||
from taggit.models import Tag
|
||||
from funkwhale_api.users.models import User
|
||||
from funkwhale_api.music.models import Track, Artist
|
||||
|
||||
from . import filters
|
||||
from . import models
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db.models import Count
|
||||
from rest_framework import serializers
|
||||
from taggit.models import Tag
|
||||
|
||||
from funkwhale_api.music.models import Artist, Track
|
||||
from funkwhale_api.users.models import User
|
||||
|
||||
from . import filters, models
|
||||
from .registries import registry
|
||||
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@ from rest_framework import serializers
|
|||
from funkwhale_api.music.serializers import TrackSerializer
|
||||
from funkwhale_api.users.serializers import UserBasicSerializer
|
||||
|
||||
from . import filters
|
||||
from . import models
|
||||
from . import filters, models
|
||||
from .radios import registry
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from . import views
|
||||
|
||||
from rest_framework import routers
|
||||
|
||||
from . import views
|
||||
|
||||
router = routers.SimpleRouter()
|
||||
router.register(r"sessions", views.RadioSessionViewSet, "sessions")
|
||||
router.register(r"radios", views.RadioViewSet, "radios")
|
||||
|
|
|
@ -1,18 +1,12 @@
|
|||
from django.db.models import Q
|
||||
from django.http import Http404
|
||||
|
||||
from rest_framework import mixins, viewsets
|
||||
from rest_framework import permissions
|
||||
from rest_framework import status
|
||||
from rest_framework.response import Response
|
||||
from rest_framework import mixins, permissions, status, viewsets
|
||||
from rest_framework.decorators import detail_route, list_route
|
||||
from rest_framework.response import Response
|
||||
|
||||
from funkwhale_api.music.serializers import TrackSerializer
|
||||
|
||||
from . import models
|
||||
from . import filters
|
||||
from . import filtersets
|
||||
from . import serializers
|
||||
from . import filters, filtersets, models, serializers
|
||||
|
||||
|
||||
class RadioViewSet(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from . import views
|
||||
|
||||
from rest_framework import routers
|
||||
|
||||
from . import views
|
||||
|
||||
router = routers.SimpleRouter()
|
||||
router.register(r"import-requests", views.ImportRequestViewSet, "import-requests")
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import django_filters
|
||||
|
||||
from funkwhale_api.common import fields
|
||||
|
||||
from . import models
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from django.db import models
|
||||
|
||||
from django.utils import timezone
|
||||
|
||||
NATURE_CHOICES = [("artist", "artist"), ("album", "album"), ("track", "track")]
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
from rest_framework import mixins, viewsets
|
||||
|
||||
from . import filters
|
||||
from . import models
|
||||
from . import serializers
|
||||
from . import filters, models, serializers
|
||||
|
||||
|
||||
class ImportRequestViewSet(
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import binascii
|
||||
import hashlib
|
||||
|
||||
from rest_framework import authentication
|
||||
from rest_framework import exceptions
|
||||
from rest_framework import authentication, exceptions
|
||||
|
||||
from funkwhale_api.users.models import User
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from dynamic_preferences import types
|
||||
from dynamic_preferences.registries import global_preferences_registry
|
||||
|
||||
|
||||
subsonic = types.Section("subsonic")
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
from rest_framework import exceptions
|
||||
from rest_framework import negotiation
|
||||
from rest_framework import exceptions, negotiation
|
||||
|
||||
from . import renderers
|
||||
|
||||
|
||||
MAPPING = {
|
||||
"json": (renderers.SubsonicJSONRenderer(), "application/json"),
|
||||
"xml": (renderers.SubsonicXMLRenderer(), "text/xml"),
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import collections
|
||||
|
||||
from django.db.models import functions, Count
|
||||
|
||||
from django.db.models import Count, functions
|
||||
from rest_framework import serializers
|
||||
|
||||
from funkwhale_api.history import models as history_models
|
||||
|
|
|
@ -2,12 +2,9 @@ import datetime
|
|||
|
||||
from django.conf import settings
|
||||
from django.utils import timezone
|
||||
|
||||
from rest_framework import exceptions
|
||||
from rest_framework import permissions as rest_permissions
|
||||
from rest_framework import renderers
|
||||
from rest_framework import response
|
||||
from rest_framework import viewsets
|
||||
from rest_framework import renderers, response, viewsets
|
||||
from rest_framework.decorators import list_route
|
||||
from rest_framework.serializers import ValidationError
|
||||
|
||||
|
@ -19,10 +16,7 @@ from funkwhale_api.music import utils
|
|||
from funkwhale_api.music import views as music_views
|
||||
from funkwhale_api.playlists import models as playlists_models
|
||||
|
||||
from . import authentication
|
||||
from . import filters
|
||||
from . import negotiation
|
||||
from . import serializers
|
||||
from . import authentication, filters, negotiation, serializers
|
||||
|
||||
|
||||
def find_object(queryset, model_field="pk", field="id", cast=int):
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
|
||||
from __future__ import absolute_import
|
||||
import os
|
||||
|
||||
import functools
|
||||
import os
|
||||
|
||||
from celery import Celery
|
||||
from django.apps import AppConfig
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
if not settings.configured:
|
||||
# set the default Django settings module for the 'celery' program.
|
||||
os.environ.setdefault(
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from django.conf import settings
|
||||
|
||||
from allauth.account.adapter import DefaultAccountAdapter
|
||||
from django.conf import settings
|
||||
from dynamic_preferences.registries import global_preferences_registry
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from rest_framework import routers
|
||||
|
||||
from . import views
|
||||
|
||||
router = routers.SimpleRouter()
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import factory
|
||||
|
||||
from funkwhale_api.factories import registry, ManyToManyFromList
|
||||
from django.contrib.auth.models import Permission
|
||||
|
||||
from funkwhale_api.factories import ManyToManyFromList, registry
|
||||
|
||||
|
||||
@registry.register
|
||||
class GroupFactory(factory.django.DjangoModelFactory):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import binascii
|
||||
import os
|
||||
|
@ -7,13 +7,12 @@ import uuid
|
|||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import AbstractUser
|
||||
from django.urls import reverse
|
||||
from django.db import models
|
||||
from django.urls import reverse
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from funkwhale_api.common import fields
|
||||
from funkwhale_api.common import preferences
|
||||
from funkwhale_api.common import fields, preferences
|
||||
|
||||
|
||||
def get_token():
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
from django.views.generic import TemplateView
|
||||
from django.conf.urls import url
|
||||
|
||||
from rest_auth.registration import views as registration_views
|
||||
from django.views.generic import TemplateView
|
||||
from rest_auth import views as rest_auth_views
|
||||
from rest_auth.registration import views as registration_views
|
||||
|
||||
from . import views
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
url(r"^$", views.RegisterView.as_view(), name="rest_register"),
|
||||
url(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.conf import settings
|
||||
|
||||
from rest_framework import serializers
|
||||
from rest_auth.serializers import PasswordResetSerializer as PRS
|
||||
from rest_framework import serializers
|
||||
|
||||
from funkwhale_api.activity import serializers as activity_serializers
|
||||
|
||||
from . import models
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
from rest_framework.response import Response
|
||||
from rest_framework import mixins
|
||||
from rest_framework import viewsets
|
||||
from rest_framework.decorators import detail_route, list_route
|
||||
|
||||
from rest_auth.registration.views import RegisterView as BaseRegisterView
|
||||
from allauth.account.adapter import get_adapter
|
||||
from rest_auth.registration.views import RegisterView as BaseRegisterView
|
||||
from rest_framework import mixins, viewsets
|
||||
from rest_framework.decorators import detail_route, list_route
|
||||
from rest_framework.response import Response
|
||||
|
||||
from funkwhale_api.common import preferences
|
||||
|
||||
from . import models
|
||||
from . import serializers
|
||||
from . import models, serializers
|
||||
|
||||
|
||||
class RegisterView(BaseRegisterView):
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
max-line-length = 120
|
||||
exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules
|
||||
|
||||
[isort]
|
||||
skip_glob = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules
|
||||
|
||||
[pep8]
|
||||
max-line-length = 120
|
||||
exclude=.tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from django.urls import reverse
|
||||
|
||||
from funkwhale_api.activity import serializers
|
||||
from funkwhale_api.activity import utils
|
||||
from funkwhale_api.activity import serializers, utils
|
||||
|
||||
|
||||
def test_activity_view(factories, api_client, preferences, anonymous_user):
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import pytest
|
||||
|
||||
from rest_framework_jwt.settings import api_settings
|
||||
|
||||
from funkwhale_api.common.auth import TokenAuthMiddleware
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import pytest
|
||||
|
||||
from django.contrib.auth.models import AnonymousUser
|
||||
from django.db.models import Q
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import pytest
|
||||
|
||||
from rest_framework.views import APIView
|
||||
|
||||
from django.http import Http404
|
||||
from rest_framework.views import APIView
|
||||
|
||||
from funkwhale_api.common import permissions
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import pytest
|
||||
|
||||
from dynamic_preferences.registries import global_preferences_registry
|
||||
|
||||
from funkwhale_api.common import preferences as common_preferences
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import pytest
|
||||
|
||||
from funkwhale_api.common.management.commands import script
|
||||
from funkwhale_api.common import scripts
|
||||
from funkwhale_api.common.management.commands import script
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import funkwhale_api
|
||||
|
||||
from funkwhale_api.common import session
|
||||
|
||||
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
import datetime
|
||||
import factory
|
||||
import pytest
|
||||
import requests_mock
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
import factory
|
||||
import pytest
|
||||
import requests_mock
|
||||
from django.contrib.auth.models import AnonymousUser
|
||||
from django.core.cache import cache as django_cache
|
||||
from django.test import client
|
||||
|
||||
from dynamic_preferences.registries import global_preferences_registry
|
||||
|
||||
from rest_framework import fields as rest_fields
|
||||
from rest_framework.test import APIClient
|
||||
from rest_framework.test import APIRequestFactory
|
||||
from rest_framework.test import APIClient, APIRequestFactory
|
||||
|
||||
from funkwhale_api.activity import record
|
||||
from funkwhale_api.users.permissions import HasUserPermission
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from funkwhale_api.users.serializers import UserActivitySerializer
|
||||
from funkwhale_api.favorites import activities, serializers
|
||||
from funkwhale_api.music.serializers import TrackActivitySerializer
|
||||
from funkwhale_api.favorites import serializers
|
||||
from funkwhale_api.favorites import activities
|
||||
from funkwhale_api.users.serializers import UserActivitySerializer
|
||||
|
||||
|
||||
def test_get_favorite_activity_url(settings, factories):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import json
|
||||
|
||||
import pytest
|
||||
from django.urls import reverse
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
from funkwhale_api.federation import activity
|
||||
from funkwhale_api.federation import serializers
|
||||
from funkwhale_api.federation import activity, serializers
|
||||
|
||||
|
||||
def test_deliver(factories, r_mock, mocker, settings):
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
import arrow
|
||||
import pytest
|
||||
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
|
||||
from rest_framework import exceptions
|
||||
|
||||
from funkwhale_api.federation import actors
|
||||
from funkwhale_api.federation import models
|
||||
from funkwhale_api.federation import serializers
|
||||
from funkwhale_api.federation import utils
|
||||
from funkwhale_api.federation import actors, models, serializers, utils
|
||||
from funkwhale_api.music import models as music_models
|
||||
from funkwhale_api.music import tasks as music_tasks
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from funkwhale_api.federation import authentication
|
||||
from funkwhale_api.federation import keys
|
||||
from funkwhale_api.federation import authentication, keys
|
||||
|
||||
|
||||
def test_authenticate(factories, mocker, api_request):
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from funkwhale_api.federation import library
|
||||
from funkwhale_api.federation import serializers
|
||||
from funkwhale_api.federation import library, serializers
|
||||
|
||||
|
||||
def test_library_scan_from_account_name(mocker, factories):
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import pytest
|
||||
|
||||
from django import db
|
||||
|
||||
|
||||
|
||||
def test_cannot_duplicate_actor(factories):
|
||||
actor = factories["federation.Actor"]()
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from rest_framework.views import APIView
|
||||
|
||||
from funkwhale_api.federation import actors
|
||||
from funkwhale_api.federation import permissions
|
||||
from funkwhale_api.federation import actors, permissions
|
||||
|
||||
|
||||
def test_library_follower(factories, api_request, anonymous_user, preferences):
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue