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 ...@@ -4,8 +4,7 @@ from rest_framework.response import Response
from funkwhale_api.common.permissions import ConditionalAuthentication from funkwhale_api.common.permissions import ConditionalAuthentication
from funkwhale_api.favorites.models import TrackFavorite from funkwhale_api.favorites.models import TrackFavorite
from . import serializers from . import serializers, utils
from . import utils
class ActivityViewSet(viewsets.GenericViewSet): class ActivityViewSet(viewsets.GenericViewSet):
......
from urllib.parse import parse_qs from urllib.parse import parse_qs
from django.contrib.auth.models import AnonymousUser from django.contrib.auth.models import AnonymousUser
from rest_framework import exceptions from rest_framework import exceptions
from rest_framework_jwt.authentication import BaseJSONWebTokenAuthentication from rest_framework_jwt.authentication import BaseJSONWebTokenAuthentication
......
from django.utils.encoding import smart_text from django.utils.encoding import smart_text
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from rest_framework import exceptions from rest_framework import exceptions
from rest_framework_jwt import authentication from rest_framework_jwt import authentication
from rest_framework_jwt.settings import api_settings from rest_framework_jwt.settings import api_settings
......
from channels.generic.websocket import JsonWebsocketConsumer from channels.generic.websocket import JsonWebsocketConsumer
from funkwhale_api.common import channels from funkwhale_api.common import channels
......
import django_filters import django_filters
from django.db import models from django.db import models
from funkwhale_api.music import utils from funkwhale_api.music import utils
PRIVACY_LEVEL_CHOICES = [ PRIVACY_LEVEL_CHOICES = [
("me", "Only me"), ("me", "Only me"),
("followers", "Me and my followers"), ("followers", "Me and my followers"),
......
import operator import operator
from django.http import Http404 from django.http import Http404
from rest_framework.permissions import BasePermission from rest_framework.permissions import BasePermission
from funkwhale_api.common import preferences from funkwhale_api.common import preferences
......
from django.conf import settings
from django import forms from django import forms
from django.conf import settings
from dynamic_preferences import serializers from dynamic_preferences import serializers, types
from dynamic_preferences import types
from dynamic_preferences.registries import global_preferences_registry from dynamic_preferences.registries import global_preferences_registry
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
Convert django permissions to user permissions in the database, Convert django permissions to user permissions in the database,
following the work done in #152. following the work done in #152.
""" """
from django.contrib.auth.models import Permission
from django.db.models import Q 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 = { mapping = {
"dynamic_preferences.change_globalpreferencemodel": "settings", "dynamic_preferences.change_globalpreferencemodel": "settings",
......
import requests import requests
from django.conf import settings from django.conf import settings
import funkwhale_api import funkwhale_api
......
from urllib.parse import urlencode, parse_qs, urlsplit, urlunsplit
import os import os
import shutil import shutil
from urllib.parse import parse_qs, urlencode, urlsplit, urlunsplit
from django.db import transaction from django.db import transaction
......
import os import os
import youtube_dl import youtube_dl
from django.conf import settings from django.conf import settings
......
from funkwhale_api.common import channels
from funkwhale_api.activity import record from funkwhale_api.activity import record
from funkwhale_api.common import channels
from . import serializers from . import serializers
......
import factory import factory
from funkwhale_api.factories import registry from funkwhale_api.factories import registry
from funkwhale_api.music.factories import TrackFactory from funkwhale_api.music.factories import TrackFactory
from funkwhale_api.users.factories import UserFactory from funkwhale_api.users.factories import UserFactory
......
from . import views
from rest_framework import routers from rest_framework import routers
from . import views
router = routers.SimpleRouter() router = routers.SimpleRouter()
router.register(r"tracks", views.TrackFavoriteViewSet, "tracks") router.register(r"tracks", views.TrackFavoriteViewSet, "tracks")
......
from rest_framework import mixins, viewsets from rest_framework import mixins, status, viewsets
from rest_framework import status
from rest_framework.response import Response
from rest_framework.decorators import list_route from rest_framework.decorators import list_route
from rest_framework.response import Response
from funkwhale_api.activity import record from funkwhale_api.activity import record
from funkwhale_api.music.models import Track
from funkwhale_api.common.permissions import ConditionalAuthentication from funkwhale_api.common.permissions import ConditionalAuthentication
from funkwhale_api.music.models import Track
from . import models from . import models, serializers
from . import serializers
class TrackFavoriteViewSet( class TrackFavoriteViewSet(
......
...@@ -6,22 +6,14 @@ from django.conf import settings ...@@ -6,22 +6,14 @@ from django.conf import settings
from django.db import transaction from django.db import transaction
from django.urls import reverse from django.urls import reverse
from django.utils import timezone from django.utils import timezone
from rest_framework.exceptions import PermissionDenied from rest_framework.exceptions import PermissionDenied
from funkwhale_api.common import preferences, session
from funkwhale_api.common import preferences
from funkwhale_api.common import session
from funkwhale_api.common import utils as funkwhale_utils from funkwhale_api.common import utils as funkwhale_utils
from funkwhale_api.music import models as music_models from funkwhale_api.music import models as music_models
from funkwhale_api.music import tasks as music_tasks from funkwhale_api.music import tasks as music_tasks
from . import activity from . import activity, keys, models, serializers, signing, utils
from . import keys
from . import models
from . import serializers
from . import signing
from . import utils
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
......
import cryptography import cryptography
from django.contrib.auth.models import AnonymousUser from django.contrib.auth.models import AnonymousUser
from rest_framework import authentication, exceptions
from rest_framework import authentication from . import actors, keys, signing, utils
from rest_framework import exceptions
from . import actors
from . import keys
from . import signing
from . import utils
class SignatureAuthentication(authentication.BaseAuthentication): class SignatureAuthentication(authentication.BaseAuthentication):
......
import uuid
import factory import factory
import requests import requests
import requests_http_signature import requests_http_signature
import uuid
from django.utils import timezone
from django.conf import settings from django.conf import settings
from django.utils import timezone
from funkwhale_api.factories import registry from funkwhale_api.factories import registry
from . import keys from . import keys, models
from . import models
registry.register(keys.get_key_pair, name="federation.KeyPair") 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 re
import urllib.parse 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>.*)\"") KEY_ID_REGEX = re.compile(r"keyId=\"(?P<id>.*)\"")
......
import json import json
import requests
import requests
from django.conf import settings from django.conf import settings
from funkwhale_api.common import session from funkwhale_api.common import session
from . import actors from . import actors, models, serializers, signing, webfinger
from . import models
from . import serializers
from . import signing
from . import webfinger
def scan_from_account_name(account_name): def scan_from_account_name(account_name):
......
import os import os
import uuid
import tempfile import tempfile
import uuid
from django.conf import settings from django.conf import settings
from django.contrib.postgres.fields import JSONField from django.contrib.postgres.fields import JSONField
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
from rest_framework.permissions import BasePermission from rest_framework.permissions import BasePermission
from funkwhale_api.common import preferences from funkwhale_api.common import preferences
from . import actors from . import actors
......
...@@ -3,18 +3,14 @@ import urllib.parse ...@@ -3,18 +3,14 @@ import urllib.parse
from django.core.paginator import Paginator from django.core.paginator import Paginator
from django.db import transaction from django.db import transaction
from rest_framework import serializers 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 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 models as music_models
from funkwhale_api.music import tasks as music_tasks 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 = [ AP_CONTEXT = [
"https://www.w3.org/ns/activitystreams", "https://www.w3.org/ns/activitystreams",
......
import logging import logging
import requests import requests
import requests_http_signature import requests_http_signature
from . import exceptions from . import exceptions, utils
from . import utils
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
......
...@@ -6,18 +6,15 @@ import os ...@@ -6,18 +6,15 @@ import os
from django.conf import settings from django.conf import settings
from django.db.models import Q from django.db.models import Q
from django.utils import timezone from django.utils import timezone
from requests.exceptions import RequestException
from dynamic_preferences.registries import global_preferences_registry from dynamic_preferences.registries import global_preferences_registry
from requests.exceptions import RequestException
from funkwhale_api.common import session from funkwhale_api.common import session
from funkwhale_api.taskapp import celery from funkwhale_api.taskapp import celery
from . import actors from . import actors
from . import library as lb from . import library as lb
from . import models from . import models, signing
from . import signing
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
......
from django.conf.urls import include, url from django.conf.urls import include, url
from rest_framework import routers from rest_framework import routers
from . import views from . import views
router = routers.SimpleRouter(trailing_slash=False) router = routers.SimpleRouter(trailing_slash=False)
......
...@@ -3,27 +3,26 @@ from django.core import paginator ...@@ -3,27 +3,26 @@ from django.core import paginator
from django.db import transaction from django.db import transaction
from django.http import HttpResponse from django.http import HttpResponse
from django.urls import reverse from django.urls import reverse
from rest_framework import mixins, response, viewsets
from rest_framework import mixins from rest_framework.decorators import detail_route, list_route
from rest_framework import response
from rest_framework import viewsets
from rest_framework.decorators import list_route, detail_route
from funkwhale_api.common import preferences from funkwhale_api.common import preferences
from funkwhale_api.music import models as music_models from funkwhale_api.music import models as music_models
from funkwhale_api.users.permissions import HasUserPermission from funkwhale_api.users.permissions import HasUserPermission
from . import actors from . import (
from . import authentication actors,
from . import filters authentication,
from . import library filters,
from . import models library,
from . import permissions models,
from . import renderers permissions,
from . import serializers renderers,
from . import tasks serializers,
from . import utils tasks,
from . import webfinger utils,
webfinger
)
class FederationMixin(object): class FederationMixin(object):
......
...@@ -3,8 +3,7 @@ from django.conf import settings ...@@ -3,8 +3,7 @@ from django.conf import settings
from funkwhale_api.common import session from funkwhale_api.common import session
from . import actors from . import actors, serializers
from . import serializers
VALID_RESOURCE_TYPES = ["acct"] VALID_RESOURCE_TYPES = ["acct"]
......
from funkwhale_api.common import channels
from funkwhale_api.activity import record from funkwhale_api.activity import record
from funkwhale_api.common import channels
from . import serializers from . import serializers
......
from django.utils import timezone
from django.db import models from django.db import models
from django.utils import timezone
from funkwhale_api.music.models import Track from funkwhale_api.music.models import Track
......
from . import views
from rest_framework import routers from rest_framework import routers
from . import views
router = routers.SimpleRouter() router = routers.SimpleRouter()
router.register(r"listenings", views.ListeningViewSet, "listenings") router.register(r"listenings", views.ListeningViewSet, "listenings")
......
from rest_framework import mixins, viewsets from rest_framework import mixins, permissions, viewsets
from rest_framework import permissions
from funkwhale_api.activity import record from funkwhale_api.activity import record
from . import models from . import models, serializers
from . import serializers
class ListeningViewSet( class ListeningViewSet(
......
from django.forms import widgets from django.forms import widgets
from dynamic_preferences import types from dynamic_preferences import types
from dynamic_preferences.registries import global_preferences_registry from dynamic_preferences.registries import global_preferences_registry
......
...@@ -5,7 +5,6 @@ from funkwhale_api.common import preferences ...@@ -5,7 +5,6 @@ from funkwhale_api.common import preferences
from . import stats from . import stats
store = memoize.djangocache.Cache("default") store = memoize.djangocache.Cache("default")
memo = memoize.Memoizer(store, namespace="instance:stats") 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 serializers
from dynamic_preferences.api import viewsets as preferences_viewsets from dynamic_preferences.api import viewsets as preferences_viewsets
from dynamic_preferences.registries import global_preferences_registry 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.common import preferences
from funkwhale_api.users.permissions import HasUserPermission from funkwhale_api.users.permissions import HasUserPermission
from . import nodeinfo from . import nodeinfo
NODEINFO_2_CONTENT_TYPE = "application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.0#; charset=utf-8" # noqa 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 django.conf.urls import include, url
from . import views
from rest_framework import routers from rest_framework import routers
from . import views
library_router = routers.SimpleRouter() library_router = routers.SimpleRouter()
library_router.register(r"track-files", views.ManageTrackFileViewSet, "track-files") library_router.register(r"track-files", views.ManageTrackFileViewSet, "track-files")
......
from rest_framework import mixins from rest_framework import mixins, response, viewsets
from rest_framework import response
from rest_framework import viewsets
from rest_framework.decorators import list_route from rest_framework.decorators import list_route
from funkwhale_api.music import models as music_models from funkwhale_api.music import models as music_models
from funkwhale_api.users.permissions import HasUserPermission from funkwhale_api.users.permissions import HasUserPermission