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

Function build_call

pythonwhat/checks/check_funcs.py:271–284  ·  view source on GitHub ↗
(callstr, node)

Source from the content-addressed store, hash-verified

269
270
271def build_call(callstr, node):
272 if isinstance(node, ast.FunctionDef): # function name
273 func_expr = ast.Name(id=node.name, ctx=ast.Load())
274 argstr = "`%s`" % callstr.replace("f", node.name)
275 elif isinstance(node, ast.Lambda): # lambda body expr
276 func_expr = node
277 argstr = "it with the arguments `%s`" % callstr.replace("f", "")
278 else:
279 raise TypeError("Can't handle AST that is passed.")
280
281 parsed = ast.parse(callstr).body[0].value
282 parsed.func = func_expr
283 ast.fix_missing_locations(parsed)
284 return parsed, argstr
285
286
287def check_call(state, callstr, argstr=None, expand_msg=None):

Callers 1

check_callFunction · 0.85

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected