__init__.py 文件源码

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

项目:aiotask-context 作者: Skyscanner 项目源码 文件源码
def chainmap_context_factory(parent_context=None):
    """
    A ``ChainMap`` context, to avoid copying any data
    and yet preserve strict one-way inheritance
    (just like with dict copying)
    """
    if parent_context is None:
        # initial context
        return ChainMap()
    else:
        # inherit context
        if not isinstance(parent_context, ChainMap):
            # if a dict context was previously used, then convert
            # (without modifying the original dict)
            parent_context = ChainMap(parent_context)
        return parent_context.new_child()
评论列表


问题


面经


文章

微信
公众号

扫码关注公众号