common.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:lcdb-wf 作者: lcdb 项目源码 文件源码
def resolve_config(config, workdir=None):
    """
    Parameters
    ----------
    config : str, dict
        If str, assume it's a YAML file and parse it; otherwise pass through

    workdir : str
        Optional location to specify relative location of all paths in `config`
    """
    if isinstance(config, str):
        config = yaml.load(open(config))

    def rel(pth):
        if workdir is None or os.path.isabs(pth):
            return pth
        return os.path.join(workdir, pth)
    for key in PATH_KEYS:
        if key in config:
            config[key] = rel(config[key])
    return config
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号