sob/model.py
def deserialize(
    data: Optional[Union[str, bytes, abc.Readable]], format_: str = "json"
) -> Any:
    """
    This function deserializes JSON or YAML encoded data.

    Parameters:

    - data (str|abc.Readable): This can be a string or file-like object
      containing JSON or YAML serialized data.
    - format_ (str) = "json": "json" or "yaml".

    This function returns `None` (for JSON null values), or an instance of
    `str`, `dict`, `list`, `int`, `float` or `bool`.
    """
    deserialized_data: abc.JSONTypes
    assert_in("format_", format_, ("json", "yaml"))
    if isinstance(data, str):
        try:
            if format_ == "json":
                deserialized_data = json.loads(
                    data,
                    object_hook=collections.OrderedDict,
                    object_pairs_hook=_object_pairs_hook,
                    strict=False,
                )
            else:
                deserialized_data = yaml.safe_load(data)
        except Exception as error:
            # Append the data which couldn't be deserialized to the exception
            append_exception_text(
                error,
                "Errors occurred while attempting to deserialize:\n" f"{data}",
            )
            raise error
    elif isinstance(data, bytes):
        deserialized_data = deserialize(str(data, encoding="utf-8"), format_)
    else:
        assert isinstance(data, abc.Readable)
        deserialized_data = deserialize(read(data), format_)
    return deserialized_data

    This function deserializes JSON or YAML encoded data.

    Parameters:

    - data (str|abc.Readable): This can be a string or file-like object
      containing JSON or YAML serialized data.
    - format_ (str) = "json": "json" or "yaml".

    This function returns `None` (for JSON null values), or an instance of
    `str`, `dict`, `list`, `int`, `float` or `bool`.
    
This function deserializes JSON or YAML encoded data.
Parameters.

data (str|abc.Readable): This can be a string or file-like object
containing JSON or YAML serialized data.


This function deserializes JSON or YAML encoded data . Parameters . data ( str|abc . Readable ) : This can be a string or file - like object containing JSON or YAML serialized data .
def deserialize(
    data: Optional[Union[str, bytes, abc.Readable]], format_: str = "json"
) -> Any:
    deserialized_data: abc.JSONTypes
    assert_in("format_", format_, ("json", "yaml"))
    if isinstance(data, str):
        try:
            if format_ == "json":
                deserialized_data = json.loads(
                    data,
                    object_hook=collections.OrderedDict,
                    object_pairs_hook=_object_pairs_hook,
                    strict=False,
                )
            else:
                deserialized_data = yaml.safe_load(data)
        except Exception as error:
            append_exception_text(
                error,
                "Errors occurred while attempting to deserialize:\n" f"{data}",
            )
            raise error
    elif isinstance(data, bytes):
        deserialized_data = deserialize(str(data, encoding="utf-8"), format_)
    else:
        assert isinstance(data, abc.Readable)
        deserialized_data = deserialize(read(data), format_)
    return deserialized_data
def deserialize ( data : Optional [ Union [ str , bytes , abc . Readable ] ] , format_ : str = "json" ) -> Any : deserialized_data : abc . JSONTypes assert_in ( "format_" , format_ , ( "json" , "yaml" ) ) if isinstance ( data , str ) : try : if format_ == "json" : deserialized_data = json . loads ( data , object_hook = collections . OrderedDict , object_pairs_hook = _object_pairs_hook , strict = False , ) else : deserialized_data = yaml . safe_load ( data ) except Exception as error : append_exception_text ( error , "Errors occurred while attempting to deserialize:\n" f"{data}" , ) raise error elif isinstance ( data , bytes ) : deserialized_data = deserialize ( str ( data , encoding = "utf-8" ) , format_ ) else : assert isinstance ( data , abc . Readable ) deserialized_data = deserialize ( read ( data ) , format_ ) return deserialized_data
This function deserializes JSON or YAML encoded data.
This function deserializes JSON or YAML encoded data .
"""
    This function deserializes JSON or YAML encoded data.

    Parameters:

    - data (str|abc.Readable): This can be a string or file-like object
      containing JSON or YAML serialized data.
    - format_ (str) = "json": "json" or "yaml".

    This function returns `None` (for JSON null values), or an instance of
    `str`, `dict`, `list`, `int`, `float` or `bool`.
    """ # Append the data which couldn't be deserialized to the exception
data
Optional[Union[str, bytes, abc.Readable]]
format_
str