From 9427f8b56ec38d4e83884cb70f710ad8a65b9268 Mon Sep 17 00:00:00 2001 From: Eliot Berriot <contact@eliotberriot.com> Date: Sun, 10 Jun 2018 10:39:47 +0200 Subject: [PATCH] See #297: removed unused imports --- api/funkwhale_api/common/auth.py | 3 --- api/funkwhale_api/common/permissions.py | 1 - api/funkwhale_api/common/scripts/__init__.py | 2 -- api/funkwhale_api/downloader/__init__.py | 3 ++- api/funkwhale_api/favorites/models.py | 1 - api/funkwhale_api/favorites/serializers.py | 1 - api/funkwhale_api/favorites/urls.py | 1 - api/funkwhale_api/favorites/views.py | 3 +-- api/funkwhale_api/federation/activity.py | 7 ++++--- api/funkwhale_api/federation/actors.py | 1 - api/funkwhale_api/federation/authentication.py | 2 -- .../federation/dynamic_preferences_registry.py | 1 - api/funkwhale_api/federation/keys.py | 1 - api/funkwhale_api/federation/permissions.py | 1 - api/funkwhale_api/federation/serializers.py | 3 --- api/funkwhale_api/federation/tasks.py | 1 - api/funkwhale_api/federation/views.py | 6 ------ api/funkwhale_api/federation/webfinger.py | 2 -- api/funkwhale_api/history/models.py | 1 - api/funkwhale_api/history/urls.py | 1 - api/funkwhale_api/history/views.py | 6 +----- api/funkwhale_api/instance/views.py | 1 - api/funkwhale_api/manage/filters.py | 1 - api/funkwhale_api/music/fake_data.py | 1 - .../music/management/commands/fix_track_files.py | 3 +-- api/funkwhale_api/music/migrations/0004_track_tags.py | 2 +- .../music/migrations/0009_auto_20160920_1614.py | 1 - .../music/migrations/0010_auto_20160920_1742.py | 1 - api/funkwhale_api/music/migrations/0011_rename_files.py | 1 - .../music/migrations/0012_auto_20161122_1905.py | 2 +- .../migrations/0015_bind_track_file_to_import_job.py | 3 +-- .../music/migrations/0019_populate_mimetypes.py | 2 +- .../music/migrations/0021_populate_batch_status.py | 2 +- api/funkwhale_api/music/permissions.py | 1 - api/funkwhale_api/music/serializers.py | 4 ---- api/funkwhale_api/music/tasks.py | 1 - api/funkwhale_api/music/views.py | 8 -------- api/funkwhale_api/musicbrainz/__init__.py | 2 ++ api/funkwhale_api/musicbrainz/urls.py | 2 +- api/funkwhale_api/musicbrainz/views.py | 1 - api/funkwhale_api/playlists/models.py | 1 - api/funkwhale_api/playlists/serializers.py | 2 -- api/funkwhale_api/playlists/views.py | 4 +--- api/funkwhale_api/providers/urls.py | 1 - api/funkwhale_api/providers/youtube/client.py | 2 -- api/funkwhale_api/providers/youtube/urls.py | 2 +- api/funkwhale_api/radios/__init__.py | 1 - api/funkwhale_api/radios/filters.py | 1 - api/funkwhale_api/radios/models.py | 2 -- api/funkwhale_api/radios/urls.py | 1 - api/funkwhale_api/radios/views.py | 3 +-- api/funkwhale_api/requests/api_urls.py | 1 - api/funkwhale_api/requests/views.py | 5 +---- .../subsonic/dynamic_preferences_registry.py | 1 - api/funkwhale_api/users/models.py | 2 +- api/tests/activity/test_record.py | 1 - api/tests/conftest.py | 1 - api/tests/favorites/test_favorites.py | 1 - api/tests/federation/test_actors.py | 1 - api/tests/federation/test_authentication.py | 1 - api/tests/federation/test_models.py | 2 -- api/tests/federation/test_serializers.py | 2 -- api/tests/federation/test_signing.py | 1 - api/tests/federation/test_tasks.py | 1 - api/tests/federation/test_webfinger.py | 1 - api/tests/history/test_history.py | 2 -- api/tests/instance/test_nodeinfo.py | 1 - api/tests/instance/test_preferences.py | 1 - api/tests/instance/test_stats.py | 1 - api/tests/music/test_activity.py | 2 -- api/tests/music/test_api.py | 2 -- api/tests/music/test_import.py | 1 - api/tests/music/test_lyrics.py | 2 -- api/tests/music/test_tasks.py | 1 - api/tests/music/test_works.py | 3 --- api/tests/musicbrainz/test_api.py | 1 - api/tests/playlists/test_views.py | 2 -- api/tests/radios/test_api.py | 1 - api/tests/requests/test_models.py | 2 -- api/tests/test_import_audio_file.py | 1 - api/tests/users/test_jwt.py | 1 - api/tests/users/test_views.py | 1 - 82 files changed, 22 insertions(+), 131 deletions(-) diff --git a/api/funkwhale_api/common/auth.py b/api/funkwhale_api/common/auth.py index 88010e798f..83738a3e94 100644 --- a/api/funkwhale_api/common/auth.py +++ b/api/funkwhale_api/common/auth.py @@ -1,12 +1,9 @@ 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 diff --git a/api/funkwhale_api/common/permissions.py b/api/funkwhale_api/common/permissions.py index 82da2c5775..0671645427 100644 --- a/api/funkwhale_api/common/permissions.py +++ b/api/funkwhale_api/common/permissions.py @@ -1,6 +1,5 @@ import operator -from django.conf import settings from django.http import Http404 from rest_framework.permissions import BasePermission diff --git a/api/funkwhale_api/common/scripts/__init__.py b/api/funkwhale_api/common/scripts/__init__.py index 4b2d525202..e69de29bb2 100644 --- a/api/funkwhale_api/common/scripts/__init__.py +++ b/api/funkwhale_api/common/scripts/__init__.py @@ -1,2 +0,0 @@ -from . import django_permissions_to_user_permissions -from . import test diff --git a/api/funkwhale_api/downloader/__init__.py b/api/funkwhale_api/downloader/__init__.py index 29ec89954d..eca15e121d 100644 --- a/api/funkwhale_api/downloader/__init__.py +++ b/api/funkwhale_api/downloader/__init__.py @@ -1,2 +1,3 @@ - from .downloader import download + +__all__ = ["download"] diff --git a/api/funkwhale_api/favorites/models.py b/api/funkwhale_api/favorites/models.py index dd2b8f3ec9..a6a80cebdd 100644 --- a/api/funkwhale_api/favorites/models.py +++ b/api/funkwhale_api/favorites/models.py @@ -1,4 +1,3 @@ -from django.conf import settings from django.db import models from django.utils import timezone diff --git a/api/funkwhale_api/favorites/serializers.py b/api/funkwhale_api/favorites/serializers.py index 40260c2aa9..3cafb80f02 100644 --- a/api/funkwhale_api/favorites/serializers.py +++ b/api/funkwhale_api/favorites/serializers.py @@ -1,4 +1,3 @@ -from django.conf import settings from rest_framework import serializers diff --git a/api/funkwhale_api/favorites/urls.py b/api/funkwhale_api/favorites/urls.py index b85023adea..69bc01f651 100644 --- a/api/funkwhale_api/favorites/urls.py +++ b/api/funkwhale_api/favorites/urls.py @@ -1,4 +1,3 @@ -from django.conf.urls import include, url from . import views from rest_framework import routers diff --git a/api/funkwhale_api/favorites/views.py b/api/funkwhale_api/favorites/views.py index 7deae7a984..6210ea2cf5 100644 --- a/api/funkwhale_api/favorites/views.py +++ b/api/funkwhale_api/favorites/views.py @@ -1,7 +1,6 @@ -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 diff --git a/api/funkwhale_api/federation/activity.py b/api/funkwhale_api/federation/activity.py index 6dd26a87dc..73e83e3345 100644 --- a/api/funkwhale_api/federation/activity.py +++ b/api/funkwhale_api/federation/activity.py @@ -1,6 +1,3 @@ -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) diff --git a/api/funkwhale_api/federation/actors.py b/api/funkwhale_api/federation/actors.py index c6c3bd8167..d42ea575f4 100644 --- a/api/funkwhale_api/federation/actors.py +++ b/api/funkwhale_api/federation/actors.py @@ -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 diff --git a/api/funkwhale_api/federation/authentication.py b/api/funkwhale_api/federation/authentication.py index b669b40048..a12d510346 100644 --- a/api/funkwhale_api/federation/authentication.py +++ b/api/funkwhale_api/federation/authentication.py @@ -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 diff --git a/api/funkwhale_api/federation/dynamic_preferences_registry.py b/api/funkwhale_api/federation/dynamic_preferences_registry.py index 21f4076eac..5119d2596f 100644 --- a/api/funkwhale_api/federation/dynamic_preferences_registry.py +++ b/api/funkwhale_api/federation/dynamic_preferences_registry.py @@ -1,4 +1,3 @@ -from django.forms import widgets from dynamic_preferences import types from dynamic_preferences.registries import global_preferences_registry diff --git a/api/funkwhale_api/federation/keys.py b/api/funkwhale_api/federation/keys.py index fb6f0748c9..bc9416fb85 100644 --- a/api/funkwhale_api/federation/keys.py +++ b/api/funkwhale_api/federation/keys.py @@ -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>.*)\"") diff --git a/api/funkwhale_api/federation/permissions.py b/api/funkwhale_api/federation/permissions.py index ccffb1014c..c1a39a6902 100644 --- a/api/funkwhale_api/federation/permissions.py +++ b/api/funkwhale_api/federation/permissions.py @@ -1,4 +1,3 @@ -from django.conf import settings from rest_framework.permissions import BasePermission diff --git a/api/funkwhale_api/federation/serializers.py b/api/funkwhale_api/federation/serializers.py index 51ae39f0d5..91ad2eb971 100644 --- a/api/funkwhale_api/federation/serializers.py +++ b/api/funkwhale_api/federation/serializers.py @@ -1,13 +1,10 @@ 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 diff --git a/api/funkwhale_api/federation/tasks.py b/api/funkwhale_api/federation/tasks.py index 0e6ee1e609..596755e3b3 100644 --- a/api/funkwhale_api/federation/tasks.py +++ b/api/funkwhale_api/federation/tasks.py @@ -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 diff --git a/api/funkwhale_api/federation/views.py b/api/funkwhale_api/federation/views.py index 87564b5072..84cd27db67 100644 --- a/api/funkwhale_api/federation/views.py +++ b/api/funkwhale_api/federation/views.py @@ -1,24 +1,18 @@ 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 diff --git a/api/funkwhale_api/federation/webfinger.py b/api/funkwhale_api/federation/webfinger.py index b37f02e8a8..fd06d8d564 100644 --- a/api/funkwhale_api/federation/webfinger.py +++ b/api/funkwhale_api/federation/webfinger.py @@ -1,11 +1,9 @@ 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"] diff --git a/api/funkwhale_api/history/models.py b/api/funkwhale_api/history/models.py index 2edc98fbf3..5a72ee4495 100644 --- a/api/funkwhale_api/history/models.py +++ b/api/funkwhale_api/history/models.py @@ -1,6 +1,5 @@ from django.utils import timezone from django.db import models -from django.core.exceptions import ValidationError from funkwhale_api.music.models import Track diff --git a/api/funkwhale_api/history/urls.py b/api/funkwhale_api/history/urls.py index 30e0105c05..2c6209757d 100644 --- a/api/funkwhale_api/history/urls.py +++ b/api/funkwhale_api/history/urls.py @@ -1,4 +1,3 @@ -from django.conf.urls import include, url from . import views from rest_framework import routers diff --git a/api/funkwhale_api/history/views.py b/api/funkwhale_api/history/views.py index 057e6b3238..db45cec692 100644 --- a/api/funkwhale_api/history/views.py +++ b/api/funkwhale_api/history/views.py @@ -1,11 +1,7 @@ -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 diff --git a/api/funkwhale_api/instance/views.py b/api/funkwhale_api/instance/views.py index 69663c1256..35432d4889 100644 --- a/api/funkwhale_api/instance/views.py +++ b/api/funkwhale_api/instance/views.py @@ -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 diff --git a/api/funkwhale_api/manage/filters.py b/api/funkwhale_api/manage/filters.py index 6bb8a1ccc2..2f2bde838f 100644 --- a/api/funkwhale_api/manage/filters.py +++ b/api/funkwhale_api/manage/filters.py @@ -1,4 +1,3 @@ -from django.db.models import Count from django_filters import rest_framework as filters diff --git a/api/funkwhale_api/music/fake_data.py b/api/funkwhale_api/music/fake_data.py index de7b61ef54..e5fd65d8eb 100644 --- a/api/funkwhale_api/music/fake_data.py +++ b/api/funkwhale_api/music/fake_data.py @@ -3,7 +3,6 @@ Populates the database with fake data """ import random -from funkwhale_api.music import models from funkwhale_api.music import factories diff --git a/api/funkwhale_api/music/management/commands/fix_track_files.py b/api/funkwhale_api/music/management/commands/fix_track_files.py index 8f6e4e61d9..c494b05abd 100644 --- a/api/funkwhale_api/music/management/commands/fix_track_files.py +++ b/api/funkwhale_api/music/management/commands/fix_track_files.py @@ -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 diff --git a/api/funkwhale_api/music/migrations/0004_track_tags.py b/api/funkwhale_api/music/migrations/0004_track_tags.py index c00f5edfe9..b999a70313 100644 --- a/api/funkwhale_api/music/migrations/0004_track_tags.py +++ b/api/funkwhale_api/music/migrations/0004_track_tags.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import migrations, models +from django.db import migrations import taggit.managers diff --git a/api/funkwhale_api/music/migrations/0009_auto_20160920_1614.py b/api/funkwhale_api/music/migrations/0009_auto_20160920_1614.py index 2999df60cc..eff0f82a03 100644 --- a/api/funkwhale_api/music/migrations/0009_auto_20160920_1614.py +++ b/api/funkwhale_api/music/migrations/0009_auto_20160920_1614.py @@ -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): diff --git a/api/funkwhale_api/music/migrations/0010_auto_20160920_1742.py b/api/funkwhale_api/music/migrations/0010_auto_20160920_1742.py index dcb4f79504..2b5ce935b7 100644 --- a/api/funkwhale_api/music/migrations/0010_auto_20160920_1742.py +++ b/api/funkwhale_api/music/migrations/0010_auto_20160920_1742.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals from django.db import migrations, models -import versatileimagefield.fields class Migration(migrations.Migration): diff --git a/api/funkwhale_api/music/migrations/0011_rename_files.py b/api/funkwhale_api/music/migrations/0011_rename_files.py index 2b120370cd..2aafb126c5 100644 --- a/api/funkwhale_api/music/migrations/0011_rename_files.py +++ b/api/funkwhale_api/music/migrations/0011_rename_files.py @@ -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): diff --git a/api/funkwhale_api/music/migrations/0012_auto_20161122_1905.py b/api/funkwhale_api/music/migrations/0012_auto_20161122_1905.py index 016d1c110d..0cf1e44f07 100644 --- a/api/funkwhale_api/music/migrations/0012_auto_20161122_1905.py +++ b/api/funkwhale_api/music/migrations/0012_auto_20161122_1905.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import migrations, models +from django.db import migrations import versatileimagefield.fields diff --git a/api/funkwhale_api/music/migrations/0015_bind_track_file_to_import_job.py b/api/funkwhale_api/music/migrations/0015_bind_track_file_to_import_job.py index 6806ea8cad..c8bd1c5e3c 100644 --- a/api/funkwhale_api/music/migrations/0015_bind_track_file_to_import_job.py +++ b/api/funkwhale_api/music/migrations/0015_bind_track_file_to_import_job.py @@ -1,8 +1,7 @@ # -*- 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): diff --git a/api/funkwhale_api/music/migrations/0019_populate_mimetypes.py b/api/funkwhale_api/music/migrations/0019_populate_mimetypes.py index b3fac0d93e..11678efbca 100644 --- a/api/funkwhale_api/music/migrations/0019_populate_mimetypes.py +++ b/api/funkwhale_api/music/migrations/0019_populate_mimetypes.py @@ -1,7 +1,7 @@ # -*- 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 diff --git a/api/funkwhale_api/music/migrations/0021_populate_batch_status.py b/api/funkwhale_api/music/migrations/0021_populate_batch_status.py index 25149bda19..065384a97c 100644 --- a/api/funkwhale_api/music/migrations/0021_populate_batch_status.py +++ b/api/funkwhale_api/music/migrations/0021_populate_batch_status.py @@ -1,7 +1,7 @@ # -*- 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): diff --git a/api/funkwhale_api/music/permissions.py b/api/funkwhale_api/music/permissions.py index a85e5a9a6e..ab35337ec5 100644 --- a/api/funkwhale_api/music/permissions.py +++ b/api/funkwhale_api/music/permissions.py @@ -1,4 +1,3 @@ -from django.conf import settings from rest_framework.permissions import BasePermission diff --git a/api/funkwhale_api/music/serializers.py b/api/funkwhale_api/music/serializers.py index 7aa8603e2c..d39891aca1 100644 --- a/api/funkwhale_api/music/serializers.py +++ b/api/funkwhale_api/music/serializers.py @@ -1,12 +1,8 @@ -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 diff --git a/api/funkwhale_api/music/tasks.py b/api/funkwhale_api/music/tasks.py index 9dcaceec48..dd321e4dd7 100644 --- a/api/funkwhale_api/music/tasks.py +++ b/api/funkwhale_api/music/tasks.py @@ -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 diff --git a/api/funkwhale_api/music/views.py b/api/funkwhale_api/music/views.py index 6c916b62d1..1bb169f53f 100644 --- a/api/funkwhale_api/music/views.py +++ b/api/funkwhale_api/music/views.py @@ -1,32 +1,24 @@ -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 diff --git a/api/funkwhale_api/musicbrainz/__init__.py b/api/funkwhale_api/musicbrainz/__init__.py index 00aa85d5c3..103da679f9 100644 --- a/api/funkwhale_api/musicbrainz/__init__.py +++ b/api/funkwhale_api/musicbrainz/__init__.py @@ -1 +1,3 @@ from .client import api + +__all__ = ["api"] diff --git a/api/funkwhale_api/musicbrainz/urls.py b/api/funkwhale_api/musicbrainz/urls.py index edb4212023..d14447f14a 100644 --- a/api/funkwhale_api/musicbrainz/urls.py +++ b/api/funkwhale_api/musicbrainz/urls.py @@ -1,4 +1,4 @@ -from django.conf.urls import include, url +from django.conf.urls import url from rest_framework import routers from . import views diff --git a/api/funkwhale_api/musicbrainz/views.py b/api/funkwhale_api/musicbrainz/views.py index 64d4ee1523..07271def2d 100644 --- a/api/funkwhale_api/musicbrainz/views.py +++ b/api/funkwhale_api/musicbrainz/views.py @@ -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 diff --git a/api/funkwhale_api/playlists/models.py b/api/funkwhale_api/playlists/models.py index ef787d276f..65ba763237 100644 --- a/api/funkwhale_api/playlists/models.py +++ b/api/funkwhale_api/playlists/models.py @@ -1,4 +1,3 @@ -from django.conf import settings from django.db import models from django.db import transaction from django.utils import timezone diff --git a/api/funkwhale_api/playlists/serializers.py b/api/funkwhale_api/playlists/serializers.py index 3fac68b0e9..94247611db 100644 --- a/api/funkwhale_api/playlists/serializers.py +++ b/api/funkwhale_api/playlists/serializers.py @@ -1,7 +1,5 @@ -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 diff --git a/api/funkwhale_api/playlists/views.py b/api/funkwhale_api/playlists/views.py index f45d8b2720..2b4075ec97 100644 --- a/api/funkwhale_api/playlists/views.py +++ b/api/funkwhale_api/playlists/views.py @@ -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 diff --git a/api/funkwhale_api/providers/urls.py b/api/funkwhale_api/providers/urls.py index 6d001ed9db..55a1193f50 100644 --- a/api/funkwhale_api/providers/urls.py +++ b/api/funkwhale_api/providers/urls.py @@ -1,5 +1,4 @@ from django.conf.urls import include, url -from funkwhale_api.music import views urlpatterns = [ url( diff --git a/api/funkwhale_api/providers/youtube/client.py b/api/funkwhale_api/providers/youtube/client.py index fbc32efa49..94df351660 100644 --- a/api/funkwhale_api/providers/youtube/client.py +++ b/api/funkwhale_api/providers/youtube/client.py @@ -1,8 +1,6 @@ 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 diff --git a/api/funkwhale_api/providers/youtube/urls.py b/api/funkwhale_api/providers/youtube/urls.py index c496a2c69d..710eabcac7 100644 --- a/api/funkwhale_api/providers/youtube/urls.py +++ b/api/funkwhale_api/providers/youtube/urls.py @@ -1,4 +1,4 @@ -from django.conf.urls import include, url +from django.conf.urls import url from .views import APISearch, APISearchs diff --git a/api/funkwhale_api/radios/__init__.py b/api/funkwhale_api/radios/__init__.py index 1258181b5c..e69de29bb2 100644 --- a/api/funkwhale_api/radios/__init__.py +++ b/api/funkwhale_api/radios/__init__.py @@ -1 +0,0 @@ -from .registries import registry diff --git a/api/funkwhale_api/radios/filters.py b/api/funkwhale_api/radios/filters.py index cb08e46ed2..72e18caf54 100644 --- a/api/funkwhale_api/radios/filters.py +++ b/api/funkwhale_api/radios/filters.py @@ -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): diff --git a/api/funkwhale_api/radios/models.py b/api/funkwhale_api/radios/models.py index af0fa26da2..69f13f9f46 100644 --- a/api/funkwhale_api/radios/models.py +++ b/api/funkwhale_api/radios/models.py @@ -1,6 +1,5 @@ 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) diff --git a/api/funkwhale_api/radios/urls.py b/api/funkwhale_api/radios/urls.py index 3f48455b06..66c6f37e8e 100644 --- a/api/funkwhale_api/radios/urls.py +++ b/api/funkwhale_api/radios/urls.py @@ -1,4 +1,3 @@ -from django.conf.urls import include, url from . import views from rest_framework import routers diff --git a/api/funkwhale_api/radios/views.py b/api/funkwhale_api/radios/views.py index 8478f49e07..4fdd192e62 100644 --- a/api/funkwhale_api/radios/views.py +++ b/api/funkwhale_api/radios/views.py @@ -1,14 +1,13 @@ 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 diff --git a/api/funkwhale_api/requests/api_urls.py b/api/funkwhale_api/requests/api_urls.py index c7c1a103bd..309eba7cdd 100644 --- a/api/funkwhale_api/requests/api_urls.py +++ b/api/funkwhale_api/requests/api_urls.py @@ -1,4 +1,3 @@ -from django.conf.urls import include, url from . import views from rest_framework import routers diff --git a/api/funkwhale_api/requests/views.py b/api/funkwhale_api/requests/views.py index 4b68555a87..e940c7896f 100644 --- a/api/funkwhale_api/requests/views.py +++ b/api/funkwhale_api/requests/views.py @@ -1,7 +1,4 @@ -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 diff --git a/api/funkwhale_api/subsonic/dynamic_preferences_registry.py b/api/funkwhale_api/subsonic/dynamic_preferences_registry.py index 0916b0a3e9..1353ce32c0 100644 --- a/api/funkwhale_api/subsonic/dynamic_preferences_registry.py +++ b/api/funkwhale_api/subsonic/dynamic_preferences_registry.py @@ -1,7 +1,6 @@ from dynamic_preferences import types from dynamic_preferences.registries import global_preferences_registry -from funkwhale_api.common import preferences subsonic = types.Section("subsonic") diff --git a/api/funkwhale_api/users/models.py b/api/funkwhale_api/users/models.py index 281fc4fe8d..30320e14b9 100644 --- a/api/funkwhale_api/users/models.py +++ b/api/funkwhale_api/users/models.py @@ -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 diff --git a/api/tests/activity/test_record.py b/api/tests/activity/test_record.py index 98cefaba21..69d3a28cfa 100644 --- a/api/tests/activity/test_record.py +++ b/api/tests/activity/test_record.py @@ -1,4 +1,3 @@ -import pytest from django.db import models from rest_framework import serializers diff --git a/api/tests/conftest.py b/api/tests/conftest.py index 787831b004..8027ef0ba0 100644 --- a/api/tests/conftest.py +++ b/api/tests/conftest.py @@ -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) diff --git a/api/tests/favorites/test_favorites.py b/api/tests/favorites/test_favorites.py index 345c24bdee..8bf7f25b43 100644 --- a/api/tests/favorites/test_favorites.py +++ b/api/tests/favorites/test_favorites.py @@ -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 diff --git a/api/tests/federation/test_actors.py b/api/tests/federation/test_actors.py index f978079dc5..278b10af21 100644 --- a/api/tests/federation/test_actors.py +++ b/api/tests/federation/test_actors.py @@ -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 diff --git a/api/tests/federation/test_authentication.py b/api/tests/federation/test_authentication.py index 566a3368dd..ea86b64a4c 100644 --- a/api/tests/federation/test_authentication.py +++ b/api/tests/federation/test_authentication.py @@ -1,6 +1,5 @@ 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): diff --git a/api/tests/federation/test_models.py b/api/tests/federation/test_models.py index c5defcfee3..08e629ded5 100644 --- a/api/tests/federation/test_models.py +++ b/api/tests/federation/test_models.py @@ -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): diff --git a/api/tests/federation/test_serializers.py b/api/tests/federation/test_serializers.py index ffcbd441df..2d3bad358d 100644 --- a/api/tests/federation/test_serializers.py +++ b/api/tests/federation/test_serializers.py @@ -1,11 +1,9 @@ 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 diff --git a/api/tests/federation/test_signing.py b/api/tests/federation/test_signing.py index 1ebaaf8262..611f2d735f 100644 --- a/api/tests/federation/test_signing.py +++ b/api/tests/federation/test_signing.py @@ -1,6 +1,5 @@ import cryptography.exceptions import pytest -import requests_http_signature from funkwhale_api.federation import signing from funkwhale_api.federation import keys diff --git a/api/tests/federation/test_tasks.py b/api/tests/federation/test_tasks.py index f6fafffd60..068578c5ec 100644 --- a/api/tests/federation/test_tasks.py +++ b/api/tests/federation/test_tasks.py @@ -1,7 +1,6 @@ import datetime import os import pathlib -import pytest from django.core.paginator import Paginator from django.utils import timezone diff --git a/api/tests/federation/test_webfinger.py b/api/tests/federation/test_webfinger.py index 1b7db92789..de6112713f 100644 --- a/api/tests/federation/test_webfinger.py +++ b/api/tests/federation/test_webfinger.py @@ -1,7 +1,6 @@ import pytest from django import forms -from django.urls import reverse from funkwhale_api.federation import webfinger diff --git a/api/tests/history/test_history.py b/api/tests/history/test_history.py index e43e79ba70..fcf34dadf5 100644 --- a/api/tests/history/test_history.py +++ b/api/tests/history/test_history.py @@ -1,6 +1,4 @@ from django.urls import reverse -from django.core.exceptions import ValidationError -from django.utils import timezone from funkwhale_api.history import models diff --git a/api/tests/instance/test_nodeinfo.py b/api/tests/instance/test_nodeinfo.py index 3c2fa862ee..7637ca319f 100644 --- a/api/tests/instance/test_nodeinfo.py +++ b/api/tests/instance/test_nodeinfo.py @@ -1,4 +1,3 @@ -from django.urls import reverse import funkwhale_api diff --git a/api/tests/instance/test_preferences.py b/api/tests/instance/test_preferences.py index 85932145b5..cf73c7c805 100644 --- a/api/tests/instance/test_preferences.py +++ b/api/tests/instance/test_preferences.py @@ -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): diff --git a/api/tests/instance/test_stats.py b/api/tests/instance/test_stats.py index 9e60d1cdd4..d42b47c037 100644 --- a/api/tests/instance/test_stats.py +++ b/api/tests/instance/test_stats.py @@ -1,4 +1,3 @@ -from django.urls import reverse from funkwhale_api.instance import stats diff --git a/api/tests/music/test_activity.py b/api/tests/music/test_activity.py index 0d9879300c..5286f1fef1 100644 --- a/api/tests/music/test_activity.py +++ b/api/tests/music/test_activity.py @@ -1,5 +1,3 @@ -from funkwhale_api.users.serializers import UserActivitySerializer -from funkwhale_api.favorites import serializers def test_get_track_activity_url_mbid(factories): diff --git a/api/tests/music/test_api.py b/api/tests/music/test_api.py index d7d37bd4b1..11b3e92732 100644 --- a/api/tests/music/test_api.py +++ b/api/tests/music/test_api.py @@ -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 diff --git a/api/tests/music/test_import.py b/api/tests/music/test_import.py index aae3583ed4..13e8343fcf 100644 --- a/api/tests/music/test_import.py +++ b/api/tests/music/test_import.py @@ -1,6 +1,5 @@ import json import os -import pytest from django.urls import reverse diff --git a/api/tests/music/test_lyrics.py b/api/tests/music/test_lyrics.py index 5d97c7ae20..81bbbe4810 100644 --- a/api/tests/music/test_lyrics.py +++ b/api/tests/music/test_lyrics.py @@ -1,8 +1,6 @@ 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 diff --git a/api/tests/music/test_tasks.py b/api/tests/music/test_tasks.py index f38f414391..01e6d91ac5 100644 --- a/api/tests/music/test_tasks.py +++ b/api/tests/music/test_tasks.py @@ -1,7 +1,6 @@ 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__)) diff --git a/api/tests/music/test_works.py b/api/tests/music/test_works.py index 0d3c11ff0d..bd69c8ab97 100644 --- a/api/tests/music/test_works.py +++ b/api/tests/music/test_works.py @@ -1,8 +1,5 @@ -from django.urls import reverse from funkwhale_api.music import models -from funkwhale_api.musicbrainz import api -from funkwhale_api.music import serializers def test_can_import_work(factories, mocker, works): diff --git a/api/tests/musicbrainz/test_api.py b/api/tests/musicbrainz/test_api.py index a9f76890ee..f1f9912c40 100644 --- a/api/tests/musicbrainz/test_api.py +++ b/api/tests/musicbrainz/test_api.py @@ -1,6 +1,5 @@ from django.urls import reverse -from funkwhale_api.musicbrainz import api def test_can_search_recording_in_musicbrainz_api( diff --git a/api/tests/playlists/test_views.py b/api/tests/playlists/test_views.py index 2cb1184721..a675993e72 100644 --- a/api/tests/playlists/test_views.py +++ b/api/tests/playlists/test_views.py @@ -1,8 +1,6 @@ import pytest from django.urls import reverse -from django.core.exceptions import ValidationError -from django.utils import timezone from funkwhale_api.playlists import models from funkwhale_api.playlists import serializers diff --git a/api/tests/radios/test_api.py b/api/tests/radios/test_api.py index 4a72d81ba0..5f19128007 100644 --- a/api/tests/radios/test_api.py +++ b/api/tests/radios/test_api.py @@ -1,5 +1,4 @@ import json -import pytest from django.urls import reverse diff --git a/api/tests/requests/test_models.py b/api/tests/requests/test_models.py index d6b71635af..f23fc9ef2e 100644 --- a/api/tests/requests/test_models.py +++ b/api/tests/requests/test_models.py @@ -1,6 +1,4 @@ -import pytest -from django.forms import ValidationError def test_can_bind_import_batch_to_request(factories): diff --git a/api/tests/test_import_audio_file.py b/api/tests/test_import_audio_file.py index b9961a0022..38b7d2620e 100644 --- a/api/tests/test_import_audio_file.py +++ b/api/tests/test_import_audio_file.py @@ -6,7 +6,6 @@ from django.core.management import call_command from django.core.management.base import CommandError from funkwhale_api.providers.audiofile import tasks -from funkwhale_api.music import tasks as music_tasks DATA_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "files") diff --git a/api/tests/users/test_jwt.py b/api/tests/users/test_jwt.py index 771a42efa5..e4038b1edb 100644 --- a/api/tests/users/test_jwt.py +++ b/api/tests/users/test_jwt.py @@ -3,7 +3,6 @@ import pytest from jwt.exceptions import DecodeError from rest_framework_jwt.settings import api_settings -from funkwhale_api.users.models import User def test_can_invalidate_token_when_changing_user_secret_key(factories): diff --git a/api/tests/users/test_views.py b/api/tests/users/test_views.py index 78d6aa4bd9..fa5793e9b9 100644 --- a/api/tests/users/test_views.py +++ b/api/tests/users/test_views.py @@ -1,6 +1,5 @@ import pytest -from django.test import RequestFactory from django.urls import reverse from funkwhale_api.users.models import User -- GitLab