diggrtoolbox.schemaload package


diggrtoolbox.schemaload.schemaload module

Provides two methods which combine opening files and verification against given schema.

diggrtoolbox.schemaload.schemaload.load_file_with_schema(filename, schema)[source]

Loads data from a file and exits the program if errors occur. If this functionality is not required please use the schema_load function. :param filename: filename of the file with the data :param schema: filename of the file with the schema :return: the data in the datafile as python object (list or dict)

diggrtoolbox.schemaload.schemaload.schema_load(data_filename, schema_filename)[source]

Opens the given file and returns its content as python object, if it contains valid JSON data. Otherwise exceptions are raised, which need to be catched in the calling function :param data_filename: full path to the input file :param schema_filename: full path to the input file :return: dict or list

Module contents