MCPcopy Index your code
hub / github.com/datacamp/pythonwhat / wrap_in_module

Function wrap_in_module

pythonwhat/utils_ast.py:6–17  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

4
5
6def wrap_in_module(node):
7 new_node = ast.Module(node, [])
8 if isinstance(node, list):
9 if len(node) > 0:
10 new_node.first_token = node[0].first_token
11 new_node.last_token = node[-1].last_token
12 else:
13 pass # do nothing
14 else:
15 new_node.first_token = node.first_token
16 new_node.last_token = node.first_token
17 return new_node
18
19
20def assert_ast(state, element, fmt_kwargs):

Callers 1

parse_nodeMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected