Exemplo n.º 1
0
 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.is_async = node.is_async
     new.analyzed_types = [self.type(typ) for typ in node.analyzed_types]
     return new
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
 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
Exemplo n.º 4
0
 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
Exemplo n.º 5
0
 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