match.py 文件源码

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

项目:forge 作者: datawire 项目源码 文件源码
def projections(value, match_value=True):
    if match_value and isinstance(value, collections.Hashable):
        yield value
    traits = getattr(value, "MATCH_TRAITS", None)
    if traits is not None:
        if isinstance(traits, tuple):
            for t in traits:
                yield t
        else:
            yield traits
    if not isinstance(value, Marker):
        if isinstance(value, super):
            for cls in value.__self_class__.__mro__[1:]:
                yield cls
        else:
            for cls in value.__class__.__mro__:
                yield cls
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号