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
评论列表
文章目录