Replace map + lambda with list comprehensions

This commit is contained in:
Shadab Zafar 2016-06-28 17:40:13 +05:30
parent 5b5a3ffa8e
commit 17b727321f

View File

@ -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)