From 13766a3027e58905b46bb069063c627c15214fb3 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Fri, 5 Feb 2016 16:26:05 -0800 Subject: [PATCH] Fix flake8 errors --- channels/database_layer.py | 14 +++++++------- channels/decorators.py | 1 + channels/management/commands/runworker.py | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/channels/database_layer.py b/channels/database_layer.py index 1b31068..46df924 100644 --- a/channels/database_layer.py +++ b/channels/database_layer.py @@ -1,12 +1,12 @@ +import base64 import datetime import json import random import string import time -import base64 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.functional import cached_property from django.utils.timezone import now @@ -30,7 +30,7 @@ class DatabaseChannelLayer(object): self.expiry = expiry self.db_alias = db_alias - ### ASGI API ### + # ASGI API extensions = ["groups", "flush"] @@ -75,7 +75,7 @@ class DatabaseChannelLayer(object): if not self.channel_model.objects.filter(channel=new_name).exists(): return new_name - ### ASGI Group extension ### + # ASGI Group extension 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): self.send(channel, message) - ### ASGI Flush extension ### + # ASGI Flush extension def flush(self): self.channel_model.objects.all().delete() self.group_model.objects.all().delete() - ### Serialization ### + # Serialization def serialize(self, message): return AsgiJsonEncoder().encode(message) @@ -116,7 +116,7 @@ class DatabaseChannelLayer(object): def deserialize(self, message): return AsgiJsonDecoder().decode(message) - ### Database state mgmt ### + # Database state mgmt @property def connection(self): diff --git a/channels/decorators.py b/channels/decorators.py index 295ab3d..063447a 100644 --- a/channels/decorators.py +++ b/channels/decorators.py @@ -15,6 +15,7 @@ def linearize(func): ordering, just linearity. """ raise NotImplementedError("Not yet reimplemented") + @functools.wraps(func) def inner(message, *args, **kwargs): # Make sure there's a reply channel diff --git a/channels/management/commands/runworker.py b/channels/management/commands/runworker.py index 294741b..5406548 100644 --- a/channels/management/commands/runworker.py +++ b/channels/management/commands/runworker.py @@ -1,6 +1,6 @@ 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.log import setup_logger from channels.handler import ViewConsumer