sob/model.py
def serialize(
    data: abc.MarshallableTypes,
    format_: str = "json",
    indent: Optional[int] = None,
) -> str:
    """
    This function serializes data as JSON or YAML.

    Parameters:

    - data ([Model](#Model)|str|dict|list|int|float|bool|None)
    - format_ (str): "json" or "yaml".
    """
    assert_in("format_", format_, ("json", "yaml"))
    string_data: str
    dumps: Callable[..., str]
    if format_ == "json":
        dumps = json.dumps
    else:
        dumps = yaml.dump
    if isinstance(data, abc.Model):
        instance_hooks: Optional[abc.Hooks]
        before_serialize: Optional[Callable[[abc.JSONTypes], abc.JSONTypes]]
        after_serialize: Optional[Callable[[str], str]]
        before_serialize, after_serialize = _get_serialize_instance_hooks(data)
        marshalled_data: abc.JSONTypes = marshal(data)
        if before_serialize is not None:
            marshalled_data = before_serialize(marshalled_data)
        string_data = dumps(marshalled_data, indent=indent)
        if after_serialize is not None:
            string_data = after_serialize(string_data)
    else:
        assert isinstance(data, abc.JSON_TYPES)
        string_data = dumps(data, indent=indent)
    return string_data

    This function serializes data as JSON or YAML.

    Parameters:

    - data ([Model](#Model)|str|dict|list|int|float|bool|None)
    - format_ (str): "json" or "yaml".
    
This function serializes data as JSON or YAML.
Parameters.


This function serializes data as JSON or YAML . Parameters .
def serialize(
    data: abc.MarshallableTypes,
    format_: str = "json",
    indent: Optional[int] = None,
) -> str:
    assert_in("format_", format_, ("json", "yaml"))
    string_data: str
    dumps: Callable[..., str]
    if format_ == "json":
        dumps = json.dumps
    else:
        dumps = yaml.dump
    if isinstance(data, abc.Model):
        instance_hooks: Optional[abc.Hooks]
        before_serialize: Optional[Callable[[abc.JSONTypes], abc.JSONTypes]]
        after_serialize: Optional[Callable[[str], str]]
        before_serialize, after_serialize = _get_serialize_instance_hooks(data)
        marshalled_data: abc.JSONTypes = marshal(data)
        if before_serialize is not None:
            marshalled_data = before_serialize(marshalled_data)
        string_data = dumps(marshalled_data, indent=indent)
        if after_serialize is not None:
            string_data = after_serialize(string_data)
    else:
        assert isinstance(data, abc.JSON_TYPES)
        string_data = dumps(data, indent=indent)
    return string_data
def serialize ( data : abc . MarshallableTypes , format_ : str = "json" , indent : Optional [ int ] = None , ) -> str : assert_in ( "format_" , format_ , ( "json" , "yaml" ) ) string_data : str dumps : Callable [ ... , str ] if format_ == "json" : dumps = json . dumps else : dumps = yaml . dump if isinstance ( data , abc . Model ) : instance_hooks : Optional [ abc . Hooks ] before_serialize : Optional [ Callable [ [ abc . JSONTypes ] , abc . JSONTypes ] ] after_serialize : Optional [ Callable [ [ str ] , str ] ] before_serialize , after_serialize = _get_serialize_instance_hooks ( data ) marshalled_data : abc . JSONTypes = marshal ( data ) if before_serialize is not None : marshalled_data = before_serialize ( marshalled_data ) string_data = dumps ( marshalled_data , indent = indent ) if after_serialize is not None : string_data = after_serialize ( string_data ) else : assert isinstance ( data , abc . JSON_TYPES ) string_data = dumps ( data , indent = indent ) return string_data
This function serializes data as JSON or YAML.
This function serializes data as JSON or YAML .
"""
    This function serializes data as JSON or YAML.

    Parameters:

    - data ([Model](#Model)|str|dict|list|int|float|bool|None)
    - format_ (str): "json" or "yaml".
    """
data
abc.MarshallableTypes
format_
str
indent
Optional[int]