File tree 4 files changed +345
-298
lines changed 4 files changed +345
-298
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
class Colors :
2
+ YELLOW = "\033 [1;33m" # Bold yellow
2
3
GREEN = "\033 [1;32m" # Bold green
3
4
ORANGE = "\033 [1;33m" # Bold orange
4
5
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():
15
15
with open (CONFIG_FILE_PATH , "r" ) as config_file :
16
16
config_data = toml .load (config_file )
17
17
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