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 argparse
import logging import logging
from .server import Server import sys
from .endpoints import build_endpoint_description_strings
from .access import AccessLogGenerator
from .utils import import_by_path
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__) logger = logging.getLogger(__name__)

View File

@ -1,22 +1,20 @@
from __future__ import unicode_literals
import logging import logging
import random import random
import six
import string import string
import time import time
import traceback import traceback
from zope.interface import implementer import six
from six.moves.urllib_parse import unquote, unquote_plus
from twisted.internet.defer import ensureDeferred from twisted.internet.defer import ensureDeferred
from twisted.internet.interfaces import IProtocolNegotiationFactory from twisted.internet.interfaces import IProtocolNegotiationFactory
from twisted.protocols.policies import ProtocolWrapper from twisted.protocols.policies import ProtocolWrapper
from twisted.web import http 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 .utils import parse_x_forwarded_for
from .ws_protocol import WebSocketProtocol, WebSocketFactory from .ws_protocol import WebSocketFactory, WebSocketProtocol
logger = logging.getLogger(__name__) 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 # This has to be done first as Twisted is import-order-sensitive with reactors
from twisted.internet import asyncioreactor from twisted.internet import asyncioreactor # isort:skip
asyncioreactor.install() asyncioreactor.install() # isort:skip
import asyncio import asyncio
import collections import collections
@ -12,9 +10,9 @@ import string
import traceback import traceback
import warnings import warnings
from twisted.internet import reactor, defer from twisted.internet import defer, reactor
from twisted.internet.endpoints import serverFromString from twisted.internet.endpoints import serverFromString
from twisted.logger import globalLogBeginner, STDLibLogObserver from twisted.logger import STDLibLogObserver, globalLogBeginner
from twisted.web import http from twisted.web import http
from .http_protocol import HTTPFactory from .http_protocol import HTTPFactory

View File

@ -1,8 +1,8 @@
from concurrent.futures import CancelledError
import logging import logging
import os import os
import pickle import pickle
import tempfile import tempfile
from concurrent.futures import CancelledError
class TestApplication: 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 twisted.plugin import IPlugin
from zope.interface import implementer from zope.interface import implementer
from twisted.internet.interfaces import IStreamServerEndpointStringParser
from twisted.internet import endpoints
import socket
@implementer(IPlugin, IStreamServerEndpointStringParser) @implementer(IPlugin, IStreamServerEndpointStringParser)
@ -21,4 +21,4 @@ class _FDParser(object):
return self._parseServer(reactor, *args, **kwargs) return self._parseServer(reactor, *args, **kwargs)
parser = _FDParser() parser = _FDParser()

View File

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

View File

@ -1,13 +1,12 @@
from __future__ import unicode_literals
import logging import logging
import six
import time import time
import traceback 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 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 from .utils import parse_x_forwarded_for

View File

@ -3,3 +3,12 @@ universal=1
[tool:pytest] [tool:pytest]
addopts = tests/ 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 socket
import struct import struct
import subprocess import subprocess
import time import time
import unittest import unittest
from http.client import HTTPConnection
from urllib import parse
from daphne.test_application import TestApplication 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 import string
from hypothesis import strategies from hypothesis import strategies
from six.moves.urllib import parse
HTTP_METHODS = ["OPTIONS", "GET", "HEAD", "POST", "PUT", "DELETE", "TRACE", "CONNECT"] HTTP_METHODS = ["OPTIONS", "GET", "HEAD", "POST", "PUT", "DELETE", "TRACE", "CONNECT"]
# Unicode characters of the "Letter" category # Unicode characters of the "Letter" category

View File

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

View File

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