Sort imports and make Travis run isort (#425)

* Sort imports

* Make Travis run isort
This commit is contained in:
Paul 2016-11-05 12:08:38 +01:00 committed by Andrew Godwin
parent bc33763907
commit f4f45dbb9f
23 changed files with 60 additions and 55 deletions

View File

@ -1,13 +1,11 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import six import six
from django.apps import apps from django.apps import apps
from django.db.models.signals import post_save, post_delete, pre_save, pre_delete from django.db.models.signals import post_delete, post_save, pre_delete, pre_save
from ..channel import Group
from ..auth import channel_session, channel_session_user from ..auth import channel_session, channel_session_user
from ..channel import Group
CREATE = 'create' CREATE = 'create'
UPDATE = 'update' UPDATE = 'update'

View File

@ -3,9 +3,9 @@ import json
from django.core import serializers from django.core import serializers
from django.core.serializers.json import DjangoJSONEncoder from django.core.serializers.json import DjangoJSONEncoder
from .base import Binding
from ..generic.websockets import WebsocketDemultiplexer from ..generic.websockets import WebsocketDemultiplexer
from ..sessions import enforce_ordering from ..sessions import enforce_ordering
from .base import Binding
class WebsocketBinding(Binding): class WebsocketBinding(Binding):

View File

@ -1,7 +1,8 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from ..auth import channel_session_user
from ..routing import route_class from ..routing import route_class
from ..sessions import channel_session from ..sessions import channel_session
from ..auth import channel_session_user
class BaseConsumer(object): class BaseConsumer(object):

View File

@ -1,7 +1,7 @@
from django.core.serializers.json import json, DjangoJSONEncoder from django.core.serializers.json import DjangoJSONEncoder, json
from ..channel import Group, Channel
from ..auth import channel_session_user_from_http from ..auth import channel_session_user_from_http
from ..channel import Channel, Group
from ..sessions import enforce_ordering from ..sessions import enforce_ordering
from .base import BaseConsumer from .base import BaseConsumer

View File

@ -17,7 +17,7 @@ from django.http import FileResponse, HttpResponse, HttpResponseServerError
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 channels.exceptions import ResponseLater as ResponseLaterOuter, RequestTimeout, RequestAborted from channels.exceptions import RequestAborted, RequestTimeout, ResponseLater as ResponseLaterOuter
logger = logging.getLogger('django.request') logger = logging.getLogger('django.request')

View File

@ -4,8 +4,7 @@ import threading
from daphne.server import Server from daphne.server import Server
from django.conf import settings from django.conf import settings
from django.core.management.commands.runserver import \ from django.core.management.commands.runserver import Command as RunserverCommand
Command as RunserverCommand
from django.utils import six from django.utils import six
from django.utils.encoding import get_system_encoding from django.utils.encoding import get_system_encoding

View File

@ -5,9 +5,9 @@ from django.core.management import BaseCommand, CommandError
from channels import DEFAULT_CHANNEL_LAYER, channel_layers from channels import DEFAULT_CHANNEL_LAYER, channel_layers
from channels.log import setup_logger from channels.log import setup_logger
from channels.signals import worker_process_ready
from channels.staticfiles import StaticFilesConsumer from channels.staticfiles import StaticFilesConsumer
from channels.worker import Worker, WorkerGroup from channels.worker import Worker, WorkerGroup
from channels.signals import worker_process_ready
class Command(BaseCommand): class Command(BaseCommand):

View File

@ -1,4 +1,5 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import copy import copy
import threading import threading

View File

@ -1,7 +1,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import re
import importlib import importlib
import re
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.utils import six from django.utils import six

View File

@ -1,7 +1,6 @@
from django.db import close_old_connections from django.db import close_old_connections
from django.dispatch import Signal from django.dispatch import Signal
consumer_started = Signal(providing_args=["environ"]) consumer_started = Signal(providing_args=["environ"])
consumer_finished = Signal() consumer_finished = Signal()
worker_ready = Signal() worker_ready = Signal()

View File

@ -5,14 +5,15 @@ import random
import string import string
from functools import wraps from functools import wraps
from django.test.testcases import TestCase, TransactionTestCase
from .. import DEFAULT_CHANNEL_LAYER
from ..channel import Group
from ..routing import Router, include
from ..asgi import channel_layers, ChannelLayerWrapper
from ..message import Message
from ..signals import consumer_finished, consumer_started
from asgiref.inmemory import ChannelLayer as InMemoryChannelLayer from asgiref.inmemory import ChannelLayer as InMemoryChannelLayer
from django.test.testcases import TestCase, TransactionTestCase
from .. import DEFAULT_CHANNEL_LAYER
from ..asgi import ChannelLayerWrapper, channel_layers
from ..channel import Group
from ..message import Message
from ..routing import Router, include
from ..signals import consumer_finished, consumer_started
class ChannelTestCaseMixin(object): class ChannelTestCaseMixin(object):

View File

@ -1,8 +1,7 @@
import json
import copy import copy
import json
import six import six
from django.apps import apps from django.apps import apps
from django.conf import settings from django.conf import settings

View File

@ -1,13 +1,15 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import json import json
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from channels.binding.base import CREATE, UPDATE, DELETE
from channels import Group, route
from channels.binding.base import CREATE, DELETE, UPDATE
from channels.binding.websockets import WebsocketBinding from channels.binding.websockets import WebsocketBinding
from channels.generic.websockets import WebsocketDemultiplexer from channels.generic.websockets import WebsocketDemultiplexer
from channels.tests import ChannelTestCase, apply_routes, HttpClient
from channels.signals import consumer_finished from channels.signals import consumer_finished
from channels import route, Group from channels.tests import ChannelTestCase, HttpClient, apply_routes
User = get_user_model() User = get_user_model()

View File

@ -1,10 +1,10 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.test import override_settings from django.test import override_settings
from channels import route_class from channels import route_class
from channels.generic import BaseConsumer, websockets from channels.generic import BaseConsumer, websockets
from channels.tests import ChannelTestCase from channels.tests import ChannelTestCase, Client, apply_routes
from channels.tests import apply_routes, Client
@override_settings(SESSION_ENGINE="django.contrib.sessions.backends.cache") @override_settings(SESSION_ENGINE="django.contrib.sessions.backends.cache")

View File

@ -4,16 +4,13 @@ import os
from datetime import datetime from datetime import datetime
from itertools import islice from itertools import islice
from django.http import ( from django.http import FileResponse, HttpResponse, HttpResponseRedirect, JsonResponse, StreamingHttpResponse
FileResponse, HttpResponse, HttpResponseRedirect, JsonResponse,
StreamingHttpResponse,
)
from six import BytesIO from six import BytesIO
from channels import Channel from channels import Channel
from channels.handler import AsgiHandler from channels.handler import AsgiHandler
from channels.tests import ChannelTestCase
from channels.signals import consumer_finished from channels.signals import consumer_finished
from channels.tests import ChannelTestCase
class FakeAsgiHandler(AsgiHandler): class FakeAsgiHandler(AsgiHandler):

View File

@ -4,11 +4,11 @@ import logging
from asgiref.inmemory import ChannelLayer from asgiref.inmemory import ChannelLayer
from django.core.management import CommandError, call_command from django.core.management import CommandError, call_command
from channels.staticfiles import StaticFilesConsumer
from django.test import TestCase, mock from django.test import TestCase, mock
from six import StringIO from six import StringIO
from channels.management.commands import runserver from channels.management.commands import runserver
from channels.staticfiles import StaticFilesConsumer
class FakeChannelLayer(ChannelLayer): class FakeChannelLayer(ChannelLayer):

View File

@ -1,10 +1,11 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.utils import six from django.utils import six
from channels import Channel from channels import Channel
from channels.tests import ChannelTestCase from channels.exceptions import RequestAborted, RequestTimeout
from channels.handler import AsgiRequest from channels.handler import AsgiRequest
from channels.exceptions import RequestTimeout, RequestAborted from channels.tests import ChannelTestCase
class RequestTests(ChannelTestCase): class RequestTests(ChannelTestCase):

View File

@ -1,10 +1,11 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.test import SimpleTestCase from django.test import SimpleTestCase
from channels.routing import Router, route, route_class, include
from channels.message import Message
from channels.utils import name_that_thing
from channels.generic import BaseConsumer from channels.generic import BaseConsumer
from channels.message import Message
from channels.routing import Router, include, route, route_class
from channels.utils import name_that_thing
# Fake consumers and routing sets that can be imported by string # Fake consumers and routing sets that can be imported by string

View File

@ -2,11 +2,13 @@ from __future__ import unicode_literals
from django.conf import settings from django.conf import settings
from django.test import override_settings from django.test import override_settings
from channels.message import Message
from channels.sessions import channel_session, channel_and_http_session, http_session, enforce_ordering, \
session_for_reply_channel
from channels.tests import ChannelTestCase
from channels import DEFAULT_CHANNEL_LAYER, channel_layers from channels import DEFAULT_CHANNEL_LAYER, channel_layers
from channels.message import Message
from channels.sessions import (
channel_and_http_session, channel_session, enforce_ordering, http_session, session_for_reply_channel,
)
from channels.tests import ChannelTestCase
@override_settings(SESSION_ENGINE="django.contrib.sessions.backends.cache") @override_settings(SESSION_ENGINE="django.contrib.sessions.backends.cache")

View File

@ -1,17 +1,18 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import threading
from channels import DEFAULT_CHANNEL_LAYER, Channel, route
from channels.asgi import channel_layers
from channels.exceptions import ConsumeLater
from channels.signals import worker_ready
from channels.tests import ChannelTestCase
from channels.worker import Worker, WorkerGroup
try: try:
from unittest import mock from unittest import mock
except ImportError: except ImportError:
import mock import mock
import threading
from channels import Channel, route, DEFAULT_CHANNEL_LAYER
from channels.asgi import channel_layers
from channels.tests import ChannelTestCase
from channels.worker import Worker, WorkerGroup
from channels.exceptions import ConsumeLater
from channels.signals import worker_ready
class PatchedWorker(Worker): class PatchedWorker(Worker):

View File

@ -2,17 +2,16 @@ from __future__ import unicode_literals
import fnmatch import fnmatch
import logging import logging
import multiprocessing
import signal import signal
import sys import sys
import time
import multiprocessing
import threading import threading
import time
from .signals import consumer_started, consumer_finished
from .exceptions import ConsumeLater, DenyConnection from .exceptions import ConsumeLater, DenyConnection
from .message import Message from .message import Message
from .signals import consumer_finished, consumer_started, worker_ready
from .utils import name_that_thing from .utils import name_that_thing
from .signals import worker_ready
logger = logging.getLogger('django.channels') logger = logging.getLogger('django.channels')

View File

@ -10,6 +10,7 @@ include_trailing_comma = true
known_first_party = channels known_first_party = channels
multi_line_output = 5 multi_line_output = 5
not_skip = __init__.py not_skip = __init__.py
line_length = 119
[bdist_wheel] [bdist_wheel]
universal=1 universal=1

View File

@ -7,6 +7,9 @@ envlist =
{py27,py35}-flake8 {py27,py35}-flake8
isort isort
[tox:travis]
2.7 = py27, isort
[testenv] [testenv]
setenv = setenv =
PYTHONPATH = {toxinidir}:{toxinidir} PYTHONPATH = {toxinidir}:{toxinidir}