我们从Python开源项目中,提取了以下27个代码示例,用于说明如何使用jinja2.nodes.With()。
def parse_with(self): node = nodes.With(lineno=next(self.stream).lineno) targets = [] values = [] while self.stream.current.type != 'block_end': lineno = self.stream.current.lineno if targets: self.stream.expect('comma') target = self.parse_assign_target() target.set_ctx('param') targets.append(target) self.stream.expect('assign') values.append(self.parse_expression()) node.targets = targets node.values = values node.body = self.parse_statements(('name:endwith',), drop_needle=True) return node