typing.py 文件源码

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

项目:MonkeyType 作者: Instagram 项目源码 文件源码
def rewrite_Union(self, union):
        if len(union.__args__) <= self.max_union_len:
            return union

        rw_union = self._rewrite_to_tuple(union)
        if rw_union is not None:
            return rw_union

        try:
            for ancestor in inspect.getmro(union.__args__[0]):
                if (
                    ancestor is not object and
                    all(issubclass(t, ancestor) for t in union.__args__)
                ):
                    return ancestor
        except TypeError:
            pass
        return Any
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号