Wrap invocation of dict.items() in list(). (#91)

Some infrastructure parses bzl files as python, which fails when
dict.items() returns a special dict_items generator instead of a list in
python3.
This commit is contained in:
Josh Morton 2019-01-10 12:26:52 -08:00 committed by c-parsons
parent 8d4f7612b2
commit 9948d5538b
1 changed files with 4 additions and 1 deletions

View File

@ -60,7 +60,10 @@ def _uniq(iterable):
A new list with all unique elements from `iterable`. A new list with all unique elements from `iterable`.
""" """
unique_elements = {element: None for element in iterable} unique_elements = {element: None for element in iterable}
return unique_elements.keys()
# list() used here for python3 compatibility.
# TODO(bazel-team): Remove when testing frameworks no longer require python compatibility.
return list(unique_elements.keys())
collections = struct( collections = struct(
after_each = _after_each, after_each = _after_each,