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
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
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
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
def _clean_bgmi(): recreate_source_relatively_table() yield recreate_source_relatively_table()