# 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

## model_conf_parser API reference

## ModelConfParser

class macsypy.model_conf_parser.ModelConfParser(path: str)

  Handle model_conf.xml configuration file.

  __init__(path: str) → None
    Parameters:

      path (str) – The path to the configuration file

  __weakref__

    list of weak references to the object

  _get_model_conf_node() → ElementTree

    Find the root of the document

    Returns:

      the document root of model_conf

  _parse_section(section_node: ~xml.etree.ElementTree.ElementTree, allowed_elements: dict[slice(<class 'str'>, typing.Callable, None)]) → dict[slice(<class 'str'>, typing.Any, None)]

    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() → dict[slice(<class 'str'>, typing.Any, None)]

    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: ElementTree) → dict[slice(<class 'str'>, typing.Any, None)]

    Parse the node ‘filtering’ containing the filtering options configuration

    Parameters:

      filtering_node – the node ‘filtering’

    Returns:

      the configuration option/value about the filtering

  parse_weights(weights_node: ElementTree) → dict[slice(<class 'str'>, <class 'float'>, None)]

    Parse the node ‘weights’ containing the scoring weight configuration

    Parameters:

      weights_node – the node ‘weights’

    Returns:

      the configuration option/value about the scores

Fork me on GitHub