diva: add list decoders

This commit is contained in:
Hay1tsme 2023-11-26 19:24:36 -05:00
parent 024bc352d7
commit d2d02f9483
2 changed files with 70 additions and 63 deletions

View File

@ -241,3 +241,9 @@ def encode_list(key: str, val: Union[List[Any], None], urlencode_final_val: boo
all_vals = quote(all_vals) all_vals = quote(all_vals)
return f"{key}={all_vals}" return f"{key}={all_vals}"
def decode_list_int(val: str) -> List[int]:
return [int(x) for x in val.split(",")]
def decode_list(val: str) -> List[str]:
return [x for x in val.split(",")]

View File

@ -3,6 +3,7 @@ from titles.diva.handlers.base import (
BaseRequest, BaseRequest,
BaseResponse, BaseResponse,
DivaRequestParseException, DivaRequestParseException,
decode_list_int
) )
from datetime import datetime from datetime import datetime
from urllib import parse from urllib import parse
@ -58,69 +59,69 @@ class StageResultRequest(BaseRequest):
self.cr_tv = int(self.cr_tv) self.cr_tv = int(self.cr_tv)
self.cr_if = int(self.cr_if) self.cr_if = int(self.cr_if)
self.my_qst_id: List[int] = [int(x) for x in self.my_qst_id.split(",")] self.my_qst_id: List[int] = decode_list_int(self.my_qst_id)
self.my_qst_sts: List[int] = [int(x) for x in self.my_qst_sts.split(",")] self.my_qst_sts: List[int] = decode_list_int(self.my_qst_sts)
self.stg_difficulty: List[int] = [int(x) for x in self.stg_difficulty.split(",")] self.stg_difficulty: List[int] = decode_list_int(self.stg_difficulty)
self.stg_edtn: List[int] = [int(x) for x in self.stg_edtn.split(",")] self.stg_edtn: List[int] = decode_list_int(self.stg_edtn)
self.stg_ply_pv_id: List[int] = [int(x) for x in self.stg_ply_pv_id.split(",")] self.stg_ply_pv_id: List[int] = decode_list_int(self.stg_ply_pv_id)
self.stg_sel_pv_id: List[int] = [int(x) for x in self.stg_sel_pv_id.split(",")] self.stg_sel_pv_id: List[int] = decode_list_int(self.stg_sel_pv_id)
self.stg_scrpt_ver: List[int] = [int(x) for x in self.stg_scrpt_ver.split(",")] self.stg_scrpt_ver: List[int] = decode_list_int(self.stg_scrpt_ver)
self.stg_score: List[int] = [int(x) for x in self.stg_score.split(",")] self.stg_score: List[int] = decode_list_int(self.stg_score)
self.stg_chllng_kind: List[int] = [int(x) for x in self.stg_chllng_kind.split(",")] self.stg_chllng_kind: List[int] = decode_list_int(self.stg_chllng_kind)
self.stg_chllng_result: List[int] = [int(x) for x in self.stg_chllng_result.split(",")] self.stg_chllng_result: List[int] = decode_list_int(self.stg_chllng_result)
self.stg_clr_kind: List[int] = [int(x) for x in self.stg_clr_kind.split(",")] self.stg_clr_kind: List[int] = decode_list_int(self.stg_clr_kind)
self.stg_vcld_pts: List[int] = [int(x) for x in self.stg_vcld_pts.split(",")] self.stg_vcld_pts: List[int] = decode_list_int(self.stg_vcld_pts)
self.stg_cool_cnt: List[int] = [int(x) for x in self.stg_cool_cnt.split(",")] self.stg_cool_cnt: List[int] = decode_list_int(self.stg_cool_cnt)
self.stg_cool_pct: List[int] = [int(x) for x in self.stg_cool_pct.split(",")] self.stg_cool_pct: List[int] = decode_list_int(self.stg_cool_pct)
self.stg_fine_cnt: List[int] = [int(x) for x in self.stg_fine_cnt.split(",")] self.stg_fine_cnt: List[int] = decode_list_int(self.stg_fine_cnt)
self.stg_fine_pct: List[int] = [int(x) for x in self.stg_fine_pct.split(",")] self.stg_fine_pct: List[int] = decode_list_int(self.stg_fine_pct)
self.stg_safe_cnt: List[int] = [int(x) for x in self.stg_safe_cnt.split(",")] self.stg_safe_cnt: List[int] = decode_list_int(self.stg_safe_cnt)
self.stg_safe_pct: List[int] = [int(x) for x in self.stg_safe_pct.split(",")] self.stg_safe_pct: List[int] = decode_list_int(self.stg_safe_pct)
self.stg_sad_cnt: List[int] = [int(x) for x in self.stg_sad_cnt.split(",")] self.stg_sad_cnt: List[int] = decode_list_int(self.stg_sad_cnt)
self.stg_sad_pct: List[int] = [int(x) for x in self.stg_sad_pct.split(",")] self.stg_sad_pct: List[int] = decode_list_int(self.stg_sad_pct)
self.stg_wt_wg_cnt: List[int] = [int(x) for x in self.stg_wt_wg_cnt.split(",")] self.stg_wt_wg_cnt: List[int] = decode_list_int(self.stg_wt_wg_cnt)
self.stg_wt_wg_pct: List[int] = [int(x) for x in self.stg_wt_wg_pct.split(",")] self.stg_wt_wg_pct: List[int] = decode_list_int(self.stg_wt_wg_pct)
self.stg_max_cmb: List[int] = [int(x) for x in self.stg_max_cmb.split(",")] self.stg_max_cmb: List[int] = decode_list_int(self.stg_max_cmb)
self.stg_chance_tm: List[int] = [int(x) for x in self.stg_chance_tm.split(",")] self.stg_chance_tm: List[int] = decode_list_int(self.stg_chance_tm)
self.stg_sm_hl: List[int] = [int(x) for x in self.stg_sm_hl.split(",")] self.stg_sm_hl: List[int] = decode_list_int(self.stg_sm_hl)
self.stg_atn_pnt: List[int] = [int(x) for x in self.stg_atn_pnt.split(",")] self.stg_atn_pnt: List[int] = decode_list_int(self.stg_atn_pnt)
self.stg_skin_id: List[int] = [int(x) for x in self.stg_skin_id.split(",")] self.stg_skin_id: List[int] = decode_list_int(self.stg_skin_id)
self.stg_btn_se: List[int] = [int(x) for x in self.stg_btn_se.split(",")] self.stg_btn_se: List[int] = decode_list_int(self.stg_btn_se)
self.stg_btn_se_vol: List[int] = [int(x) for x in self.stg_btn_se_vol.split(",")] self.stg_btn_se_vol: List[int] = decode_list_int(self.stg_btn_se_vol)
self.stg_sld_se: List[int] = [int(x) for x in self.stg_sld_se.split(",")] self.stg_sld_se: List[int] = decode_list_int(self.stg_sld_se)
self.stg_chn_sld_se: List[int] = [int(x) for x in self.stg_chn_sld_se.split(",")] self.stg_chn_sld_se: List[int] = decode_list_int(self.stg_chn_sld_se)
self.stg_sldr_tch_se: List[int] = [int(x) for x in self.stg_sldr_tch_se.split(",")] self.stg_sldr_tch_se: List[int] = decode_list_int(self.stg_sldr_tch_se)
self.stg_mdl_id: List[int] = [int(x) for x in self.stg_mdl_id.split(",")] self.stg_mdl_id: List[int] = decode_list_int(self.stg_mdl_id)
self.stg_sel_mdl_id: List[int] = [int(x) for x in self.stg_sel_mdl_id.split(",")] self.stg_sel_mdl_id: List[int] = decode_list_int(self.stg_sel_mdl_id)
self.stg_rvl_pd_id: List[int] = [int(x) for x in self.stg_rvl_pd_id.split(",")] self.stg_rvl_pd_id: List[int] = decode_list_int(self.stg_rvl_pd_id)
self.stg_rvl_wl: List[int] = [int(x) for x in self.stg_rvl_wl.split(",")] self.stg_rvl_wl: List[int] = decode_list_int(self.stg_rvl_wl)
self.stg_cpt_rslt: List[int] = [int(x) for x in self.stg_cpt_rslt.split(",")] self.stg_cpt_rslt: List[int] = decode_list_int(self.stg_cpt_rslt)
self.stg_sld_scr: List[int] = [int(x) for x in self.stg_sld_scr.split(",")] self.stg_sld_scr: List[int] = decode_list_int(self.stg_sld_scr)
self.stg_is_sr_gm: List[int] = [int(x) for x in self.stg_is_sr_gm.split(",")] self.stg_is_sr_gm: List[int] = decode_list_int(self.stg_is_sr_gm)
self.stg_pv_brnch_rslt: List[int] = [int(x) for x in self.stg_pv_brnch_rslt.split(",")] self.stg_pv_brnch_rslt: List[int] = decode_list_int(self.stg_pv_brnch_rslt)
self.stg_vcl_chg: List[int] = [int(x) for x in self.stg_vcl_chg.split(",")] self.stg_vcl_chg: List[int] = decode_list_int(self.stg_vcl_chg)
self.stg_c_itm_id: List[int] = [int(x) for x in self.stg_c_itm_id.split(",")] self.stg_c_itm_id: List[int] = decode_list_int(self.stg_c_itm_id)
self.stg_ms_itm_flg: List[int] = [int(x) for x in self.stg_ms_itm_flg.split(",")] self.stg_ms_itm_flg: List[int] = decode_list_int(self.stg_ms_itm_flg)
self.stg_rgo: List[int] = [int(x) for x in self.stg_rgo.split(",")] self.stg_rgo: List[int] = decode_list_int(self.stg_rgo)
self.stg_ss_num: List[int] = [int(x) for x in self.stg_ss_num.split(",")] self.stg_ss_num: List[int] = decode_list_int(self.stg_ss_num)
self.stg_is_cs_scs: List[int] = [int(x) for x in self.stg_is_cs_scs.split(",")] self.stg_is_cs_scs: List[int] = decode_list_int(self.stg_is_cs_scs)
self.stg_is_nppg_use: List[int] = [int(x) for x in self.stg_is_nppg_use.split(",")] self.stg_is_nppg_use: List[int] = decode_list_int(self.stg_is_nppg_use)
self.stg_p_std_lo_id: List[int] = [int(x) for x in self.stg_p_std_lo_id.split(",")] self.stg_p_std_lo_id: List[int] = decode_list_int(self.stg_p_std_lo_id)
self.stg_p_std_is_to: List[int] = [int(x) for x in self.stg_p_std_is_to.split(",")] self.stg_p_std_is_to: List[int] = decode_list_int(self.stg_p_std_is_to)
self.stg_p_std_is_ccu: List[int] = [int(x) for x in self.stg_p_std_is_ccu.split(",")] self.stg_p_std_is_ccu: List[int] = decode_list_int(self.stg_p_std_is_ccu)
self.stg_p_std_is_tiu: List[int] = [int(x) for x in self.stg_p_std_is_tiu.split(",")] self.stg_p_std_is_tiu: List[int] = decode_list_int(self.stg_p_std_is_tiu)
self.stg_p_std_is_iu: List[int] = [int(x) for x in self.stg_p_std_is_iu.split(",")] self.stg_p_std_is_iu: List[int] = decode_list_int(self.stg_p_std_is_iu)
self.stg_p_std_is_npu: List[int] = [int(x) for x in self.stg_p_std_is_npu.split(",")] self.stg_p_std_is_npu: List[int] = decode_list_int(self.stg_p_std_is_npu)
self.stg_p_std_is_du: List[int] = [int(x) for x in self.stg_p_std_is_du.split(",")] self.stg_p_std_is_du: List[int] = decode_list_int(self.stg_p_std_is_du)
self.gu_cmd: List[int] = [int(x) for x in self.gu_cmd.split(",")] self.gu_cmd: List[int] = decode_list_int(self.gu_cmd)
self.mdl_eqp_cmn_ary: List[int] = [int(x) for x in self.mdl_eqp_cmn_ary.split(",")] self.mdl_eqp_cmn_ary: List[int] = decode_list_int(self.mdl_eqp_cmn_ary)
self.c_itm_eqp_cmn_ary: List[int] = [int(x) for x in self.c_itm_eqp_cmn_ary.split(",")] self.c_itm_eqp_cmn_ary: List[int] = decode_list_int(self.c_itm_eqp_cmn_ary)
self.ms_itm_flg_cmn_ary: List[int] = [int(x) for x in self.ms_itm_flg_cmn_ary.split(",")] self.ms_itm_flg_cmn_ary: List[int] = decode_list_int(self.ms_itm_flg_cmn_ary)
self.mdl_eqp_pv_ary: List[int] = [int(x) for x in self.mdl_eqp_pv_ary.split(",")] self.mdl_eqp_pv_ary: List[int] = decode_list_int(self.mdl_eqp_pv_ary)
self.c_itm_eqp_pv_ary: List[int] = [int(x) for x in self.c_itm_eqp_pv_ary.split(",")] self.c_itm_eqp_pv_ary: List[int] = decode_list_int(self.c_itm_eqp_pv_ary)
self.ms_itm_flg_pv_ary: List[int] = [int(x) for x in self.ms_itm_flg_pv_ary.split(",")] self.ms_itm_flg_pv_ary: List[int] = decode_list_int(self.ms_itm_flg_pv_ary)
self.stg_mdl_s_sts: List[int] = [int(x) for x in self.stg_mdl_s_sts.split(",")] self.stg_mdl_s_sts: List[int] = decode_list_int(self.stg_mdl_s_sts)
self.cr_sp: List[int] = [int(x) for x in parse.unquote(self.cr_sp).split(",")] self.cr_sp: List[int] = decode_list_int(parse.unquote(self.cr_sp))
except AttributeError as e: except AttributeError as e:
raise DivaRequestParseException(f"StageResultRequest: {e}") raise DivaRequestParseException(f"StageResultRequest: {e}")