From 3ddd5ce109065a50fbbf21a7d840e8f3462d5daa Mon Sep 17 00:00:00 2001 From: Rishabh Raj Date: Mon, 14 Apr 2014 04:16:39 +0530 Subject: [PATCH] Remove fetch_key, an overkill --- doc/ext/notebook.py | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/doc/ext/notebook.py b/doc/ext/notebook.py index 01a2e94c..7ca41475 100644 --- a/doc/ext/notebook.py +++ b/doc/ext/notebook.py @@ -98,27 +98,6 @@ class Notebook(): # this aids in extraction of text segments self.code.append('\n') - def fetch_key(self, type_of_value): - """Find the key required for insertion into notebook. - - Parameters - ---------- - type_of_value : str - Type of data, to be inserted in a cell. - - Returns - ------- - str - Key which reflects what is the cell type. - - Notes - ----- - type_of_value is either, 'code', which maps to cell of type - code('input') or 'markdown', which maps to cell of type markdown('source'). - - """ - return self.valuetype_to_celltype[type_of_value] - def add_cell(self, segment_number, value, type_of_value='code'): """Adds a notebook cell. @@ -135,14 +114,9 @@ class Notebook(): The type of content in the segment. The default value will add a cell of type code. - Notes - ----- - The cell is only added in the notebook if the segment is of type, - markdown or code. - """ if type_of_value in ['markdown', 'code']: - key = self.fetch_key(type_of_value) + key = self.valuetype_to_celltype[type_of_value] self.template["worksheets"][0]["cells"].append(copy.deepcopy(self.cell_type[key])) self.template["worksheets"][0]["cells"][segment_number][key] = value