Skip to content

Commit

Permalink
[ignore] fix new sanity issue with yield
Browse files Browse the repository at this point in the history
  • Loading branch information
samiib authored and lhercot committed Apr 24, 2024
1 parent a6d7379 commit 2753815
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions plugins/filter/listify.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 2 additions & 4 deletions tests/unit/compat/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=""):
"""
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 2753815

Please sign in to comment.