Updating cyclic zip

This commit is contained in:
2023-03-05 21:58:32 +02:00
parent 323b41b36e
commit 745632ce59
2 changed files with 10 additions and 4 deletions

View File

@ -64,12 +64,14 @@ def resolve_item(item: Meta, options: dict):
run=opt_item,
text=item.text,
kwargs=(options | item.local_options),
local_options=item.local_options
)
elif isinstance(opt_item, str):
yield Sample(
name=opt_item,
text=item.text,
kwargs=(options | item.local_options),
local_options=item.local_options
)
variable = deepcopy(opt_item)
yield from resolve_item(variable, options)
@ -84,6 +86,7 @@ def resolve_item(item: Meta, options: dict):
run=opt_item,
text=var.text,
kwargs=(options | var.local_options),
local_options=var.local_options
)
)
elif isinstance(opt_item, str):
@ -92,6 +95,7 @@ def resolve_item(item: Meta, options: dict):
name=opt_item,
text=var.text,
kwargs=(options | var.local_options),
local_options=var.local_options
)
)
elif isinstance(opt_item, Sequence):
@ -376,6 +380,7 @@ class ListOperation(Sequence):
flattened_list.extend(list(item.evaluate(options)))
elif isinstance(item, (Event, RandomInteger, Integer)):
item.update_options(options)
item = update_item(item, options)
flattened_list.append(item)
if isinstance(input_list, Sequence):

View File

@ -99,14 +99,15 @@ def cyclic_zip(first: list, second: list) -> list:
"""Cyclic zip method
Args:
first (list): First list
first (list): First list is cycled
second (list): Second list
Returns:
list: Cyclicly zipped list
"""
max_length = max(len(first), len(second))
result = []
for i in range(max_length):
result.append([first[i % len(first)], second[i % len(second)]])
s_length = len(second)
f_length = len(first)
for i in range(s_length):
result.append([first[i % f_length], second[i]])
return [deepcopy(item) for sublist in result for item in sublist]