diff --git a/api/funkwhale_api/federation/serializers.py b/api/funkwhale_api/federation/serializers.py index 7d00476af..1cece3b97 100644 --- a/api/funkwhale_api/federation/serializers.py +++ b/api/funkwhale_api/federation/serializers.py @@ -114,8 +114,7 @@ class ActorSerializer(serializers.Serializer): if maf is not None: kwargs["manually_approves_followers"] = maf domain = urllib.parse.urlparse(kwargs["fid"]).netloc - kwargs["domain"] = models.Domain.objects.get_or_create( - pk=domain)[0] + kwargs["domain"] = models.Domain.objects.get_or_create(pk=domain)[0] for endpoint, url in self.initial_data.get("endpoints", {}).items(): if endpoint == "sharedInbox": kwargs["shared_inbox_url"] = url @@ -897,7 +896,4 @@ class NodeInfoLinkSerializer(serializers.Serializer): class NodeInfoSerializer(serializers.Serializer): - links = serializers.ListField( - child=NodeInfoLinkSerializer(), - min_length=1 - ) \ No newline at end of file + links = serializers.ListField(child=NodeInfoLinkSerializer(), min_length=1) diff --git a/api/funkwhale_api/manage/views.py b/api/funkwhale_api/manage/views.py index cee9d537d..98ba220e5 100644 --- a/api/funkwhale_api/manage/views.py +++ b/api/funkwhale_api/manage/views.py @@ -99,7 +99,7 @@ class ManageInvitationViewSet( class ManageDomainViewSet( mixins.ListModelMixin, mixins.RetrieveModelMixin, viewsets.GenericViewSet ): - lookup_value_regex = "[a-zA-Z0-9\-\.]+" + lookup_value_regex = r"[a-zA-Z0-9\-\.]+" queryset = ( federation_models.Domain.objects.external() .with_last_activity_date() diff --git a/api/funkwhale_api/music/models.py b/api/funkwhale_api/music/models.py index 1bc2a1436..e36da4ee3 100644 --- a/api/funkwhale_api/music/models.py +++ b/api/funkwhale_api/music/models.py @@ -618,7 +618,8 @@ class UploadQuerySet(models.QuerySet): return self.filter(import_status="finished", mimetype__startswith="audio/") def with_file(self): - return self.exclude(audio_file=None).exclude(audio_file='') + return self.exclude(audio_file=None).exclude(audio_file="") + TRACK_FILE_IMPORT_STATUS_CHOICES = ( ("pending", "Pending"), diff --git a/api/tests/manage/test_views.py b/api/tests/manage/test_views.py index 95ffea46d..d47a231e8 100644 --- a/api/tests/manage/test_views.py +++ b/api/tests/manage/test_views.py @@ -107,9 +107,7 @@ def test_domain_nodeinfo(factories, superuser_api_client, mocker): def test_domain_stats(factories, superuser_api_client, mocker): domain = factories["federation.Domain"]() - get_stats = mocker.patch.object( - domain.__class__, "get_stats", return_value={"hello": "world"} - ) + mocker.patch.object(domain.__class__, "get_stats", return_value={"hello": "world"}) url = reverse("api:v1:manage:federation:domains-stats", kwargs={"pk": domain.name}) response = superuser_api_client.get(url) assert response.status_code == 200