deserializers.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:foil 作者: portfoliome 项目源码 文件源码
def make_json_decoder_hook(str_decoders=STRING_DECODERS,
                           extra_str_decoders=tuple(),
                           converters=MappingProxyType(dict())) -> Callable:
    """Customize JSON string decoder hooks.

    Object hook for typical deserialization scenarios.

    Notes
    -----
    Specifying a field in converters will ensure custom decoding/passthrough.

    Parameters
    ----------
    str_decoders: functions for decoding strings to objects.
    extra_str_decoders: appends additional string decoders to str_decoders.
    converters: field / parser function mapping.
    """

    str_decoders = tuple(chain(str_decoders, extra_str_decoders))
    object_hook = partial(json_decoder_hook, str_decoders=str_decoders,
                          converters=converters)

    return object_hook
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号