Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 39aa8a9

Browse files
committed
added documentation to more functions and methods
1 parent add299a commit 39aa8a9

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

nbconvert.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ def markdown2rst(src):
195195

196196

197197
def rst_directive(directive, text=''):
198+
"""
199+
Makes ReST directive block and indents any text passed to it.
200+
"""
198201
out = [directive, '']
199202
if text:
200203
out.extend([indent(text), ''])
@@ -270,6 +273,22 @@ def dispatch_display_format(self, format):
270273
return getattr(self, 'render_display_format_' + format, self.render_unknown_display)
271274

272275
def convert(self, cell_separator='\n'):
276+
"""
277+
Generic method to converts notebook to a string representation.
278+
279+
This is accomplished by dispatching on the cell_type, so subclasses of
280+
Convereter class do not need to re-implement this method, but just
281+
need implementation for the methods that will be dispatched.
282+
283+
Parameters
284+
----------
285+
cell_separator : string
286+
Character or string to join cells with. Default is "\n"
287+
288+
Returns
289+
-------
290+
out : string
291+
"""
273292
lines = []
274293
lines.extend(self.optional_header())
275294
converted_cells = []
@@ -308,9 +327,19 @@ def save(self, outfile=None, encoding=None):
308327
return os.path.abspath(outfile)
309328

310329
def optional_header(self):
330+
"""
331+
Optional header to insert at the top of the converted notebook
332+
333+
Returns a list
334+
"""
311335
return []
312336

313337
def optional_footer(self):
338+
"""
339+
Optional footer to insert at the end of the converted notebook
340+
341+
Returns a list
342+
"""
314343
return []
315344

316345
def _new_figure(self, data, fmt):

0 commit comments

Comments
 (0)