Verified Commit 9427f8b5 authored by Agate's avatar Agate 💬

See #297: removed unused imports

parent 639882bd
from urllib.parse import parse_qs
import jwt
from django.contrib.auth.models import AnonymousUser
from django.utils.encoding import smart_text
from rest_framework import exceptions
from rest_framework_jwt.settings import api_settings
from rest_framework_jwt.authentication import BaseJSONWebTokenAuthentication
from funkwhale_api.users.models import User
......
import operator
from django.conf import settings
from django.http import Http404
from rest_framework.permissions import BasePermission
......
from . import django_permissions_to_user_permissions
from . import test
from .downloader import download
__all__ = ["download"]
from django.conf import settings
from django.db import models
from django.utils import timezone
......
from django.conf import settings
from rest_framework import serializers
......
from django.conf.urls import include, url
from . import views
from rest_framework import routers
......
from rest_framework import generics, mixins, viewsets
from rest_framework import mixins, viewsets
from rest_framework import status
from rest_framework.response import Response
from rest_framework import pagination
from rest_framework.decorators import list_route
from funkwhale_api.activity import record
......
from . import serializers
from . import tasks
ACTIVITY_TYPES = [
"Accept",
"Add",
......@@ -52,9 +49,13 @@ OBJECT_TYPES = [
def deliver(activity, on_behalf_of, to=[]):
from . import tasks
return tasks.send.delay(activity=activity, actor_id=on_behalf_of.pk, to=to)
def accept_follow(follow):
from . import serializers
serializer = serializers.AcceptFollowSerializer(follow)
return deliver(serializer.data, to=[follow.actor.url], on_behalf_of=follow.target)
......@@ -9,7 +9,6 @@ from django.utils import timezone
from rest_framework.exceptions import PermissionDenied
from dynamic_preferences.registries import global_preferences_registry
from funkwhale_api.common import preferences
from funkwhale_api.common import session
......
......@@ -7,8 +7,6 @@ from rest_framework import exceptions
from . import actors
from . import keys
from . import models
from . import serializers
from . import signing
from . import utils
......
from django.forms import widgets
from dynamic_preferences import types
from dynamic_preferences.registries import global_preferences_registry
......
......@@ -5,7 +5,6 @@ from cryptography.hazmat.backends import default_backend as crypto_default_backe
import re
import urllib.parse
from . import exceptions
KEY_ID_REGEX = re.compile(r"keyId=\"(?P<id>.*)\"")
......
from django.conf import settings
from rest_framework.permissions import BasePermission
......
import logging
import urllib.parse
from django.urls import reverse
from django.conf import settings
from django.core.paginator import Paginator
from django.db import transaction
from rest_framework import serializers
from dynamic_preferences.registries import global_preferences_registry
from funkwhale_api.common import utils as funkwhale_utils
from funkwhale_api.common import serializers as common_serializers
......
......@@ -11,7 +11,6 @@ from requests.exceptions import RequestException
from dynamic_preferences.registries import global_preferences_registry
from funkwhale_api.common import session
from funkwhale_api.history.models import Listening
from funkwhale_api.taskapp import celery
from . import actors
......
from django import forms
from django.conf import settings
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 permissions as rest_permissions
from rest_framework import response
from rest_framework import views
from rest_framework import viewsets
from rest_framework.decorators import list_route, detail_route
from rest_framework.serializers import ValidationError
from funkwhale_api.common import preferences
from funkwhale_api.common import utils as funkwhale_utils
from funkwhale_api.music import models as music_models
from funkwhale_api.users.permissions import HasUserPermission
from . import activity
from . import actors
from . import authentication
from . import filters
......
from django import forms
from django.conf import settings
from django.urls import reverse
from funkwhale_api.common import session
from . import actors
from . import utils
from . import serializers
VALID_RESOURCE_TYPES = ["acct"]
......
from django.utils import timezone
from django.db import models
from django.core.exceptions import ValidationError
from funkwhale_api.music.models import Track
......
from django.conf.urls import include, url
from . import views
from rest_framework import routers
......
from rest_framework import generics, mixins, viewsets
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.decorators import detail_route
from funkwhale_api.activity import record
from funkwhale_api.common.permissions import ConditionalAuthentication
from . import models
from . import serializers
......
......@@ -9,7 +9,6 @@ from funkwhale_api.common import preferences
from funkwhale_api.users.permissions import HasUserPermission
from . import nodeinfo
from . import stats
NODEINFO_2_CONTENT_TYPE = "application/json; profile=http://nodeinfo.diaspora.software/ns/schema/2.0#; charset=utf-8" # noqa
......
from django.db.models import Count
from django_filters import rest_framework as filters
......
......@@ -3,7 +3,6 @@ Populates the database with fake data
"""
import random
from funkwhale_api.music import models
from funkwhale_api.music import factories
......
......@@ -2,8 +2,7 @@ import cacheops
from django.db import transaction
from django.db.models import Q
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.core.management.base import BaseCommand
from funkwhale_api.music import models, utils
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.db import migrations
import taggit.managers
......
......@@ -3,7 +3,6 @@ from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
import versatileimagefield.fields
class Migration(migrations.Migration):
......
......@@ -2,7 +2,6 @@
from __future__ import unicode_literals
from django.db import migrations, models
import versatileimagefield.fields
class Migration(migrations.Migration):
......
......@@ -2,7 +2,6 @@
from __future__ import unicode_literals
from django.db import migrations, models
from funkwhale_api.common.utils import rename_file
def rename_files(apps, schema_editor):
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.db import migrations
import versatileimagefield.fields
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from funkwhale_api.common.utils import rename_file
from django.db import migrations
def bind_jobs(apps, schema_editor):
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.db import migrations
from funkwhale_api.music.utils import guess_mimetype
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.db import migrations
def populate_status(apps, schema_editor):
......
from django.conf import settings
from rest_framework.permissions import BasePermission
......
from django.db import transaction
from django.db.models import Q
from rest_framework import serializers
from taggit.models import Tag
from funkwhale_api.activity import serializers as activity_serializers
from funkwhale_api.federation import utils as federation_utils
from funkwhale_api.federation.models import LibraryTrack
from funkwhale_api.federation.serializers import AP_CONTEXT
from funkwhale_api.users.serializers import UserBasicSerializer
from . import models
......
......@@ -8,7 +8,6 @@ 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 models as federation_models
from funkwhale_api.federation import serializers as federation_serializers
from funkwhale_api.taskapp import celery
from funkwhale_api.providers.acoustid import get_acoustid_client
......
import ffmpeg
import json
import logging
import unicodedata
import urllib
from django.contrib.auth.decorators import login_required
from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings
from django.db import models, transaction
from django.db.models.functions import Length
from django.db.models import Count
from django.http import StreamingHttpResponse
from django.urls import reverse
from django.utils import timezone
from django.utils.decorators import method_decorator
from rest_framework import viewsets, views, mixins
from rest_framework.decorators import detail_route, list_route
from rest_framework.response import Response
from rest_framework import settings as rest_settings
from rest_framework import permissions
from musicbrainzngs import ResponseError
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 import actors
from funkwhale_api.federation.authentication import SignatureAuthentication
from funkwhale_api.federation.models import LibraryTrack
from funkwhale_api.musicbrainz import api
......
from django.conf.urls import include, url
from django.conf.urls import url
from rest_framework import routers
from . import views
......
......@@ -2,7 +2,6 @@ from rest_framework import viewsets
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.decorators import list_route
import musicbrainzngs
from funkwhale_api.common.permissions import ConditionalAuthentication
......
from django.conf import settings
from django.db import models
from django.db import transaction
from django.utils import timezone
......
from django.conf import settings
from django.db import transaction
from rest_framework import serializers
from taggit.models import Tag
from funkwhale_api.common import preferences
from funkwhale_api.music.models import Track
......
......@@ -2,15 +2,13 @@ from django.db.models import Count
from django.db import transaction
from rest_framework import exceptions
from rest_framework import generics, mixins, viewsets
from rest_framework import status
from rest_framework import mixins, viewsets
from rest_framework.decorators import detail_route
from rest_framework.response import Response
from rest_framework.permissions import IsAuthenticatedOrReadOnly
from funkwhale_api.common import permissions
from funkwhale_api.common import fields
from funkwhale_api.music.models import Track
from . import filters
from . import models
......
from django.conf.urls import include, url
from funkwhale_api.music import views
urlpatterns = [
url(
......
import threading
from apiclient.discovery import build
from apiclient.errors import HttpError
from oauth2client.tools import argparser
from dynamic_preferences.registries import global_preferences_registry as registry
......
from django.conf.urls import include, url
from django.conf.urls import url
from .views import APISearch, APISearchs
......
......@@ -7,7 +7,6 @@ from django.urls import reverse_lazy
import persisting_theory
from funkwhale_api.music import models
from funkwhale_api.taskapp.celery import require_instance
class RadioFilterRegistry(persisting_theory.Registry):
......
from django.db import models
from django.utils import timezone
from django.core.exceptions import ValidationError
from django.contrib.postgres.fields import JSONField
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
......@@ -77,7 +76,6 @@ class RadioSession(models.Model):
@property
def radio(self):
from .registries import registry
from . import radios
return registry[self.radio_type](session=self)
......
from django.conf.urls import include, url
from . import views
from rest_framework import routers
......
from django.db.models import Q
from django.http import Http404
from rest_framework import generics, mixins, viewsets
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.decorators import detail_route, list_route
from funkwhale_api.music.serializers import TrackSerializer
from funkwhale_api.common.permissions import ConditionalAuthentication
from . import models
from . import filters
......
from django.conf.urls import include, url
from . import views
from rest_framework import routers
......
from rest_framework import generics, mixins, viewsets
from rest_framework import status
from rest_framework.response import Response
from rest_framework.decorators import detail_route
from rest_framework import mixins, viewsets
from . import filters
from . import models
......
from dynamic_preferences import types
from dynamic_preferences.registries import global_preferences_registry
from funkwhale_api.common import preferences
subsonic = types.Section("subsonic")
......
......@@ -6,7 +6,7 @@ import os
import uuid
from django.conf import settings
from django.contrib.auth.models import AbstractUser, Permission
from django.contrib.auth.models import AbstractUser
from django.urls import reverse
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
......
import pytest
from django.db import models
from rest_framework import serializers
......
......@@ -17,7 +17,6 @@ from rest_framework.test import APIRequestFactory
from funkwhale_api.activity import record
from funkwhale_api.users.permissions import HasUserPermission
from funkwhale_api.taskapp import celery
@pytest.fixture(scope="session", autouse=True)
......
......@@ -2,7 +2,6 @@ import json
import pytest
from django.urls import reverse
from funkwhale_api.music.models import Track, Artist
from funkwhale_api.favorites.models import TrackFavorite
......
......@@ -6,7 +6,6 @@ from django.utils import timezone
from rest_framework import exceptions
from funkwhale_api.federation import activity
from funkwhale_api.federation import actors
from funkwhale_api.federation import models
from funkwhale_api.federation import serializers
......
from funkwhale_api.federation import authentication
from funkwhale_api.federation import keys
from funkwhale_api.federation import signing
def test_authenticate(factories, mocker, api_request):
......
......@@ -2,8 +2,6 @@ import pytest
from django import db
from funkwhale_api.federation import models
from funkwhale_api.federation import serializers
def test_cannot_duplicate_actor(factories):
......
import arrow
import pytest
from django.urls import reverse
from django.core.paginator import Paginator
from funkwhale_api.federation import actors
from funkwhale_api.federation import keys
from funkwhale_api.federation import models
from funkwhale_api.federation import serializers
from funkwhale_api.federation import utils
......
import cryptography.exceptions
import pytest
import requests_http_signature
from funkwhale_api.federation import signing
from funkwhale_api.federation import keys
......
import datetime
import os
import pathlib
import pytest
from django.core.paginator import Paginator
from django.utils import timezone
......
import pytest
from django import forms
from django.urls import reverse
from funkwhale_api.federation import webfinger
......
from django.urls import reverse
from django.core.exceptions import ValidationError
from django.utils import timezone
from funkwhale_api.history import models
......
from django.urls import reverse
import funkwhale_api
......
......@@ -2,7 +2,6 @@ import pytest
from django.urls import reverse
from dynamic_preferences.api import serializers
def test_can_list_settings_via_api(preferences, api_client):
......
from django.urls import reverse
from funkwhale_api.instance import stats
......
from funkwhale_api.users.serializers import UserActivitySerializer
from funkwhale_api.favorites import serializers
def test_get_track_activity_url_mbid(factories):
......
......@@ -4,8 +4,6 @@ import pytest
from django.urls import reverse
from funkwhale_api.music import models
from funkwhale_api.musicbrainz import api
from funkwhale_api.music import serializers
from funkwhale_api.music import tasks
......
import json
import os
import pytest
from django.urls import reverse
......
from django.urls import reverse
from funkwhale_api.music import models
from funkwhale_api.musicbrainz import api
from funkwhale_api.music import serializers
from funkwhale_api.music import tasks
from funkwhale_api.music import lyrics as lyrics_utils
......
import os
import pytest
from funkwhale_api.providers.acoustid import get_acoustid_client
from funkwhale_api.music import tasks
DATA_DIR = os.path.dirname(os.path.abspath(__file__))
......
from django.urls import reverse
from funkwhale_api.music import models
from funkwhale_api.musicbrainz import api
from funkwhale_api.music import serializers
</