helpers.py 文件源码

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

项目:shakedown 作者: dcos 项目源码 文件源码
def read_config(args):
    """ Read configuration options from ~/.shakedown (if exists)

        :param args: a dict of arguments
        :type args: dict

        :return: a dict of arguments
        :rtype: dict
    """

    configfile = os.path.expanduser('~/.shakedown')

    if os.path.isfile(configfile):
        with open(configfile, 'r') as f:
            config = toml.loads(f.read())

        for key in config:
            param = key.replace('-', '_')

            if not param in args or args[param] in [False, None]:
                args[param] = config[key]

    return args
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号