Fix import ordering

This commit is contained in:
Andrew Godwin 2017-11-28 18:00:15 -08:00
parent 03aa8548fe
commit 08e7841718
12 changed files with 42 additions and 39 deletions

View File

@ -1,11 +1,11 @@
import sys
import argparse
import logging
from .server import Server
from .endpoints import build_endpoint_description_strings
from .access import AccessLogGenerator
from .utils import import_by_path
import sys
from .access import AccessLogGenerator
from .endpoints import build_endpoint_description_strings
from .server import Server
from .utils import import_by_path
logger = logging.getLogger(__name__)

View File

@ -1,22 +1,20 @@
from __future__ import unicode_literals
import logging
import random
import six
import string
import time
import traceback
from zope.interface import implementer
from six.moves.urllib_parse import unquote, unquote_plus
import six
from twisted.internet.defer import ensureDeferred
from twisted.internet.interfaces import IProtocolNegotiationFactory
from twisted.protocols.policies import ProtocolWrapper
from twisted.web import http
from zope.interface import implementer
from six.moves.urllib_parse import unquote, unquote_plus
from .utils import parse_x_forwarded_for
from .ws_protocol import WebSocketProtocol, WebSocketFactory
from .ws_protocol import WebSocketFactory, WebSocketProtocol
logger = logging.getLogger(__name__)

View File

@ -1,8 +1,6 @@
from __future__ import unicode_literals
# This has to be done first as Twisted is import-order-sensitive with reactors
from twisted.internet import asyncioreactor
asyncioreactor.install()
from twisted.internet import asyncioreactor # isort:skip
asyncioreactor.install() # isort:skip
import asyncio
import collections
@ -12,9 +10,9 @@ import string
import traceback
import warnings
from twisted.internet import reactor, defer
from twisted.internet import defer, reactor
from twisted.internet.endpoints import serverFromString
from twisted.logger import globalLogBeginner, STDLibLogObserver
from twisted.logger import STDLibLogObserver, globalLogBeginner
from twisted.web import http
from .http_protocol import HTTPFactory

View File

@ -1,8 +1,8 @@
from concurrent.futures import CancelledError
import logging
import os
import pickle
import tempfile
from concurrent.futures import CancelledError
class TestApplication:

View File

@ -1,9 +1,9 @@
import socket
from twisted.internet import endpoints
from twisted.internet.interfaces import IStreamServerEndpointStringParser
from twisted.plugin import IPlugin
from zope.interface import implementer
from twisted.internet.interfaces import IStreamServerEndpointStringParser
from twisted.internet import endpoints
import socket
@implementer(IPlugin, IStreamServerEndpointStringParser)

View File

@ -1,5 +1,6 @@
import sys
import importlib
import sys
from twisted.web.http_headers import Headers

View File

@ -1,13 +1,12 @@
from __future__ import unicode_literals
import logging
import six
import time
import traceback
from six.moves.urllib_parse import unquote, urlencode
import six
from autobahn.twisted.websocket import ConnectionDeny, WebSocketServerFactory, WebSocketServerProtocol
from twisted.internet import defer
from autobahn.twisted.websocket import WebSocketServerProtocol, WebSocketServerFactory, ConnectionDeny
from six.moves.urllib_parse import unquote, urlencode
from .utils import parse_x_forwarded_for

View File

@ -3,3 +3,12 @@ universal=1
[tool:pytest]
addopts = tests/
[isort]
line_length = 120
multi_line_output = 3
[flake8]
exclude = venv/*,tox/*,docs/*,testproject/*,js_client/*
ignore = E123,E128,E402,W503,E731,W601
max-line-length = 120

View File

@ -1,10 +1,10 @@
from http.client import HTTPConnection
from urllib import parse
import socket
import struct
import subprocess
import time
import unittest
from http.client import HTTPConnection
from urllib import parse
from daphne.test_application import TestApplication

View File

@ -1,12 +1,9 @@
"""
Assorted Hypothesis strategies useful for generating HTTP requests and responses
"""
from __future__ import unicode_literals
from six.moves.urllib import parse
import string
from hypothesis import strategies
from six.moves.urllib import parse
HTTP_METHODS = ["OPTIONS", "GET", "HEAD", "POST", "PUT", "DELETE", "TRACE", "CONNECT"]
# Unicode characters of the "Letter" category

View File

@ -3,7 +3,7 @@
import collections
from urllib import parse
from hypothesis import given, assume, settings
from hypothesis import assume, given, settings
import http_strategies
from http_base import DaphneTestCase

View File

@ -1,8 +1,9 @@
# coding: utf8
from twisted.web.http_headers import Headers
from unittest import TestCase
from twisted.web.http_headers import Headers
from daphne.utils import parse_x_forwarded_for