diff options
| author | Bert JW Regeer <bertjw@regeer.org> | 2020-09-07 11:59:22 -0700 |
|---|---|---|
| committer | Bert JW Regeer <bertjw@regeer.org> | 2020-09-07 11:59:22 -0700 |
| commit | fcfe88c49034e4f5e6316a581ac57aaaf9613346 (patch) | |
| tree | 62f1610c6c7279807c0b77203eac0e91a3fe2e50 /src/waitress | |
| parent | bf2c50ae3e1a049f40536992653126ef27d0270b (diff) | |
| download | waitress-fcfe88c49034e4f5e6316a581ac57aaaf9613346.tar.gz | |
Black formatting update
Diffstat (limited to 'src/waitress')
| -rw-r--r-- | src/waitress/adjustments.py | 9 | ||||
| -rw-r--r-- | src/waitress/channel.py | 4 | ||||
| -rw-r--r-- | src/waitress/proxy_headers.py | 18 | ||||
| -rw-r--r-- | src/waitress/server.py | 6 | ||||
| -rw-r--r-- | src/waitress/task.py | 9 |
5 files changed, 21 insertions, 25 deletions
diff --git a/src/waitress/adjustments.py b/src/waitress/adjustments.py index 145ac86..45ac41b 100644 --- a/src/waitress/adjustments.py +++ b/src/waitress/adjustments.py @@ -28,7 +28,7 @@ KNOWN_PROXY_HEADERS = frozenset( def asbool(s): - """ Return the boolean value ``True`` if the case-lowered value of string + """Return the boolean value ``True`` if the case-lowered value of string input ``s`` is any of ``t``, ``true``, ``y``, ``on``, or ``1``, otherwise return the boolean value ``False``. If ``s`` is the value ``None``, return ``False``. If ``s`` is already one of the boolean values ``True`` @@ -53,7 +53,7 @@ def aslist_cronly(value): def aslist(value): - """ Return a list of strings, separating the input based on newlines + """Return a list of strings, separating the input based on newlines and, if flatten=True (the default), also split on spaces within each line.""" values = aslist_cronly(value) @@ -100,8 +100,7 @@ class _bool_marker: class Adjustments: - """This class contains tunable parameters. - """ + """This class contains tunable parameters.""" _params = ( ("host", str), @@ -303,7 +302,7 @@ class Adjustments: if "send_bytes" in kw: warnings.warn( - "send_bytes will be removed in a future release", DeprecationWarning, + "send_bytes will be removed in a future release", DeprecationWarning ) for k, v in kw.items(): diff --git a/src/waitress/channel.py b/src/waitress/channel.py index d756b96..65bc87f 100644 --- a/src/waitress/channel.py +++ b/src/waitress/channel.py @@ -53,9 +53,7 @@ class HTTPChannel(wasyncore.dispatcher): # ASYNCHRONOUS METHODS (including __init__) # - def __init__( - self, server, sock, addr, adj, map=None, - ): + def __init__(self, server, sock, addr, adj, map=None): self.server = server self.adj = adj self.outbufs = [OverflowableBuffer(adj.outbuf_overflow)] diff --git a/src/waitress/proxy_headers.py b/src/waitress/proxy_headers.py index 13cb2ed..5d61646 100644 --- a/src/waitress/proxy_headers.py +++ b/src/waitress/proxy_headers.py @@ -58,7 +58,7 @@ def proxy_headers_middleware( # Clear out the untrusted proxy headers if clear_untrusted: clear_untrusted_headers( - environ, untrusted_headers, log_warning=log_untrusted, logger=logger, + environ, untrusted_headers, log_warning=log_untrusted, logger=logger ) return app(environ, start_response) @@ -67,7 +67,7 @@ def proxy_headers_middleware( def parse_proxy_headers( - environ, trusted_proxy_count, trusted_proxy_headers, logger=logger, + environ, trusted_proxy_count, trusted_proxy_headers, logger=logger ): if trusted_proxy_headers is None: trusted_proxy_headers = set() @@ -78,7 +78,7 @@ def parse_proxy_headers( untrusted_headers = set(PROXY_HEADERS) def raise_for_multiple_values(): - raise ValueError("Unspecified behavior for multiple values found in header",) + raise ValueError("Unspecified behavior for multiple values found in header") if "x-forwarded-for" in trusted_proxy_headers and "HTTP_X_FORWARDED_FOR" in environ: try: @@ -105,7 +105,7 @@ def parse_proxy_headers( untrusted_headers.remove("X_FORWARDED_FOR") except Exception as ex: raise MalformedProxyHeader( - "X-Forwarded-For", str(ex), environ["HTTP_X_FORWARDED_FOR"], + "X-Forwarded-For", str(ex), environ["HTTP_X_FORWARDED_FOR"] ) if ( @@ -126,7 +126,7 @@ def parse_proxy_headers( untrusted_headers.remove("X_FORWARDED_HOST") except Exception as ex: raise MalformedProxyHeader( - "X-Forwarded-Host", str(ex), environ["HTTP_X_FORWARDED_HOST"], + "X-Forwarded-Host", str(ex), environ["HTTP_X_FORWARDED_HOST"] ) if "x-forwarded-proto" in trusted_proxy_headers: @@ -137,7 +137,7 @@ def parse_proxy_headers( untrusted_headers.remove("X_FORWARDED_PROTO") except Exception as ex: raise MalformedProxyHeader( - "X-Forwarded-Proto", str(ex), environ["HTTP_X_FORWARDED_PROTO"], + "X-Forwarded-Proto", str(ex), environ["HTTP_X_FORWARDED_PROTO"] ) if "x-forwarded-port" in trusted_proxy_headers: @@ -148,7 +148,7 @@ def parse_proxy_headers( untrusted_headers.remove("X_FORWARDED_PORT") except Exception as ex: raise MalformedProxyHeader( - "X-Forwarded-Port", str(ex), environ["HTTP_X_FORWARDED_PORT"], + "X-Forwarded-Port", str(ex), environ["HTTP_X_FORWARDED_PORT"] ) if "x-forwarded-by" in trusted_proxy_headers: @@ -210,9 +210,7 @@ def parse_proxy_headers( ) ) except Exception as ex: - raise MalformedProxyHeader( - "Forwarded", str(ex), environ["HTTP_FORWARDED"], - ) + raise MalformedProxyHeader("Forwarded", str(ex), environ["HTTP_FORWARDED"]) proxies = proxies[-trusted_proxy_count:] diff --git a/src/waitress/server.py b/src/waitress/server.py index 06bb957..85e3217 100644 --- a/src/waitress/server.py +++ b/src/waitress/server.py @@ -138,7 +138,11 @@ class MultiSocketServer: asyncore = wasyncore # test shim def __init__( - self, map=None, adj=None, effective_listen=None, dispatcher=None, + self, + map=None, + adj=None, + effective_listen=None, + dispatcher=None, ): self.adj = adj self.map = map diff --git a/src/waitress/task.py b/src/waitress/task.py index 1bcc540..3a7cf17 100644 --- a/src/waitress/task.py +++ b/src/waitress/task.py @@ -41,8 +41,7 @@ hop_by_hop = frozenset( class ThreadedTaskDispatcher: - """A Task Dispatcher that creates a thread for each task. - """ + """A Task Dispatcher that creates a thread for each task.""" stop_count = 0 # Number of threads that will stop soon. active_count = 0 # Number of currently active threads @@ -341,8 +340,7 @@ class Task: class ErrorTask(Task): - """ An error task produces an error response - """ + """An error task produces an error response""" complete = True @@ -361,8 +359,7 @@ class ErrorTask(Task): class WSGITask(Task): - """A WSGI task produces a response from a WSGI application. - """ + """A WSGI task produces a response from a WSGI application.""" environ = None |
