def visit_Expr(self, node: Expr) -> Expr: node.value = Call(func=Name(id='__autoexpr__', ctx=Load()), args=[node.value], keywords=[]) fix_missing_locations(node) return node
def modify_expr(expr: ast.Expr) -> None: if ( isinstance(expr.value, ast.UnaryOp) and isinstance(expr.value.op, ast.Invert) and isinstance(expr.value.operand, (ast.Str, ast.JoinedStr)) ): expr.value = ast.Call( func=ast.Name(id='run_shell', ctx=ast.Load()), args=[expr.value.operand], keywords=[] )
def visit_Expr(self, expr: ast.Expr) -> ast.Expr: expr.value = self.modify_expr(expr.value) super().generic_visit(expr) return expr