piwebasync/api/util.py
def serialize_to_str(obj: StrType) -> str:
    """
    Serialize objects to be used as query params to str
    """
    if not obj:
        return
    elif isinstance(obj, str):
        return obj
    elif isinstance(obj, bytes):
        return obj.decode()
    # tuples are converted to list
    elif isinstance(obj, (list, tuple)):
        return [serialize_arbitrary_to_str(item) for item in obj]
    elif isinstance(obj, (datetime, float, int)):
        return serialize_arbitrary_to_str(obj)
    else:
        raise TypeError(
            f"Invalid type to serialize '{type(obj)}'"
        )

    Serialize objects to be used as query params to str
    
Serialize objects to be used as query params to str
Serialize objects to be used as query params to str
def serialize_to_str(obj: StrType) -> str:
    if not obj:
        return
    elif isinstance(obj, str):
        return obj
    elif isinstance(obj, bytes):
        return obj.decode()
    elif isinstance(obj, (list, tuple)):
        return [serialize_arbitrary_to_str(item) for item in obj]
    elif isinstance(obj, (datetime, float, int)):
        return serialize_arbitrary_to_str(obj)
    else:
        raise TypeError(
            f"Invalid type to serialize '{type(obj)}'"
        )
def serialize_to_str ( obj : StrType ) -> str : if not obj : return elif isinstance ( obj , str ) : return obj elif isinstance ( obj , bytes ) : return obj . decode ( ) elif isinstance ( obj , ( list , tuple ) ) : return [ serialize_arbitrary_to_str ( item ) for item in obj ] elif isinstance ( obj , ( datetime , float , int ) ) : return serialize_arbitrary_to_str ( obj ) else : raise TypeError ( f"Invalid type to serialize '{type(obj)}'" )
Serialize objects to be used as query params to str
Serialize objects to be used as query params to str
"""
    Serialize objects to be used as query params to str
    """ # tuples are converted to list
obj
StrType