File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,7 +13,11 @@ def enumerate_toml_files():
1313 found_files = []
1414 all_files = os .listdir (SETTINGS_FOLDER )
1515 for current_file in all_files :
16- if current_file [:2 ] != "._" and current_file [- 5 :] == ".toml" and current_file != "settings.toml" :
16+ if (
17+ current_file [:2 ] != "._"
18+ and current_file [- 5 :] == ".toml"
19+ and current_file != "settings.toml"
20+ ):
1721 found_files .append (SETTINGS_FOLDER + current_file )
1822 return found_files
1923
@@ -42,11 +46,11 @@ def get_current_toml_file(enumerated_files):
4246def change_toml_file (toml_file ):
4347 try :
4448 storage .remount ("/" , False )
45- open ("settings.toml" , "w" ).close ()
49+ with open ("settings.toml" , "w" ) as settings :
50+ settings .write ("" )
4651 with open ("settings.toml" , "w" ) as settings , open (toml_file ) as f :
4752 for line in f .readlines ():
4853 settings .write (line )
49- settings .close ()
5054 print ("Done. Hard resetting board..." )
5155 microcontroller .reset ()
5256 except RuntimeError :
@@ -60,6 +64,7 @@ def pretty_name(toml_file):
6064 name = name [0 ].upper () + name [1 :]
6165 return f"{ name } toml file"
6266
67+
6368toml_files = enumerate_toml_files ()
6469
6570if len (toml_files ) < 2 :
You can’t perform that action at this time.
0 commit comments