def wait(self, *pargs, **kwargs): """Wait for the JSController to finish""" ret = super(JSController, self).wait(*pargs, **kwargs) # If this is a SlimerJS controller, check the captured stdout for # errors. Otherwise, just return the return code. if self.engine == 'slimerjs': stdout = bytes_to_str(self.stdout) if ret != 0: # This could still happen e.g. if it's stopped by SIGINT return ret return bool(self.slimer_failure.search(strip_ansi(stdout))) else: return ret
def process_stream(self, output): from IPython.utils.text import strip_ansi if self.hide_output: return "" return u"```\n##OUTPUT\n{}\n```".format(strip_ansi(output.text))
'raw': 'Raw cell --------------------', 'output': 'Output ----------------------', } for cell in nb.worksheets[0].cells: if cell.cell_type == 'heading': print(banners['heading'] % cell.level) else: print(banners[cell.cell_type]) if cell.cell_type == 'code': source = cell.input else: source = cell.source print(source) if not source.endswith('\n'): print() if cell.cell_type == 'code': if cell.outputs: print(banners['output']) for output in cell.outputs: if 'text' in output: print(strip_ansi(output.text)) elif 'traceback' in output: print(strip_ansi('\n'.join(output.traceback))) else: print("(Non-plaintext output)") print()
'output': 'Output ----------------------', } for cell in nb.worksheets[0].cells: if cell.cell_type == 'heading': print(banners['heading'] % cell.level) else: print(banners[cell.cell_type]) if cell.cell_type == 'code': source = cell.input else: source = cell.source print(source) if not source.endswith('\n'): print() if cell.cell_type == 'code': if cell.outputs: print(banners['output']) for output in cell.outputs: if 'text' in output: print(strip_ansi(output.text)) elif 'traceback' in output: print(strip_ansi('\n'.join(output.traceback))) else: print("(Non-plaintext output)") print()