npu.inout.json_io

Classes

JsonIO()

class npu.inout.json_io.JsonIO
Author:

Alberto M. Esmoris Pena

Class with util static methods for input/output operations related to JSON files.

static read(path)

Read a JSON file.

Parameters:

path – Path to the JSON file to be read.

Returns:

Read JSON.

static write_dict(path, dictionary)

Write the given dictionary to a JSON file at the given path.

Parameters:
  • path (str) – Path to the JSON file to be written.

  • dictionary (dict) – Dictionary to be written to a JSON file.

Returns:

Nothing at all.

static dump_dict(jsonf, dictionary)

Dump the contents of the dictionary to the given JSON file.

Parameters:
  • jsonf (TextIOWrapper) – The text I/O object to write dump the contents of the dictionary as a JSON.

  • dictionary (dict) – The dictionary that must be dumped to a I/O object in JSON format.

Returns:

Nothing at all, but the contents of the dictionary are dumped to the I/O object in JSON format.

static write_list(path, dicts)

Write a list of dictionaries as a single JSON file.

See npu.inout.json_io.JsonIO.write_dict() for further details.

Parameters:
Returns:

See npu.inout.json_io.JsonIO.write_dict().