transformers.py 文件源码

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

项目:async2rewrite 作者: TheTrain2000 项目源码 文件源码
def remove_passcontext(self, n):
        for d in n.decorator_list:
            if not isinstance(d, ast.Call):
                continue
            for kw in list(d.keywords):  # iterate over a copy of the list to avoid removing while iterating
                if not isinstance(kw.value, ast.NameConstant):
                    continue
                if kw.arg == 'pass_context':  # if the pass_context kwarg is set to True
                    if self.interactive and not prompt_change(
                            'A possible change was found to remove the pass_context decorator from {}.'.format(n.name)
                    ):
                        return n
                    d.keywords.remove(kw)
                    stats_counter['coro_changes'] += 1
        return n
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号