示例#1
0
 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)
示例#2
0
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)
示例#3
0
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
示例#4
0
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
示例#5
0
def test_read_congiguration():
    assert isinstance(utils._read_configuration(), dict)