def setUp(self): self.input_file_name = os.path.join('tests', 'sample.ipynb') # class under test self.cp = sc.SymbolConverter() self.file_processor = fu.FileProcessor(self.input_file_name, self.cp)
def main(argv): if 1 < len(argv): filename = argv[1] p = fu.FileProcessor(filename, CellProcessorDeleteOutput()) p.process_nb_file() else: print("Usage : python %s <notebook file path>" % os.path.basename(__file__)) help(nbformat)
def test_delete_output_file(self): # object under test rm_cp = rm.CellProcessorDeleteOutput() # apply object under test on the input test file p = fu.FileProcessor(self.input_file_name, rm_cp) p.process_nb_file(b_write_file=True) node_dict = p.read_file() cells = node_dict.get('cells', []) for cell in cells: self.assertFalse(cell.get('outputs'))
def symbol_lines_in_file(input_file_name): sc = SymbolLister() file_processor = fu.FileProcessor(input_file_name, sc) result = file_processor.process_nb_file() return result
def setUp(self): self.input_file_name = os.path.join('tests', 'sample.ipynb') self.file_processor = nbutils.FileProcessor(self.input_file_name)