__init__.py 文件源码

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

项目:standalone_client 作者: JarbasAI 项目源码 文件源码
def save(config, is_system=False):
        """
        Save configuration ``config``.
        """
        ConfigurationManager.update(config)
        location = SYSTEM_CONFIG if is_system else RUNTIME_CONFIG
        try:
            LOG.info("Saving config: " + location)
            dir = location.replace("/jarbas_runtime.conf", "").replace(
                "/jarbas.conf", "")
            if not exists(dir):
                mkdir(dir)
            try:
                loc_config = load_commented_json(location)
            except:
                loc_config = {}

            with open(location, 'w') as f:
                config = loc_config.update(config)
                json.dump(config, f)
        except Exception as e:
            LOG.error(e)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号