files_io

class dyn.core.files_io.DataDialect

Bases: Dialect

Datadialect used to read tcommlist files.

delimiter = ','
doublequote = True
escapechar = None
lineterminator = '\r\n'
quotechar = '"'
quoting = 2
skipinitialspace = False
strict = True
dyn.core.files_io.execute_notebook(notebook, execution_path=None)

Execute a notebook.

Parameters
  • notebook (nbf.NotebookNode) –

  • execution_path (str) – path from which to execute notebook (default ".")

dyn.core.files_io.load_commlist(filename)

Load commlist file.

Parameters

filename (str) –

Return type

Tcommlist

Returns

tcommlist

dyn.core.files_io.load_csv(filename)

Load csv file.

Parameters

filename (str) –

Returns

list of objects

Return type

list(list)

Note

It will try to convert numbers to int when possible

dyn.core.files_io.load_graph(filename)

Load graph in gml file.

Parameters

filename (str) –

Returns

graph

Return type

nx.Graph

dyn.core.files_io.load_json(filename)

Load json file.

Parameters

filename (str) –

Return type

dict

dyn.core.files_io.load_notebook(filename)

Load a notebook.

Parameters

filename (str) –

Returns

loaded notebook

Return type

nbf.NotebookNode

dyn.core.files_io.load_tcommlist(filename)

Load tcommlist file.

Parameters

filename (str) –

Return type

Tcommlist

Returns

tcommlist

dyn.core.files_io.save_commlist(commlist, filename)

Save commlist file.

Parameters
  • commlist (Tcommlist) –

  • filename (str) –

Note

same as save_tcommlist() but don’t include headers

dyn.core.files_io.save_csv(list_, filename, append=False)

Save as csv file.

Parameters
  • list (list(list)) –

  • filename (str) –

  • append (bool) – if True appends to the file instead of overwriting

dyn.core.files_io.save_graph(graph, filename)

Save graph in gml format.

Parameters
  • graph (nx.Graph) – any graph structure

  • filename (str) –

dyn.core.files_io.save_json(dico, filename)

Save to json file.

Parameters
  • dico (dict) –

  • filename (str) –

dyn.core.files_io.save_notebook(notebook, filename)

Save a notebook.

Parameters
  • notebook (nbf.NotebookNode) –

  • filename (str) –

dyn.core.files_io.save_notebook_html(notebook, filename, exclude_input=False, **conversion_kargs)

Save a notebook in HTML format.

Parameters
  • notebook (nbf.NotebookNode) –

  • filename (str) –

  • exclude_input (bool) – True for excluding cell inputs from resulting HTML file

  • conversion_kargs – kwargs for the nbconvert.HTMLExporter constructor

dyn.core.files_io.save_tcommlist(tcommlist, filename)

Save tcommlist file.

Parameters
  • tcommlist (Tcommlist) –

  • filename (str) –