resolve flake8 errors

This commit is contained in:
Jan Koppe 2020-04-20 14:51:44 +02:00
parent 97135c90a5
commit bda78d892a
Signed by: thunfisch
GPG Key ID: BE935B0735A2129B
11 changed files with 34 additions and 32 deletions

View File

@ -4,6 +4,5 @@ from django.apps import AppConfig
class RestreamConfig(AppConfig): class RestreamConfig(AppConfig):
name = 'restream' name = 'restream'
def ready(self): def ready(self):
import restream.signals # noqa import restream.signals # noqa

View File

@ -2,7 +2,8 @@ from django.db import models
# Create your models here. # Create your models here.
from srs.models import Application, Streamkey from srs.models import Streamkey
class RestreamConfig(models.Model): class RestreamConfig(models.Model):
streamkey = models.ForeignKey(Streamkey, on_delete=models.CASCADE) streamkey = models.ForeignKey(Streamkey, on_delete=models.CASCADE)

View File

@ -10,11 +10,13 @@ from srs.models import Streamkey
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@receiver(on_unpublish) @receiver(on_unpublish)
def callback_on_unpublish(sender, **kwargs): def callback_on_unpublish(sender, **kwargs):
logger.info("stop publish - {}".format(kwargs['name'])) logger.info("stop publish - {}".format(kwargs['name']))
celery.send_task('main.stop_restream', kwargs={'name': kwargs['name']}) celery.send_task('main.stop_restream', kwargs={'name': kwargs['name']})
@receiver(on_publish) @receiver(on_publish)
def callback_on_publish(sender, **kwargs): def callback_on_publish(sender, **kwargs):
logger.info("start publish - {}".format(kwargs['name'])) logger.info("start publish - {}".format(kwargs['name']))

View File

@ -1,3 +1,3 @@
from django.test import TestCase from django.test import TestCase # noqa
# Create your tests here. # Create your tests here.

View File

@ -1,3 +1,3 @@
from django.shortcuts import render from django.shortcuts import render # noqa
# Create your views here. # Create your views here.

View File

@ -14,6 +14,7 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name='streamkey', model_name='streamkey',
name='key', name='key',
field=models.CharField(default=uuid.UUID('b5777854-4533-49dc-b38d-69738d8844d6'), max_length=64, unique=True), field=models.CharField(default=uuid.UUID('b5777854-4533-49dc-b38d-69738d8844d6'),
max_length=64, unique=True),
), ),
] ]

View File

@ -1,13 +1,12 @@
from django.db import models from django.db import models
from django.conf import settings
import uuid import uuid
from . import signals from . import signals
class Application(models.Model): class Application(models.Model):
name = models.CharField(max_length=100, unique=True) name = models.CharField(max_length=100, unique=True)
def __str__(self): def __str__(self):
return self.name return self.name

View File

@ -1,3 +1,3 @@
from django.test import TestCase from django.test import TestCase # noqa
# Create your tests here. # Create your tests here.

View File

@ -2,7 +2,6 @@ import json
import logging import logging
from django.http import HttpResponse from django.http import HttpResponse
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.csrf import csrf_exempt
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
@ -10,6 +9,7 @@ from . import models
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@csrf_exempt @csrf_exempt
def callback(request): def callback(request):
if request.method != 'POST': if request.method != 'POST':