From c8d70e8c0bc65bf66f3dd7f4b4693a57fe09ffa6 Mon Sep 17 00:00:00 2001 From: nixbytes Date: Mon, 28 Jun 2021 03:05:24 -0400 Subject: [PATCH] Simplify return statements in client.py (#1096) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mickaƫl Schoentgen --- httpie/client.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/httpie/client.py b/httpie/client.py index a572df34..f959b4df 100644 --- a/httpie/client.py +++ b/httpie/client.py @@ -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()))