Simplify return statements in client.py (#1096)

Co-authored-by: Mickaël Schoentgen <contact@tiger-222.fr>
This commit is contained in:
nixbytes 2021-06-28 03:05:24 -04:00 committed by GitHub
parent ae6f57dc76
commit c8d70e8c0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -213,11 +213,10 @@ def make_default_headers(args: argparse.Namespace) -> RequestHeadersDict:
def make_send_kwargs(args: argparse.Namespace) -> dict:
kwargs = {
return {
'timeout': args.timeout or None,
'allow_redirects': False,
}
return kwargs
def make_send_kwargs_mergeable_from_env(args: argparse.Namespace) -> dict:
@ -226,7 +225,7 @@ def make_send_kwargs_mergeable_from_env(args: argparse.Namespace) -> dict:
cert = args.cert
if args.cert_key:
cert = cert, args.cert_key
kwargs = {
return {
'proxies': {p.key: p.value for p in args.proxy},
'stream': True,
'verify': {
@ -237,7 +236,6 @@ def make_send_kwargs_mergeable_from_env(args: argparse.Namespace) -> dict:
}.get(args.verify.lower(), args.verify),
'cert': cert,
}
return kwargs
def make_request_kwargs(
@ -279,7 +277,7 @@ def make_request_kwargs(
content_type=args.headers.get('Content-Type'),
)
kwargs = {
return {
'method': args.method.lower(),
'url': args.url,
'headers': headers,
@ -294,8 +292,6 @@ def make_request_kwargs(
'params': args.params.items(),
}
return kwargs
def ensure_path_as_is(orig_url: str, prepped_url: str) -> str:
"""
@ -320,5 +316,4 @@ def ensure_path_as_is(orig_url: str, prepped_url: str) -> str:
**parsed_prepped._asdict(),
'path': parsed_orig.path,
}
final_url = urlunparse(tuple(final_dict.values()))
return final_url
return urlunparse(tuple(final_dict.values()))