From 37923c3674323f51be787092db6dd8b17c4f1265 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Mon, 4 Apr 2016 03:38:38 +0200 Subject: [PATCH] Flake8 fixes --- channels/routing.py | 2 +- channels/tests/__init__.py | 2 +- channels/tests/test_request.py | 2 ++ patchinator.py | 12 +++++++----- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/channels/routing.py b/channels/routing.py index 0806bd5..c311658 100644 --- a/channels/routing.py +++ b/channels/routing.py @@ -141,7 +141,7 @@ class Route(object): """ Returns the channel names this route listens on """ - return {self.channel,} + return {self.channel, } def __str__(self): return "%s %s -> %s" % ( diff --git a/channels/tests/__init__.py b/channels/tests/__init__.py index 566d872..a43624d 100644 --- a/channels/tests/__init__.py +++ b/channels/tests/__init__.py @@ -1 +1 @@ -from .base import ChannelTestCase +from .base import ChannelTestCase # NOQA isort:skip diff --git a/channels/tests/test_request.py b/channels/tests/test_request.py index 52712a4..a59a2b8 100644 --- a/channels/tests/test_request.py +++ b/channels/tests/test_request.py @@ -212,8 +212,10 @@ class RequestTests(ChannelTestCase): "content": b"re=fou", "more_content": True, }) + class VeryImpatientRequest(AsgiRequest): body_receive_timeout = 0 + with self.assertRaises(RequestTimeout): VeryImpatientRequest(self.get_next_message("test")) diff --git a/patchinator.py b/patchinator.py index dc283ea..97de4a9 100644 --- a/patchinator.py +++ b/patchinator.py @@ -12,7 +12,7 @@ import os.path import sys -### Transforms: Turn one content string into another ### +# Transforms: Turn one content string into another class Replacement(object): """ @@ -45,10 +45,10 @@ class Insert(object): if self.after: return value[:match.end()] + self.to_insert + value[match.end():] else: - return value[:match.start()] + self.to_insert + value[match.start():] + return value[:match.start()] + self.to_insert + value[match.start():] -### Operations: Copy or patch files ### +# Operations: Copy or patch files class FileMap(object): """ @@ -98,7 +98,7 @@ class NewFile(object): fh.write(self.content) -### Main class ### +# Main class and config global_transforms = [ @@ -154,7 +154,9 @@ class Patchinator(object): "channels/worker.py", "django/channels/worker.py", global_transforms, ), FileMap( - "channels/management/commands/runworker.py", "django/core/management/commands/runworker.py", global_transforms, + "channels/management/commands/runworker.py", + "django/core/management/commands/runworker.py", + global_transforms, ), # Tests FileMap(