Package linspector :: Package lib :: Package config :: Module parser :: Class ConfigParser
[hide private]
[frames] | no frames]

Class ConfigParser

source code

Known Subclasses:

Instance Methods [hide private]
 
__init__(self, log)
initializes a new ConfigParser Object
source code
 
_create_new_config_dict(self) source code
 
create_config(self, config) source code
 
_read_json_config(self, configFilename)
reads the config File and returns a dictionary, while lowering the first keys
source code
 
_create_raw_Object(self, jsonDict, msgName, creator)
creates an Main object from the configuration, but just parses raw data and hands it to the object
source code
 
_load_module(self, clazz, modPart)
imports and caches a module.
source code
 
replace_with_import(self, objList, modPart, items_func, class_check)
replaces configuration dicts with their objects by importing and creating it in the first step.
source code
 
replace_pointer(self, objectList, replObjectList, id_list_func, id_get_func)
replaces objects from the config by ids.
source code
 
parse_config(self, configFilename) source code
Method Details [hide private]

__init__(self, log)
(Constructor)

source code 

initializes a new ConfigParser Object

:param log: pre configured logger Object to post messages while parsing"

_read_json_config(self, configFilename)

source code 

reads the config File and returns a dictionary, while lowering the first keys

:param configFilename: the path under which the configuration file should be found

_create_raw_Object(self, jsonDict, msgName, creator)

source code 

creates an Main object from the configuration, but just parses raw data and hands it to the object

:param jsonDict: the configuration file part as dict :param msgName: name of object for error message :param creator: function pointer which is taking two arguments: identifier of the object and arguments. :should return an object :return: a list of objects returned by creator

_load_module(self, clazz, modPart)

source code 

imports and caches a module.

:param clazz: the filename of the module (i.e email, ping...) :param modPart: the folder of the module. (i.e services, parsers...) :return: the imported/cached module, or throws an error if it couldn't find it

replace_with_import(self, objList, modPart, items_func, class_check)

source code 

replaces configuration dicts with their objects by importing and creating it in the first step. In the second step the original list of json config dicts gets replaced by the loaded objects

:param objList: the list of objects which is iterated on :param modPart: the folder from the module (i.e tasks, parsers) :param items_func: function to get a pointer on the list of json-config-objects to replace. Takes one argument and :param class_check: currently unsupported

replace_pointer(self, objectList, replObjectList, id_list_func, id_get_func)

source code 

replaces objects from the config by ids.

:param objectList: the list of objects to be iterated on :param replObjectList: the list of objects to replace :param id_list_func: function taking one argument as object and should return a list of config ids to replace :param id_get_func: function taking one config-object as argument and should return the config id to compare