mib_generator.main package
This subpackage does a sort of administrative work around the other sub-packages. It doesn’t contain any program logic itself but it calls it from other parts of the code and provides an joint interface for it that the user can interact with.
Included submodules:
Submodules
mib_generator.main.cli module
Provides a simple CLI that can be accessed by the user.
If ran directly as a Python script, this module provides the user with a simple CLI which allows for specification of
various options for runtime of the script itself (whether the MIB databases should be constructed, whether saved,
whether the parsed file should be visualised, etc..). It also provides a quick --help summary and an option to
run scripts for updating the config and paths files before running the generating script itself.
- mib_generator.main.cli.cli_run()[source]
Manages the CLI and runs the program.
This is the main method that is run by external calls that want to run the whole program. It takes no arguments but assuming it is run as a bash/terminal program, it tries to parse and interpret passed flags and options and creates a small CLI interface which can be presented to the user with the
--helpflag.
mib_generator.main.main module
This module works as a startpoint and a junction for creation of the MIB databases.
This module through its main method serves the role of a logical centre of the whole program. It interchanges
appropriate files between sub-packages, calls appropriate methods for each task, etc. See main for more info.
- mib_generator.main.main.main(visual=False, generate=True, parseonly=False, paths=False, config=False, generate_t=False, custom_dir=None)[source]
Run this whole hellish thing.
This method holds the main logic of the whole program. Roughly it sequentially does this:
If the appropriate option is raised, run script to update the input/output paths in default/specified directory.
If the appropriate option is raised, run script to update the config file in default/specified directory.
Load the configuration file into the runtime directory (
mib_generator.temp).Initialise the
mib_generator.parsing.loadmodule which automatically parses the files at the specified paths.Unless construction is disabled, call appropriate construction scripts and receive Python representation of all the calibrations, TM-packets, TC-commands, etc. that occur in the parsed files.
Perform some checks that these objects (mainly TM-packets and calibrations) are linked in a correct way.
Unless generation is disabled, call the generation script which turns all previously constructed objects into MIB tables and saves them.
If the appropriate option is raised, generate a document summing up the interpreted TM/TC packages.
If the appropriate option is raised, show the parsed files’ contents in a GUI visualisation.
- Parameters:
visual (bool) –
Trueif the GUI visualisation of the parsed files should be shown,Falseotherwise (and by default).generate (bool) –
True(by default) if the MIB tables should be generated and saved from the constructed Python representations,Falseotherwise.parseonly (bool) –
Trueif only parsing of the C-files should be done and none of the subsequent steps.Falseotherwise and by default.paths (bool) –
Trueif the script to update the input/output paths should be run,Falseotherwise (and by default).config (bool) –
Trueif the script to update the config file should be run,Falseotherwise (and by default).generate_t (bool) –
Trueif the.docxdocument summing up the processed TM and TC packets is to be generated,Falseotherwise.custom_dir (str) – A string specifying the path to a directory where the configuration files on basis of which this program runs, are located.
- Returns:
Trueif the script finished successfully,Noneotherwise.- Return type:
bool