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

Method visit_DictComp

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

Source from the content-addressed store, hash-verified

740 """
741
742 def visit_DictComp(self, node):
743 target = node.generators[0].target
744 tv = Parser.get_target_vars(target)
745 ifs = node.generators[0].ifs
746 self.out.append(
747 {
748 "node": node,
749 "key": {"node": node.key, "target_vars": tv},
750 "value": {"node": node.value, "target_vars": tv},
751 "target": target,
752 "iter": node.generators[0].iter,
753 "ifs": [{"node": ifnode, "target_vars": tv} for ifnode in ifs],
754 # TODO: 'private' _target_vars, since it shouldn't be set when selecting node,
755 # see remarks in test_list_comp on rewriting
756 "_target_vars": tv,
757 }
758 )
759
760
761class FunctionBodyTransformer(ast.NodeTransformer):

Callers

nothing calls this directly

Calls 1

get_target_varsMethod · 0.80

Tested by

no test coverage detected