15 lines
391 B
Python
15 lines
391 B
Python
def remove_empty_str(items, default=None):
|
|
items = [x for x in items if x != ""]
|
|
if len(items) == 0 and default is not None:
|
|
return [default]
|
|
return items
|
|
|
|
|
|
def join_prompts(*args, **kwargs):
|
|
prompts = [str(x) for x in args if str(x) != ""]
|
|
if len(prompts) == 0:
|
|
return ""
|
|
if len(prompts) == 1:
|
|
return prompts[0]
|
|
return ', '.join(prompts)
|