File tree Expand file tree Collapse file tree 4 files changed +345
-298
lines changed Expand file tree Collapse file tree 4 files changed +345
-298
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11class Colors :
2+ YELLOW = "\033 [1;33m" # Bold yellow
23 GREEN = "\033 [1;32m" # Bold green
34 ORANGE = "\033 [1;33m" # Bold orange
45 RED = "\033 [1;31m" # Bold red
Original file line number Diff line number Diff line change @@ -15,4 +15,23 @@ def load_credentials_from_config():
1515 with open (CONFIG_FILE_PATH , "r" ) as config_file :
1616 config_data = toml .load (config_file )
1717 return config_data .get ("LEETCODE_SESSION" ), config_data .get ("CSRF_TOKEN" )
18- return None , None
18+ return None , None
19+
20+
21+ def load_user_data_from_config ():
22+ if os .path .exists (CONFIG_FILE_PATH ):
23+ with open (CONFIG_FILE_PATH , "r" ) as config_file :
24+ config_data = toml .load (config_file )
25+ return config_data .get ("USER_LANG" , "" ).lower ()
26+ return None
27+
28+
29+ def save_user_data_to_config (user_lang ):
30+ config_data = {"USER_LANG" : user_lang }
31+ if os .path .exists (CONFIG_FILE_PATH ):
32+ with open (CONFIG_FILE_PATH , "r" ) as config_file :
33+ existing_config_data = toml .load (config_file )
34+ existing_config_data .update (config_data )
35+ config_data = existing_config_data
36+ with open (CONFIG_FILE_PATH , "w" ) as config_file :
37+ toml .dump (config_data , config_file )
You can’t perform that action at this time.
0 commit comments