mib_generator.data package
The files and submodules in this package/folder serve as a storage of data and global-level variables which are mostly stored here in order not to cluster the code somewhere else and in order to be easily accessible by any other file.
The files/submodules here are:
longdata- This giant module stores mostly all information about the structures of MIB tables and what checks should be performed by each entry in them.
warn- Module storing definition of various warnings and errors that can be raised by the program.
paths.json5- This file stores default information about paths to the input/output files in a json5 format.
config.json5- This file stores default 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.data.longdata module
Here various data that would otherwise cluster the code elsewhere are stored.
This module includes mostly information about the structures of the MIB tables and characteristics
that are specified for each entry in them. For each MIB table, there is an module-wide attribute
here that through a list of dictionaries specifies, what the names and characteristics (type, length, whether
mandatory) entries in each column of this table should have. All of these lists are then joined in one
dictionary tables_format from which any characteristics of MIB tables can be extracted.
- mib_generator.data.longdata.pid
List of dictionaries each entry of which corresponds to information about an entry in one column in the pid table. Lists like this are stored in this module for every MIB table.
- Type:
list
- mib_generator.data.longdata.sizes
A lookup dictionary which links every number constant type with its bite-size.
- Type:
dict
- mib_generator.data.longdata.tables_format
A dictionary created from list like
pidabove specified for each MIB tables. Allows for easy access to these information.- Type:
dict
- mib_generator.data.longdata.unique_entries
A dictionary which for each MIB table (specified by its name) states what colums or groups of columns should hole unique/non-repeating entries (e.g. there should be only one entry in pid column “PID_TYPE” for a packet of given type.).
- Type:
dict
- mib_generator.data.longdata.uint_pfc
List that states what pfc type (given by the order in the list) should be linked to a integer constant of a given C-type.
- Type:
list
- mib_generator.data.longdata.time_pfc
List that states what pfc type (given by the order in the list) should be linked to a time-describing constant of a given allocation of bites for fine/course time.
- Type:
list
- mib_generator.data.longdata.translation
A lookup dictionary stating what descriptions should be given to each attribute of the Python representations of C-objects in order to make the entries more human-readable in the GUI visualisation.
- Type:
dict
mib_generator.data.warn module
Takes care of warning and errors that can be raised by the rest of the program.
This module holds both definition of all the errors and warnings that can occur throughout and a method that can be used to raise them. (This is made this centralised so that the raising method can be easily changed later if e.g. the UI changes.)
- mib_generator.data.warn.warnings
A dictionary containing the text definitions of all the possible warnings.
- Type:
dict
- mib_generator.data.warn.errors
A dictionary containing the text definitions of all the possible errors.
- Type:
dict
- mib_generator.data.warn.complete
A dictionary containing the text definitions of all the possible completion messages.
- Type:
dict
- mib_generator.data.warn.display
Defines (or holds the object) where the warnings should be raise.
- Type:
None or some object
- mib_generator.data.warn.disp_update(var)[source]
Update the
displayglobal variable in this module to the specified value.This quite ugly method (or approach) serves the purpose of specifying to the method that takes care of raising warnings, that the warnings shouldn’t be printed to terminal but rather added to the object’s text (the passed object is expected to be some GUI console).
- Parameters:
var (object such as PySide6.QtWidgets.QTextEdit) – The object to be assigned to the
displayglobal variable.
- mib_generator.data.warn.raises(ID, *data)[source]
Raise warning/error with the given ID.
This method looks up a warning/error text for a given passed ID, formats it with other passed parameters and then displays it - either to terminal if the global attribute
displayisNoneor to the object that this attribute holds..- Parameters:
ID (str) – The ID identifying the warning/error of format 3 capital letters + one-digit number.
*data (*args) – Additional parameters which are to be formatted into the warning/error text.