converters.py 文件源码

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

项目:cattrs 作者: Tinche 项目源码 文件源码
def _structure_attr_from_dict(self, a, name, mapping):
        """Handle an individual attrs attribute structuring."""
        val = mapping.get(name, NOTHING)
        if val is NOTHING:
            return NOTHING

        type_ = a.type
        if type_ is None:
            # No type.
            return val
        if _is_union_type(type_):
            if NoneType in type_.__args__ and val is None:
                return None
            return self._structure_union(val, type_)
        return self._structure.dispatch(type_)(val, type_)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号