flake8_builtins.py 文件源码

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

项目:flake8-builtins 作者: gforcada 项目源码 文件源码
def run(self):
        tree = self.tree

        if self.filename == 'stdin':
            lines = stdin_utils.stdin_get_value()
            tree = ast.parse(lines)

        for statement in ast.walk(tree):
            for child in ast.iter_child_nodes(statement):
                child.__flake8_builtins_parent = statement

        for statement in ast.walk(tree):
            value = None
            if isinstance(statement, ast.Assign):
                value = self.check_assignment(statement)

            elif isinstance(statement, ast.FunctionDef):
                value = self.check_function_definition(statement)

            if value:
                for line, offset, msg, rtype in value:
                    yield line, offset, msg, rtype
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号