MCPcopy Create free account
hub / github.com/datacamp/pythonwhat / visit_With

Method visit_With

pythonwhat/parsing.py:782–803  ·  view source on GitHub ↗
(self, node)

Source from the content-addressed store, hash-verified

780 self.out = []
781
782 def visit_With(self, node):
783 items = node.items
784 context = [
785 {
786 "node": item.context_expr,
787 "target_vars": self.get_target_vars(item.optional_vars),
788 "with_items": item,
789 "highlight": node,
790 }
791 for item in items
792 ]
793
794 tv_all = TargetVars(sum([list(c["target_vars"].items()) for c in context], []))
795
796 self.out.append(
797 {
798 "context": context,
799 "body": {"node": node.body, "with_items": items},
800 "node": node,
801 "n_vars": len(items),
802 }
803 )
804
805
806class TryExceptParser(Parser):

Callers

nothing calls this directly

Calls 2

TargetVarsClass · 0.85
get_target_varsMethod · 0.80

Tested by

no test coverage detected