def visit_with_stmt(self, node: WithStmt) -> WithStmt: new = WithStmt(self.expressions(node.expr), self.optional_expressions(node.target), self.block(node.body), self.optional_type(node.unanalyzed_type)) new.analyzed_types = [self.type(typ) for typ in node.analyzed_types] return new
def visit_AsyncWith(self, n: ast3.AsyncWith) -> WithStmt: if n.type_comment is not None: target_type = parse_type_comment(n.type_comment, n.lineno, self.errors) else: target_type = None r = WithStmt([self.visit(i.context_expr) for i in n.items], [self.visit(i.optional_vars) for i in n.items], self.as_block(n.body, n.lineno), target_type) r.is_async = True return r
def visit_AsyncWith(self, n: ast3.AsyncWith) -> WithStmt: if n.type_comment is not None: target_type = parse_type_comment(n.type_comment, n.lineno, self.errors) else: target_type = None r = WithStmt([self.visit(i.context_expr) for i in n.items], [self.visit(i.optional_vars) for i in n.items], self.as_required_block(n.body, n.lineno), target_type) r.is_async = True return r
def visit_With(self, n: ast27.With) -> WithStmt: typ = self.translate_type_comment(n, n.type_comment) stmt = WithStmt([self.visit(n.context_expr)], [self.visit(n.optional_vars)], self.as_required_block(n.body, n.lineno), typ) return self.set_line(stmt, n)
def visit_With(self, n: ast27.With) -> WithStmt: if n.type_comment is not None: target_type = parse_type_comment(n.type_comment, n.lineno, self.errors) else: target_type = None return WithStmt([self.visit(n.context_expr)], [self.visit(n.optional_vars)], self.as_required_block(n.body, n.lineno), target_type)
def visit_With(self, n: ast3.With) -> WithStmt: if n.type_comment is not None: target_type = parse_type_comment(n.type_comment, n.lineno, self.errors) else: target_type = None node = WithStmt([self.visit(i.context_expr) for i in n.items], [self.visit(i.optional_vars) for i in n.items], self.as_required_block(n.body, n.lineno), target_type) return self.set_line(node, n)
def visit_With(self, n: ast27.With) -> WithStmt: if n.type_comment is not None: target_type = parse_type_comment(n.type_comment, n.lineno, self.errors, assume_str_is_unicode=self.unicode_literals) else: target_type = None stmt = WithStmt([self.visit(n.context_expr)], [self.visit(n.optional_vars)], self.as_required_block(n.body, n.lineno), target_type) return self.set_line(stmt, n)
def visit_With(self, n: ast27.With) -> WithStmt: if n.type_comment is not None: extra_ignore, typ = parse_type_comment(n.type_comment, n.lineno, n.col_offset, self.errors, assume_str_is_unicode=self.unicode_literals) if extra_ignore: self.type_ignores.add(n.lineno) else: typ = None stmt = WithStmt([self.visit(n.context_expr)], [self.visit(n.optional_vars)], self.as_required_block(n.body, n.lineno), typ) return self.set_line(stmt, n)
def visit_With(self, n: ast35.With) -> Node: return WithStmt([self.visit(i.context_expr) for i in n.items], [self.visit(i.optional_vars) for i in n.items], self.as_block(n.body, n.lineno))
def visit_with_stmt(self, node: WithStmt) -> Node: return WithStmt(self.nodes(node.expr), self.optional_names(node.name), self.block(node.body))
def visit_With(self, n: ast27.With) -> WithStmt: return WithStmt([self.visit(n.context_expr)], [self.visit(n.optional_vars)], self.as_block(n.body, n.lineno))
def visit_AsyncWith(self, n: ast35.AsyncWith) -> WithStmt: r = WithStmt([self.visit(i.context_expr) for i in n.items], [self.visit(i.optional_vars) for i in n.items], self.as_block(n.body, n.lineno)) r.is_async = True return r
def visit_with_stmt(self, node: WithStmt) -> WithStmt: return WithStmt(self.expressions(node.expr), self.optional_expressions(node.target), self.block(node.body), self.optional_type(node.target_type))
def visit_AsyncWith(self, n: ast35.AsyncWith) -> Node: r = WithStmt([self.visit(i.context_expr) for i in n.items], [self.visit(i.optional_vars) for i in n.items], self.as_block(n.body, n.lineno)) r.is_async = True return r
def visit_with_stmt(self, node: WithStmt) -> None: super().visit_with_stmt(node) node.analyzed_types = []