[coding-style] searx/network/network.py - normalized indentations

No functional change!

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2021-05-24 17:48:47 +02:00
parent 1499002ceb
commit 2128022f72

View File

@ -37,10 +37,12 @@ ADDRESS_MAPPING = {
class Network: class Network:
__slots__ = ('enable_http', 'verify', 'enable_http2', __slots__ = (
'enable_http', 'verify', 'enable_http2',
'max_connections', 'max_keepalive_connections', 'keepalive_expiry', 'max_connections', 'max_keepalive_connections', 'keepalive_expiry',
'local_addresses', 'proxies', 'max_redirects', 'retries', 'retry_on_http_error', 'local_addresses', 'proxies', 'max_redirects', 'retries', 'retry_on_http_error',
'_local_addresses_cycle', '_proxies_cycle', '_clients') '_local_addresses_cycle', '_proxies_cycle', '_clients'
)
def __init__( def __init__(
# pylint: disable=too-many-arguments # pylint: disable=too-many-arguments
@ -135,7 +137,8 @@ class Network:
proxies = next(self._proxies_cycle) # is a tuple so it can be part of the key proxies = next(self._proxies_cycle) # is a tuple so it can be part of the key
key = (verify, max_redirects, local_address, proxies) key = (verify, max_redirects, local_address, proxies)
if key not in self._clients or self._clients[key].is_closed: if key not in self._clients or self._clients[key].is_closed:
self._clients[key] = new_client(self.enable_http, self._clients[key] = new_client(
self.enable_http,
verify, verify,
self.enable_http2, self.enable_http2,
self.max_connections, self.max_connections,
@ -144,7 +147,8 @@ class Network:
dict(proxies), dict(proxies),
local_address, local_address,
0, 0,
max_redirects) max_redirects
)
return self._clients[key] return self._clients[key]
async def aclose(self): async def aclose(self):
@ -166,9 +170,10 @@ class Network:
def is_valid_respones(self, response): def is_valid_respones(self, response):
# pylint: disable=too-many-boolean-expressions # pylint: disable=too-many-boolean-expressions
if (self.retry_on_http_error is True and 400 <= response.status_code <= 599) \ 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, 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): or (isinstance(self.retry_on_http_error, int) and response.status_code == self.retry_on_http_error)
):
return False return False
return True return True