def GET(self): config_data = utils._read_configuration() data = { "provider": config_data['provider'], "homepage": config_data['homepage'], "admin_name": config_data['admin_name'], "admin_email": config_data['admin_email'] } return json.dumps(data)
def change_config_status() -> None: """Changes config status in config.yml to True""" config = utils._read_configuration() if config['config_status']: return else: config['config_status'] = True utils.write_config(config)
def configuration_warning() -> None: """ Checks if flame has been configured reading the config.yml and checking the config_status flag """ config = utils._read_configuration() if not isinstance(config['config_status'], bool): raise ValueError('Wrong type found in config status.') if config['config_status']: return elif not config['config_status']: print("Flame hasn't been configured yet. " "Model repository may be wrong. " "Please use 'flame -c config' before using flame") sys.exit() # force exit
def configuration_warning() -> None: """ Checks if flame has been configured reading the config.yml and checking the config_status flag """ config = utils._read_configuration() if config != False: if isinstance(config['config_status'], bool): if config['config_status']: if os.path.isdir(config['model_repository_path']): return print("Flame hasn't been configured yet. " "Model repository may be wrong. " "Please use 'flame -c config' before using flame") sys.exit() # force exit
def test_read_congiguration(): assert isinstance(utils._read_configuration(), dict)