test.py 文件源码

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

项目:filters 作者: eflglobal 项目源码 文件源码
def sorted_dict(value):
    # type: (Mapping) -> Any
    """
    Sorts a dict's keys to avoid leaking information about the
    backend's handling of unordered dicts.
    """
    if isinstance(value, Mapping):
        return OrderedDict(
            (key, sorted_dict(value[key]))
                for key in sorted(iterkeys(value))
        )

    elif isinstance(value, Sequence) and not isinstance(value, string_types):
        return list(map(sorted_dict, value))

    else:
        return value
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号