model_conf_parser

The parser of xml file model_cof.xml located at the root of the model package. This file is optional in package

ModelConfParser

class macsypy.model_conf_parser.ModelConfParser(path)[source]

Handle model_conf.xml configuration file.

__init__(path)[source]
Parameters:path (str) – The path to the configuration file
__weakref__

list of weak references to the object (if defined)

_get_model_conf_node()[source]

Find the root of the document

Returns:the document root of model_conf
_parse_section(section_node, allowed_elements)[source]

Parse a node containing configurations options and value

Parameters:
  • section_node
  • allowed_elements (a dict with options name as keys and function to parse the element) – The elements allowed in this section Only these elements are parsed and in the final dictionnary
Returns:

dict

parse()[source]

Parse the xml ‘model_conf’ file set at the root of a data package

Returns:The specific configuration for a model family
Return type:dict with the name of variables as keys and value as values
parse_filtering(filtering_node)[source]

Parse the node ‘filtering’ containing the filtering options configuration

Parameters:filtering_node (:class”Et.ElementTree object) – the node ‘filtering’
Returns:the configuration option/value about the filtering
Return type:dict
parse_weights(weights_node)[source]

Parse the node ‘weights’ contening the scoring weight configuration

Parameters:weights_node (:class”Et.ElementTree object) – the node ‘weights’
Returns:the configuration option/value about the scores
Return type:dict