All checks were successful
/ job (push) Successful in 1m12s
new development branch from root commit
21 lines
504 B
Python
21 lines
504 B
Python
"""Output FreeTube db."""
|
|
|
|
|
|
def to_db(value: object) -> str:
|
|
"""Render value as string.
|
|
|
|
:param value: value to render
|
|
:type value: object
|
|
:rtype: str
|
|
"""
|
|
match value:
|
|
case bool():
|
|
text = str(value).lower()
|
|
case dict():
|
|
sub = ",".join([f'"{i}":{to_db(v)}' for i, v in value.items()])
|
|
text = f"{{{sub}}}"
|
|
case float() | str():
|
|
text = f'"{value}"'
|
|
case _:
|
|
text = str(value)
|
|
return text
|