From 17b727321f659ce66d57269285c0a021db144e71 Mon Sep 17 00:00:00 2001 From: Shadab Zafar Date: Tue, 28 Jun 2016 17:40:13 +0530 Subject: [PATCH] Replace map + lambda with list comprehensions --- mitmproxy/flow/export.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mitmproxy/flow/export.py b/mitmproxy/flow/export.py index f0ac02abc..bffe52916 100644 --- a/mitmproxy/flow/export.py +++ b/mitmproxy/flow/export.py @@ -4,7 +4,7 @@ import json import re from textwrap import dedent -from six.moves.urllib.parse import quote, quote_plus +from six.moves import urllib import netlib.http @@ -48,7 +48,7 @@ def python_code(flow): print(response.text) """).strip() - components = map(lambda x: quote(x, safe=""), flow.request.path_components) + components = [urllib.parse.quote(c, safe="") for c in flow.request.path_components] url = flow.request.scheme + "://" + flow.request.host + "/" + "/".join(components) args = "" @@ -126,7 +126,7 @@ def locust_code(flow): max_wait = 3000 """).strip() - components = map(lambda x: quote(x, safe=""), flow.request.path_components) + components = [urllib.parse.quote(c, safe="") for c in flow.request.path_components] file_name = "_".join(components) name = re.sub('\W|^(?=\d)', '_', file_name) url = flow.request.scheme + "://" + flow.request.host + "/" + "/".join(components)