config.py 文件源码

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

项目:http-prompt 作者: eliangcs 项目源码 文件源码
def load_user():
    """Read user config file and return it as a dict."""
    config_path = get_user_config_path()
    config = {}

    # TODO: This may be overkill and too slow just for reading a config file
    with open(config_path) as f:
        code = compile(f.read(), config_path, 'exec')
    exec(code, config)

    keys = list(six.iterkeys(config))
    for k in keys:
        if k.startswith('_'):
            del config[k]

    return config
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号