Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def tuna(line: str, cell: Optional[str] = None) -> HTML:
ip = get_ipython() # noqa: F821
with tempfile.TemporaryDirectory() as tmp_dir:
prun_fname = f"{tmp_dir}/prun"
prun_line = f"-q -D {prun_fname}"
with capture_output():
ip.run_cell_magic("prun", prun_line, cell if cell is not None else line)
args = [prun_fname, "-o", tmp_dir, "--no-browser"]
tuna_main(args)
return _display_tuna(tmp_dir)