Implemented FunctionParser
This commit is contained in:
@@ -296,6 +296,28 @@ def dict_product(a, b):
|
||||
return res
|
||||
|
||||
|
||||
def get_n_clones(obj, n):
|
||||
objs = [obj]
|
||||
for i in range(n - 1):
|
||||
objs.append(obj.clone())
|
||||
return objs
|
||||
|
||||
|
||||
def obj_product(list_of_objs, new_items, add_item):
|
||||
if list_of_objs is None or len(list_of_objs) == 0:
|
||||
return list_of_objs
|
||||
|
||||
res = []
|
||||
|
||||
for obj in list_of_objs:
|
||||
instances = get_n_clones(obj, len(new_items))
|
||||
res.extend(instances)
|
||||
for instance, item in zip(instances, new_items):
|
||||
add_item(instance, item)
|
||||
|
||||
return res
|
||||
|
||||
|
||||
def strip_quotes(text):
|
||||
if not isinstance(text, str):
|
||||
return text
|
||||
|
||||
Reference in New Issue
Block a user