-
Notifications
You must be signed in to change notification settings - Fork 0
/
underscore_to_camelcase.py
18 lines (15 loc) · 1.55 KB
/
underscore_to_camelcase.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
s='AR_ID BIGINT,AVG_DOWN_SIGNL_NOISE DECIMAL(10,4),AVG_UPSTR_SIGNL_NOISE DECIMAL(10,4),BLG_STN_ID INTEGER,CB_SUB_CNT INTEGER,CBL_SUB_CNT DECIMAL(10,0),CBL_TC_7DAY_CNT DECIMAL(10,0),CMTS_NAME VARCHAR(64) CHARACTER SET LATIN NOT CASESPECIFIC,CMTS_NM VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC,CNSC_RPTED_DAYS_CNT INTEGER,CNT_T3_TMOUT_MODEM DECIMAL(10,4),DIFF_DOWN_SIGNL_NOISE DECIMAL(10,4),DIFF_RXRF_LVL DECIMAL(10,4),DIFF_TXRF_LVL DECIMAL(10,4),DIFF_UPST_SIGNL_NOISE DECIMAL(10,4),FIBR_NODE CHAR(10) CHARACTER SET LATIN NOT CASESPECIFIC,INET_SUB_CNT DECIMAL(10,0),INET_TC_7DAY_CNT DECIMAL(10,0),LP_SRO_CNT DECIMAL(10,0),PCT_COR_DOWN_FEC_ERR DECIMAL(10,4),PCT_COR_UPST_FEC_ERR DECIMAL(10,4),PCT_DVC_CHK_OUT_SPEC DECIMAL(10,4),PCT_UNCOR_DOWN_FEC_ERR DECIMAL(10,4),PCT_UNCOR_UPST_FEC_ERR DECIMAL(10,4),PHN_SUB_CNT DECIMAL(10,0),PHN_TC_7DAY_CNT DECIMAL(10,0),REP_DT TIMESTAMP(0),RGU_CNT DECIMAL(10,0),SCORE DECIMAL(15,1),SIGNL_NOISE_DOWN_CNT DECIMAL(10,4),SUB_CNT DECIMAL(10,0),TC_7DAY_CNT DECIMAL(10,0),TC_PEND_CNT INTEGER,TC_REPT_CNT DECIMAL(10,0),TOT_DVC_CNT DECIMAL(10,4),TOT_DVC_OUT_SPEC DECIMAL(10,4),UPST_CHNL_FREQ_VAR DECIMAL(10,4),UPST_EQ_COEFF_VAR DECIMAL(10,4),UPST_RIP_VAR DECIMAL(10,4)'
def underscore_to_camelcase(value):
output = ""
first_word_passed = False
for word in value.split("_"):
if not word:
output += "_"
continue
if first_word_passed:
output += word.capitalize()
else:
output += word.lower()
first_word_passed = True
return output
underscore_to_camelcase(s)