def get_value()

in dask-fargate/binderhub/binderhub_config.py [0:0]


def get_value(key, default=None):
    """
    Find an item in values.yaml of a given name & return it
    get_value("a.b.c") returns values['a']['b']['c']
    """
    # start at the top
    value = _load_values()
    # resolve path in yaml
    for level in key.split('.'):
        if not isinstance(value, dict):
            # a parent is a scalar or null,
            # can't resolve full path
            return default
        if level not in value:
            return default
        else:
            value = value[level]
    return value