from pathlib import Path
import yaml


def loadConfigDict(configNames: tuple):
    # pathLib syntax for windows, max, linux compatibility, see https://realpython.com/python-pathlib/ for an intro
    """
    Generic function to load and open yaml config files

    :param configNames: Tuple containing names of config files to be loaded
    :return: Dictionary with opened yaml config files
    """
    basePath = Path(__file__).parent.parent / 'config'
    configDict = {}
    for configName in configNames:
        filePath = (basePath / configName).with_suffix('.yaml')
        with open(filePath) as ipf:
            configDict[configName] = yaml.load(ipf, Loader=yaml.SafeLoader)
    return configDict