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

Function get_output

pythonwhat/tasks.py:330–339  ·  view source on GitHub ↗
(f, process, shell, *args, **kwargs)

Source from the content-addressed store, hash-verified

328## Get the output of a tree (with setting envs, pre_code and/er expr_code)
329@process_task
330def get_output(f, process, shell, *args, **kwargs):
331 with capture_output() as out:
332 res = f(*args, process=process, shell=shell, **kwargs)
333
334 out_str = out[0].strip()
335 if not isinstance(res, Exception):
336 toret = out_str or "no printouts"
337 return toret, toret
338 else:
339 return res, str(res)
340
341
342@process_task

Callers

nothing calls this directly

Calls 2

capture_outputFunction · 0.85
fFunction · 0.85

Tested by

no test coverage detected