transformers.py 文件源码

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

项目:async2rewrite 作者: TheTrain2000 项目源码 文件源码
def stateful_get_all_emojis(self, expr):
        if not isinstance(expr.value, ast.Await):
            return expr
        if not isinstance(expr.value.value, ast.Call):
            return expr
        call = expr.value.value
        if isinstance(call.func, ast.Attribute):
            if call.func.attr == 'get_all_emojis':
                if self.interactive and not prompt_change(
                        'A possible change was found to make get_all_emojis stateful.'
                ):
                    return expr
                new_expr = ast.Expr()
                new_expr.value = ast.Attribute()
                new_expr.value.value = call.func.value
                new_expr.value.attr = 'emojis'
                new_expr.value.ctx = ast.Load()

                new_expr = ast.copy_location(new_expr, expr)

                stats_counter['expr_changes'] += 1
                return new_expr
        return expr
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号