chore(api): fix some linting errors

This commit is contained in:
jo 2022-06-22 13:27:10 +02:00 committed by Kyle Robbertze
parent 1e83a91b5e
commit ec8c18097d
6 changed files with 7 additions and 8 deletions

View File

@ -1,4 +1,3 @@
import os
from pathlib import Path from pathlib import Path
from typing import Optional, Tuple from typing import Optional, Tuple
from xml.etree import ElementTree from xml.etree import ElementTree

View File

@ -52,7 +52,7 @@ class PlaylistContent(models.Model):
fadeout = models.TimeField(blank=True, null=True) fadeout = models.TimeField(blank=True, null=True)
def get_owner(self): def get_owner(self):
return self.playlist.owner return self.playlist.get_owner()
class Meta: class Meta:
managed = False managed = False

View File

@ -99,7 +99,7 @@ class TestScheduleViewSet(APITestCase):
instance=show, instance=show,
file=file, file=file,
) )
invalid_schedule_item = baker.make( invalid_schedule_item = baker.make( # pylint: disable=unused-variable
"schedule.Schedule", "schedule.Schedule",
starts=show.ends + timedelta(minutes=1), starts=show.ends + timedelta(minutes=1),
ends=show.ends + timedelta(minutes=1) + file.length, ends=show.ends + timedelta(minutes=1) + file.length,
@ -142,7 +142,7 @@ class TestScheduleViewSet(APITestCase):
instance=show, instance=show,
file=file, file=file,
) )
previous_item = baker.make( previous_item = baker.make( # pylint: disable=unused-variable
"schedule.Schedule", "schedule.Schedule",
starts=filter_point - timedelta(minutes=5), starts=filter_point - timedelta(minutes=5),
ends=filter_point - timedelta(minutes=5) + file.length, ends=filter_point - timedelta(minutes=5) + file.length,

View File

@ -2,7 +2,7 @@ from django.conf import settings
from model_bakery import baker from model_bakery import baker
from rest_framework.test import APITestCase from rest_framework.test import APITestCase
from ...._fixtures import AUDIO_FILENAME, fixture_path from ...._fixtures import AUDIO_FILENAME
class TestFileViewSet(APITestCase): class TestFileViewSet(APITestCase):

View File

@ -17,7 +17,7 @@ class FileViewSet(viewsets.ModelViewSet):
model_permission_name = "file" model_permission_name = "file"
@action(detail=True, methods=["GET"]) @action(detail=True, methods=["GET"])
def download(self, request, pk=None): def download(self, request, pk=None): # pylint: disable=invalid-name
pk = IntegerField().to_internal_value(data=pk) pk = IntegerField().to_internal_value(data=pk)
file = get_object_or_404(File, pk=pk) file = get_object_or_404(File, pk=pk)

View File

@ -51,7 +51,7 @@ class TestPermissions(APITestCase):
"webstreams", "webstreams",
] ]
def logged_in_test_model(self, model, role, username, fn): def logged_in_test_model(self, model, role, username, function):
path = self.path.format(model) path = self.path.format(model)
if not get_user_model().objects.filter(username=username): if not get_user_model().objects.filter(username=username):
get_user_model().objects.create_user( get_user_model().objects.create_user(
@ -63,7 +63,7 @@ class TestPermissions(APITestCase):
last_name="user", last_name="user",
) )
self.client.login(username=username, password="test") self.client.login(username=username, password="test")
return fn(path) return function(path)
@classmethod @classmethod
def setUpTestData(cls): def setUpTestData(cls):