From: Joe Guo Date: Tue, 10 Apr 2018 03:49:40 +0000 (+1200) Subject: python: bulk convert zip to list X-Git-Tag: ldb-1.4.0~601 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5258add3aaf9b9f077d4629355afc7b35cc58cd1;p=thirdparty%2Fsamba.git python: bulk convert zip to list In py3, zip will return a iterator other than a list. Convert it to a list to support both py2 and py3. Signed-off-by: Joe Guo Reviewed-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- diff --git a/python/samba/emulate/traffic.py b/python/samba/emulate/traffic.py index 0fb60b4c87b..9d95e3a14d5 100644 --- a/python/samba/emulate/traffic.py +++ b/python/samba/emulate/traffic.py @@ -1398,9 +1398,9 @@ def replay(conversations, print(("we have %d accounts but %d conversations" % (accounts, conversations)), file=sys.stderr) - cstack = zip(sorted(conversations, - key=lambda x: x.start_time, reverse=True), - accounts) + cstack = list(zip( + sorted(conversations, key=lambda x: x.start_time, reverse=True), + accounts)) # Set the process group so that the calling scripts are not killed # when the forked child processes are killed. diff --git a/python/samba/tests/graph.py b/python/samba/tests/graph.py index d1824bc3ef9..0a95afb1859 100644 --- a/python/samba/tests/graph.py +++ b/python/samba/tests/graph.py @@ -73,7 +73,7 @@ class DotFileTests(samba.tests.TestCaseInTempDir): def test_basic_dot_files(self): vertices = tuple('abcdefgh') all_edges = tuple(itertools.combinations(vertices, 2)) - line_edges = zip(vertices[1:], vertices[:-1]) + line_edges = list(zip(vertices[1:], vertices[:-1])) ring_edges = line_edges + [(vertices[0], vertices[-1])] no_edges = [] # even join to even numbers, odd to odd