Cellframe Node Config module

This module allows convenient and quick retrieval of parameter values from the Cellframe Node configuration file. For convenience, the module allows extracting not only the string representation of the extracted values but also supports bool, int, List[str] types. If you have any questions, please refer to the documentation.

Below there is a code example:

from pycfhelpers.node.logging import CFLog
from pycfhelpers.node import config as node_config
 
log = CFLog()
 
# config - is a pre-created CFConfig instance to extract  
# parameter values from the cellframe-node.cfg file. 
 
def init():
    # For example, retrieve some parameters from each of the sections.
    # Pass the file section as the first argument
    # and the name of the parameter as the second.
    debug_mode = node_config["general"]["debug_mode"]
    log.notice(f"{debug_mode=}")
 
    # You can also use the get() method to retrieve 
    # the value of the specified parameter.
    auto_online = node_config["general"].get("auto_online")
    log.notice(f"{auto_online=}")
 
    # The second parameter of the get() method
    # is the default value (optional, defaults to None). Use it to avoid accidental errors,
    # or if you are not sure that such a parameter exists.
    non_existent_parameter = node_config["general"].get("non_existent_parameter", "I don't exist")
    log.notice(f"{non_existent_parameter=}")
 
    return 0
    ```