mib_generator.temp package

Sub-package taking care of runtime configuration.

This sub-package/folder serves the role of a location where config files are stored at the runtime and from where all other parts of the program ask for them. It also holds module which takes care of transfer of these files.

The files/sub-modules here are:

  • temp - Module holding methods which manipulate the config files and transfer them here if needed.

  • paths.json5 - This file stores runtime information about paths to the input/output files in a json5 format.

  • config.json5 - This file stores runtime config information which mostly include what pre-processor macros should be taken as defined when parsing the inputted files and what mib tables should be generated.

Submodules

mib_generator.temp.temp module

This module holds method/s which take care of transferring the config files between directories and getting their data.

At runtime, the whole program works with config files which are stored in the mib_generator.temp sub-package/file, which means that before all of the generation processes happen, the config files from the default directory (mib_generator.data) have to be moved there, which is one of the jobs of this module, the others being the same inversed, loading of config data, etc.

mib_generator.temp.temp.evom_conf(dire)[source]

Cope the runtime config files to the specified directory.

This module is passed a directory location, it check whether it exists and if yes, copies the current runtime config files to there.

Parameters:

dire (str) – A path to directory where the config files are to be copied.

mib_generator.temp.temp.fetch_paths()[source]

Get paths dictionary from the runtime config file.

Loads the paths config file in the runtime directory (the mib_generator.temp sub-package) and extracts the paths to input/output files from it as a dictionary.

Returns:

A dictionary containing the paths to input/output files/directories.

Return type:

dict

mib_generator.temp.temp.move_conf(dire=None)[source]

Transfer the config files from the specified directory to runtime location.

This method looks at the passed directory, checks what config files are inside it and if such are found, moves them to the package runtime directory (mib_generator.temp), rewriting config files which might have been there already. If some config file is not found in the specified directory, transfers config from the default directory (mib_generator.data) instead.

Parameters:

dire (str) – A string specifying the directory from which the config files are to be taken.

mib_generator.temp.temp.update_json(typ, data)[source]

Update the runtime config file with the passed parameter.

This method takes a config parameter with value data and of type/name typ, loads the runtime config file, incorporates this parameter to it and then saves it again.

Parameters:
  • typ (str) – The type/name of the config parameter to be saved.

  • data (str) – The contents of the parameter to be saved.

mib_generator.temp.temp.update_paths(diction)[source]

Update paths in the "paths.json5" config file to the passed values.

Goes through each entry in the passed dictionary and if it recognises it as valid configuration path, it saves it to the runtime config file. If it is given a path to file which doesn’t exists, it raises a warning but saves it nonetheless.

Parameters:

diction (dict) – A dictionary containing paths to the input/output files/directories.

Returns:

A dictionary of the values saved. (currently the same as the inputted dictionary)

Return type:

dict