From 942e9a15cb8b7bda513a6a1b68c4bcf5b215d154 Mon Sep 17 00:00:00 2001
From: Eliot Berriot <contact@eliotberriot.com>
Date: Thu, 27 Dec 2018 20:39:03 +0100
Subject: [PATCH] Linting

---
 api/funkwhale_api/federation/serializers.py | 8 ++------
 api/funkwhale_api/manage/views.py           | 2 +-
 api/funkwhale_api/music/models.py           | 3 ++-
 api/tests/manage/test_views.py              | 4 +---
 4 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/api/funkwhale_api/federation/serializers.py b/api/funkwhale_api/federation/serializers.py
index 7d00476a..1cece3b9 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 cee9d537..98ba220e 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 1bc2a143..e36da4ee 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 95ffea46..d47a231e 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
-- 
GitLab