nodes.py 文件源码

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

项目:PYKE 作者: muddyfish 项目源码 文件源码
def get_functions(cls, ins=None):
        items = list(cls.__dict__.items())
        base = cls.__bases__[0]
        if base is not Node:
            items.extend(base.__dict__.items())
        if ins is not None:
            cls = ins
        funcs = [cls.func]
        for k, cur_func in items:
            if isinstance(cur_func, types.FunctionType):
                if k in ["__init__", "func"]:
                    continue
                cur_func = getattr(cls, k)
                if cur_func.__annotations__ != {}:
                    funcs.append(cur_func)
                elif hasattr(cur_func, "is_func") and cur_func.is_func:
                    funcs.append(cur_func)
        if funcs == [cls.func] and cls.func is Node.func:
            print(cls, "No funcs?")
        return funcs
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号