summaryrefslogtreecommitdiff
path: root/src/waitress
diff options
context:
space:
mode:
Diffstat (limited to 'src/waitress')
-rw-r--r--src/waitress/__init__.py3
-rw-r--r--src/waitress/adjustments.py6
-rw-r--r--src/waitress/channel.py13
-rw-r--r--src/waitress/compat.py9
-rw-r--r--src/waitress/parser.py3
-rw-r--r--src/waitress/proxy_headers.py3
-rw-r--r--src/waitress/server.py5
-rw-r--r--src/waitress/task.py2
-rw-r--r--src/waitress/trigger.py2
-rw-r--r--src/waitress/wasyncore.py36
10 files changed, 32 insertions, 50 deletions
diff --git a/src/waitress/__init__.py b/src/waitress/__init__.py
index e6e5911..bbb99da 100644
--- a/src/waitress/__init__.py
+++ b/src/waitress/__init__.py
@@ -1,6 +1,7 @@
-from waitress.server import create_server
import logging
+from waitress.server import create_server
+
def serve(app, **kw):
_server = kw.pop("_server", create_server) # test shim
diff --git a/src/waitress/adjustments.py b/src/waitress/adjustments.py
index 6851a7c..f121b6e 100644
--- a/src/waitress/adjustments.py
+++ b/src/waitress/adjustments.py
@@ -17,12 +17,8 @@ import getopt
import socket
import warnings
+from .compat import HAS_IPV6, WIN, string_types
from .proxy_headers import PROXY_HEADERS
-from .compat import (
- WIN,
- string_types,
- HAS_IPV6,
-)
truthy = frozenset(("t", "true", "y", "yes", "on", "1"))
diff --git a/src/waitress/channel.py b/src/waitress/channel.py
index d91d0a1..7332e40 100644
--- a/src/waitress/channel.py
+++ b/src/waitress/channel.py
@@ -16,18 +16,9 @@ import threading
import time
import traceback
-from waitress.buffers import (
- OverflowableBuffer,
- ReadOnlyFileBasedBuffer,
-)
-
+from waitress.buffers import OverflowableBuffer, ReadOnlyFileBasedBuffer
from waitress.parser import HTTPRequestParser
-
-from waitress.task import (
- ErrorTask,
- WSGITask,
-)
-
+from waitress.task import ErrorTask, WSGITask
from waitress.utilities import InternalServerError
from . import wasyncore
diff --git a/src/waitress/compat.py b/src/waitress/compat.py
index aaf7a78..7c2630c 100644
--- a/src/waitress/compat.py
+++ b/src/waitress/compat.py
@@ -1,3 +1,6 @@
+import _thread as thread
+from http import client as httplib
+from io import StringIO as NativeIO
import os
import platform
@@ -5,13 +8,9 @@ import platform
# Python on Windows may not define IPPROTO_IPV6 in socket.
import socket
import sys
-import warnings
-from http import client as httplib
-from io import StringIO as NativeIO
from urllib import parse as urlparse
from urllib.parse import unquote_to_bytes
-
-import _thread as thread
+import warnings
# True if we are running on Windows
WIN = platform.system() == "Windows"
diff --git a/src/waitress/parser.py b/src/waitress/parser.py
index c2789eb..4530b23 100644
--- a/src/waitress/parser.py
+++ b/src/waitress/parser.py
@@ -16,8 +16,8 @@
This server uses asyncore to accept connections and do initial
processing but threads to do work.
"""
-import re
from io import BytesIO
+import re
from waitress.buffers import OverflowableBuffer
from waitress.compat import tostr, unquote_bytes_to_wsgi, urlparse
@@ -29,6 +29,7 @@ from waitress.utilities import (
ServerNotImplemented,
find_double_newline,
)
+
from .rfc7230 import HEADER_FIELD
diff --git a/src/waitress/proxy_headers.py b/src/waitress/proxy_headers.py
index d411da0..13cb2ed 100644
--- a/src/waitress/proxy_headers.py
+++ b/src/waitress/proxy_headers.py
@@ -1,7 +1,6 @@
from collections import namedtuple
-from .utilities import logger, undquote, BadRequest
-
+from .utilities import BadRequest, logger, undquote
PROXY_HEADERS = frozenset(
{
diff --git a/src/waitress/server.py b/src/waitress/server.py
index 7ab33d7..06bb957 100644
--- a/src/waitress/server.py
+++ b/src/waitress/server.py
@@ -20,13 +20,10 @@ import time
from waitress import trigger
from waitress.adjustments import Adjustments
from waitress.channel import HTTPChannel
+from waitress.compat import IPPROTO_IPV6, IPV6_V6ONLY
from waitress.task import ThreadedTaskDispatcher
from waitress.utilities import cleanup_unix_socket
-from waitress.compat import (
- IPPROTO_IPV6,
- IPV6_V6ONLY,
-)
from . import wasyncore
from .proxy_headers import proxy_headers_middleware
diff --git a/src/waitress/task.py b/src/waitress/task.py
index 604bc8e..b82109f 100644
--- a/src/waitress/task.py
+++ b/src/waitress/task.py
@@ -12,11 +12,11 @@
#
##############################################################################
+from collections import deque
import socket
import sys
import threading
import time
-from collections import deque
from .buffers import ReadOnlyFileBasedBuffer
from .compat import tobytes
diff --git a/src/waitress/trigger.py b/src/waitress/trigger.py
index 09c291e..24c4d0d 100644
--- a/src/waitress/trigger.py
+++ b/src/waitress/trigger.py
@@ -12,9 +12,9 @@
#
##############################################################################
+import errno
import os
import socket
-import errno
import threading
from . import wasyncore
diff --git a/src/waitress/wasyncore.py b/src/waitress/wasyncore.py
index debe0e4..9a68c51 100644
--- a/src/waitress/wasyncore.py
+++ b/src/waitress/wasyncore.py
@@ -51,33 +51,31 @@ in the stdlib will be dropped soon. It is neither a copy of the 2.7 asyncore
nor the 3.X asyncore; it is a version compatible with either 2.7 or 3.X.
"""
-from . import compat
-from . import utilities
-
-import logging
-import select
-import socket
-import sys
-import time
-import warnings
-
-import os
from errno import (
+ EAGAIN,
EALREADY,
- EINPROGRESS,
- EWOULDBLOCK,
+ EBADF,
+ ECONNABORTED,
ECONNRESET,
+ EINPROGRESS,
+ EINTR,
EINVAL,
- ENOTCONN,
- ESHUTDOWN,
EISCONN,
- EBADF,
- ECONNABORTED,
+ ENOTCONN,
EPIPE,
- EAGAIN,
- EINTR,
+ ESHUTDOWN,
+ EWOULDBLOCK,
errorcode,
)
+import logging
+import os
+import select
+import socket
+import sys
+import time
+import warnings
+
+from . import compat, utilities
_DISCONNECTED = frozenset({ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED, EPIPE, EBADF})