Skip to content

Commit 2753815

Browse files
samiiblhercot
authored andcommitted
[ignore] fix new sanity issue with yield
1 parent a6d7379 commit 2753815

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

plugins/filter/listify.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,10 @@ def listify_worker(d, keys, depth, cache, prefix):
278278
else:
279279
for k, v in item.items():
280280
if k == keys[depth + 1] and isinstance(v, (dict, list)):
281-
for result in listify_worker({k: v}, keys, depth + 1, cache_work, prefix):
282-
yield result
281+
yield from listify_worker({k: v}, keys, depth + 1, cache_work, prefix)
283282
# Conditional to support nested dictionaries which are detected by item is string
284283
elif isinstance(item, str) and isinstance(d[keys[depth]], dict):
285-
for result in listify_worker({item: d[keys[depth]][item]}, keys, depth + 1, cache_work, prefix):
286-
yield result
284+
yield from listify_worker({item: d[keys[depth]][item]}, keys, depth + 1, cache_work, prefix)
287285

288286

289287
class FilterModule(object):

tests/unit/compat/mock.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ def _iterate_read_data(read_data):
6565
# newline that our naive format() added
6666
data_as_list[-1] = data_as_list[-1][:-1]
6767

68-
for line in data_as_list:
69-
yield line
68+
yield from data_as_list
7069

7170
def mock_open(mock=None, read_data=""):
7271
"""
@@ -95,8 +94,7 @@ def _readline_side_effect():
9594
if handle.readline.return_value is not None:
9695
while True:
9796
yield handle.readline.return_value
98-
for line in _data:
99-
yield line
97+
yield from _data
10098

10199
global file_spec
102100
if file_spec is None:

0 commit comments

Comments
 (0)