示例#1
0
def source(data_source):
    result = {}
    if data_source in list(map(lambda x: x['id'], SUPPORT_WEBSITE)):
        recreate_source_relatively_table()
        write_config('DATA_SOURCE', data_source)
        print_success('data source switch succeeds')
        result['status'] = 'success'
        result['message'] = 'you have successfully change your data source to {}'.format(data_source)
    else:
        result['status'] = 'error'
        result['message'] = 'please check input.nata source should be {} or {}'.format(
            *[x['id'] for x in SUPPORT_WEBSITE])
    return result
示例#2
0
def source(data_source: str) -> ControllerResult:
    result = {}
    if data_source in list(map(itemgetter("id"), SUPPORT_WEBSITE)):
        recreate_source_relatively_table()
        write_config("DATA_SOURCE", data_source)
        print_success("data source switch succeeds")
        result["status"] = "success"
        result[
            "message"] = f"you have successfully change your data source to {data_source}"
    else:
        result["status"] = "error"
        result[
            "message"] = "please check your input. data source should be one of {}".format(
                [x["id"] for x in SUPPORT_WEBSITE])
    return result
示例#3
0
文件: controllers.py 项目: zhkrb/BGmi
def source(data_source):
    result = {}
    if data_source in list(map(lambda x: x['id'], SUPPORT_WEBSITE)):
        recreate_source_relatively_table()
        write_config('DATA_SOURCE', data_source)
        print_success('data source switch succeeds')
        result['status'] = 'success'
        result[
            'message'] = 'you have successfully change your data source to {}'.format(
                data_source)
    else:
        result['status'] = 'error'
        result[
            'message'] = 'please check input.nata source should be {} or {}'.format(
                *[x['id'] for x in SUPPORT_WEBSITE])
    return result
示例#4
0
def source(data_source):
    result = {}
    if data_source in list(map(lambda x: x["id"], SUPPORT_WEBSITE)):
        recreate_source_relatively_table()
        write_config("DATA_SOURCE", data_source)
        print_success("data source switch succeeds")
        result["status"] = "success"
        result[
            "message"] = "you have successfully change your data source to {}".format(
                data_source)
    else:
        result["status"] = "error"
        result[
            "message"] = "please check input.nata source should be {} or {}".format(
                *[x["id"] for x in SUPPORT_WEBSITE])
    return result
示例#5
0
文件: conftest.py 项目: scjtqs/BGmi
def _clean_bgmi():
    recreate_source_relatively_table()
    yield
    recreate_source_relatively_table()