Added TestableInput

This commit is contained in:
2025-10-31 21:11:56 +01:00
parent b5c1c15198
commit 3721bb7ad7
15 changed files with 730 additions and 246 deletions

View File

@@ -17,3 +17,32 @@ def mount_if_not_exists(app, path: str, sub_app):
if not is_mounted:
app.mount(path, app=sub_app)
def merge_classes(*args):
all_elements = []
for element in args:
if element is None or element == '':
continue
if isinstance(element, (tuple, list, set)):
all_elements.extend(element)
elif isinstance(element, dict):
if "cls" in element:
all_elements.append(element.pop("cls"))
elif "class" in element:
all_elements.append(element.pop("class"))
elif isinstance(element, str):
all_elements.append(element)
else:
raise ValueError(f"Cannot merge {element} of type {type(element)}")
if all_elements:
# Remove duplicates while preserving order
unique_elements = list(dict.fromkeys(all_elements))
return " ".join(unique_elements)
else:
return None