diff --git a/plugins/filter/listify.py b/plugins/filter/listify.py index 63d1f7132..2138f94ee 100644 --- a/plugins/filter/listify.py +++ b/plugins/filter/listify.py @@ -278,12 +278,10 @@ def listify_worker(d, keys, depth, cache, prefix): else: for k, v in item.items(): if k == keys[depth + 1] and isinstance(v, (dict, list)): - for result in listify_worker({k: v}, keys, depth + 1, cache_work, prefix): - yield result + yield from listify_worker({k: v}, keys, depth + 1, cache_work, prefix) # Conditional to support nested dictionaries which are detected by item is string elif isinstance(item, str) and isinstance(d[keys[depth]], dict): - for result in listify_worker({item: d[keys[depth]][item]}, keys, depth + 1, cache_work, prefix): - yield result + yield from listify_worker({item: d[keys[depth]][item]}, keys, depth + 1, cache_work, prefix) class FilterModule(object): diff --git a/tests/unit/compat/mock.py b/tests/unit/compat/mock.py index 54c1d20e7..371939190 100644 --- a/tests/unit/compat/mock.py +++ b/tests/unit/compat/mock.py @@ -65,8 +65,7 @@ def _iterate_read_data(read_data): # newline that our naive format() added data_as_list[-1] = data_as_list[-1][:-1] - for line in data_as_list: - yield line + yield from data_as_list def mock_open(mock=None, read_data=""): """ @@ -95,8 +94,7 @@ def _readline_side_effect(): if handle.readline.return_value is not None: while True: yield handle.readline.return_value - for line in _data: - yield line + yield from _data global file_spec if file_spec is None: