[coding-style] searx/network/client.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:44:43 +02:00
parent e4211da639
commit 1499002ceb

View File

@ -150,18 +150,20 @@ def get_transport_for_socks_proxy(verify, http2, local_address, proxy_url, limit
proxy_type, proxy_host, proxy_port, proxy_username, proxy_password = parse_proxy_url(proxy_url) proxy_type, proxy_host, proxy_port, proxy_username, proxy_password = parse_proxy_url(proxy_url)
verify = get_sslcontexts(proxy_url, None, True, False, http2) if verify is True else verify verify = get_sslcontexts(proxy_url, None, True, False, http2) if verify is True else verify
return AsyncProxyTransportFixed(proxy_type=proxy_type, proxy_host=proxy_host, proxy_port=proxy_port, return AsyncProxyTransportFixed(
username=proxy_username, password=proxy_password, proxy_type=proxy_type, proxy_host=proxy_host, proxy_port=proxy_port,
rdns=rdns, username=proxy_username, password=proxy_password,
loop=get_loop(), rdns=rdns,
verify=verify, loop=get_loop(),
http2=http2, verify=verify,
local_address=local_address, http2=http2,
max_connections=limit.max_connections, local_address=local_address,
max_keepalive_connections=limit.max_keepalive_connections, max_connections=limit.max_connections,
keepalive_expiry=limit.keepalive_expiry, max_keepalive_connections=limit.max_keepalive_connections,
retries=retries, keepalive_expiry=limit.keepalive_expiry,
**TRANSPORT_KWARGS) retries=retries,
**TRANSPORT_KWARGS
)
def get_transport(verify, http2, local_address, proxy_url, limit, retries): def get_transport(verify, http2, local_address, proxy_url, limit, retries):
@ -193,21 +195,27 @@ def new_client(
enable_http, verify, enable_http2, enable_http, verify, enable_http2,
max_connections, max_keepalive_connections, keepalive_expiry, max_connections, max_keepalive_connections, keepalive_expiry,
proxies, local_address, retries, max_redirects ): proxies, local_address, retries, max_redirects ):
limit = httpx.Limits(max_connections=max_connections, limit = httpx.Limits(
max_keepalive_connections=max_keepalive_connections, max_connections=max_connections,
keepalive_expiry=keepalive_expiry) max_keepalive_connections=max_keepalive_connections,
keepalive_expiry=keepalive_expiry
)
# See https://www.python-httpx.org/advanced/#routing # See https://www.python-httpx.org/advanced/#routing
mounts = {} mounts = {}
for pattern, proxy_url in iter_proxies(proxies): for pattern, proxy_url in iter_proxies(proxies):
if not enable_http and (pattern == 'http' or pattern.startswith('http://')): if not enable_http and (pattern == 'http' or pattern.startswith('http://')):
continue continue
if proxy_url.startswith('socks4://') \ if (proxy_url.startswith('socks4://')
or proxy_url.startswith('socks5://') \ or proxy_url.startswith('socks5://')
or proxy_url.startswith('socks5h://'): or proxy_url.startswith('socks5h://')
mounts[pattern] = get_transport_for_socks_proxy(verify, enable_http2, local_address, proxy_url, limit, ):
retries) mounts[pattern] = get_transport_for_socks_proxy(
verify, enable_http2, local_address, proxy_url, limit, retries
)
else: else:
mounts[pattern] = get_transport(verify, enable_http2, local_address, proxy_url, limit, retries) mounts[pattern] = get_transport(
verify, enable_http2, local_address, proxy_url, limit, retries
)
if not enable_http: if not enable_http:
mounts['http://'] = AsyncHTTPTransportNoHttp() mounts['http://'] = AsyncHTTPTransportNoHttp()