Verified Commit 9bea804f authored by Agate's avatar Agate 💬

See #297: sorted imports

parent 9427f8b5
......@@ -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):
......
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
......
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
......
from channels.generic.websocket import JsonWebsocketConsumer
from funkwhale_api.common import channels
......
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"),
......
import operator
from django.http import Http404
from rest_framework.permissions import BasePermission
from funkwhale_api.common import preferences
......
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.contrib.auth.models import Permission
from django.db.models import Q
from funkwhale_api.users import models
from django.contrib.auth.models import Permission
from funkwhale_api.users import models
mapping = {
"dynamic_preferences.change_globalpreferencemodel": "settings",
......
import requests
from django.conf import settings
import funkwhale_api
......
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
......
import os
import youtube_dl
from django.conf import settings
......
from funkwhale_api.common import channels
from funkwhale_api.activity import record
from funkwhale_api.common import channels
from . import serializers
......
import factory
from funkwhale_api.factories import registry
from funkwhale_api.music.factories import TrackFactory
from funkwhale_api.users.factories import UserFactory
......
from . import views
from rest_framework import routers
from . import views
router = routers.SimpleRouter()
router.register(r"tracks", views.TrackFavoriteViewSet, "tracks")
......
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__)
......
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):
......
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")
......
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>.*)\"")
......
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):
......
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",
......
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__)
......
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"]
......
from funkwhale_api.common import channels
from funkwhale_api.activity import record
from funkwhale_api.common import channels
from . import serializers
......
from django.utils import timezone
from django.db import models
from django.utils import timezone
from funkwhale_api.music.models import Track
......
from . import views
from rest_framework import routers
from . import views
router = routers.SimpleRouter()
router.register(r"listenings", views.ListeningViewSet, "listenings")
......
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(
......
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")
......
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
......
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")
......
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(
......
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
......
from django.db.models import Count
from django_filters import rest_framework as filters
from funkwhale_api.common import fields
from . import models
......
import urllib.request
from bs4 import BeautifulSoup
......
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
......
from django import forms
import arrow
import mutagen
from django import forms
NODEFAULT = object()
......
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):
......
import logging
import os
from django.conf import settings
from django.core.files.base import ContentFile
from musicbrainzngs import ResponseError