Fix flake8 errors

This commit is contained in:
Andrew Godwin 2016-02-05 16:26:05 -08:00
parent 1dab70ed86
commit 13766a3027
3 changed files with 9 additions and 8 deletions

View File

@ -1,12 +1,12 @@
import base64
import datetime import datetime
import json import json
import random import random
import string import string
import time import time
import base64
from django.apps.registry import Apps from django.apps.registry import Apps
from django.db import DEFAULT_DB_ALIAS, IntegrityError, connections, models from django.db import DEFAULT_DB_ALIAS, connections, models
from django.utils import six from django.utils import six
from django.utils.functional import cached_property from django.utils.functional import cached_property
from django.utils.timezone import now from django.utils.timezone import now
@ -30,7 +30,7 @@ class DatabaseChannelLayer(object):
self.expiry = expiry self.expiry = expiry
self.db_alias = db_alias self.db_alias = db_alias
### ASGI API ### # ASGI API
extensions = ["groups", "flush"] extensions = ["groups", "flush"]
@ -75,7 +75,7 @@ class DatabaseChannelLayer(object):
if not self.channel_model.objects.filter(channel=new_name).exists(): if not self.channel_model.objects.filter(channel=new_name).exists():
return new_name return new_name
### ASGI Group extension ### # ASGI Group extension
def group_add(self, group, channel): def group_add(self, group, channel):
""" """
@ -102,13 +102,13 @@ class DatabaseChannelLayer(object):
for channel in self.group_model.objects.filter(group=group).values_list("channel", flat=True): for channel in self.group_model.objects.filter(group=group).values_list("channel", flat=True):
self.send(channel, message) self.send(channel, message)
### ASGI Flush extension ### # ASGI Flush extension
def flush(self): def flush(self):
self.channel_model.objects.all().delete() self.channel_model.objects.all().delete()
self.group_model.objects.all().delete() self.group_model.objects.all().delete()
### Serialization ### # Serialization
def serialize(self, message): def serialize(self, message):
return AsgiJsonEncoder().encode(message) return AsgiJsonEncoder().encode(message)
@ -116,7 +116,7 @@ class DatabaseChannelLayer(object):
def deserialize(self, message): def deserialize(self, message):
return AsgiJsonDecoder().decode(message) return AsgiJsonDecoder().decode(message)
### Database state mgmt ### # Database state mgmt
@property @property
def connection(self): def connection(self):

View File

@ -15,6 +15,7 @@ def linearize(func):
ordering, just linearity. ordering, just linearity.
""" """
raise NotImplementedError("Not yet reimplemented") raise NotImplementedError("Not yet reimplemented")
@functools.wraps(func) @functools.wraps(func)
def inner(message, *args, **kwargs): def inner(message, *args, **kwargs):
# Make sure there's a reply channel # Make sure there's a reply channel

View File

@ -1,6 +1,6 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.core.management import BaseCommand, CommandError from django.core.management import BaseCommand
from channels import channel_layers, DEFAULT_CHANNEL_LAYER from channels import channel_layers, DEFAULT_CHANNEL_LAYER
from channels.log import setup_logger from channels.log import setup_logger
from channels.handler import ViewConsumer from channels.handler import ViewConsumer