def loadConfig(fileName, encoding="utf-8"):
    """
    Loads the given configuration file (filename without extension) and 
    returns the parsed object structure 
    """

    configName = findConfig(fileName)
    if configName is None:
        raise UserError("Unsupported config file: %s" % fileName)

    fileHandle = open(configName, mode="r", encoding=encoding)    

    fileExt = os.path.splitext(configName)[1]
    if fileExt == ".json":
        result = json.load(fileHandle)

    elif fileExt == ".yaml":
        result = yaml.load(fileHandle)

    fileHandle.close()
    return result
dataset/ETHPy150Open zynga/jasy/jasy/core/Config.py/loadConfig/original