From 2128022f72197eee05206a4263da3032ae90fb3e Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 24 May 2021 17:48:47 +0200 Subject: [PATCH] [coding-style] searx/network/network.py - normalized indentations No functional change! Signed-off-by: Markus Heiser --- searx/network/network.py | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/searx/network/network.py b/searx/network/network.py index b1b91146d..37777b0d5 100644 --- a/searx/network/network.py +++ b/searx/network/network.py @@ -37,10 +37,12 @@ ADDRESS_MAPPING = { class Network: - __slots__ = ('enable_http', 'verify', 'enable_http2', - 'max_connections', 'max_keepalive_connections', 'keepalive_expiry', - 'local_addresses', 'proxies', 'max_redirects', 'retries', 'retry_on_http_error', - '_local_addresses_cycle', '_proxies_cycle', '_clients') + __slots__ = ( + 'enable_http', 'verify', 'enable_http2', + 'max_connections', 'max_keepalive_connections', 'keepalive_expiry', + 'local_addresses', 'proxies', 'max_redirects', 'retries', 'retry_on_http_error', + '_local_addresses_cycle', '_proxies_cycle', '_clients' + ) def __init__( # pylint: disable=too-many-arguments @@ -135,16 +137,18 @@ class Network: proxies = next(self._proxies_cycle) # is a tuple so it can be part of the key key = (verify, max_redirects, local_address, proxies) if key not in self._clients or self._clients[key].is_closed: - self._clients[key] = new_client(self.enable_http, - verify, - self.enable_http2, - self.max_connections, - self.max_keepalive_connections, - self.keepalive_expiry, - dict(proxies), - local_address, - 0, - max_redirects) + self._clients[key] = new_client( + self.enable_http, + verify, + self.enable_http2, + self.max_connections, + self.max_keepalive_connections, + self.keepalive_expiry, + dict(proxies), + local_address, + 0, + max_redirects + ) return self._clients[key] async def aclose(self): @@ -166,9 +170,10 @@ class Network: def is_valid_respones(self, response): # pylint: disable=too-many-boolean-expressions - if (self.retry_on_http_error is True and 400 <= response.status_code <= 599) \ - or (isinstance(self.retry_on_http_error, list) and response.status_code in self.retry_on_http_error) \ - or (isinstance(self.retry_on_http_error, int) and response.status_code == self.retry_on_http_error): + if ((self.retry_on_http_error is True and 400 <= response.status_code <= 599) + or (isinstance(self.retry_on_http_error, list) and response.status_code in self.retry_on_http_error) + or (isinstance(self.retry_on_http_error, int) and response.status_code == self.retry_on_http_error) + ): return False return True