rwx/rwx/sw/freetube/settings.py
Marc Beninca 018f99c1d6
All checks were successful
/ job (push) Successful in 1m14s
object
2024-10-22 18:33:35 +02:00

33 lines
582 B
Python

"""FreeTube settings."""
from rwx import Object
from .db import to_db
class Setting(Object):
"""FreeTube setting."""
def __init__(self, uid: str, value: object) -> None:
"""Set uid & value.
:param uid: unique identifier
:type uid: str
:param value: value
:type value: object
"""
self.uid = uid
self.value = value
def to_db(self) -> str:
"""Return uid & value as db string.
:rtype: str
"""
return f"""\
{{\
"_id":"{self.uid}"\
,\
"value":{to_db(self.value)}\
}}\
"""