File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,11 @@ def enumerate_toml_files():
13
13
found_files = []
14
14
all_files = os .listdir (SETTINGS_FOLDER )
15
15
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
+ ):
17
21
found_files .append (SETTINGS_FOLDER + current_file )
18
22
return found_files
19
23
@@ -42,11 +46,11 @@ def get_current_toml_file(enumerated_files):
42
46
def change_toml_file (toml_file ):
43
47
try :
44
48
storage .remount ("/" , False )
45
- open ("settings.toml" , "w" ).close ()
49
+ with open ("settings.toml" , "w" ) as settings :
50
+ settings .write ("" )
46
51
with open ("settings.toml" , "w" ) as settings , open (toml_file ) as f :
47
52
for line in f .readlines ():
48
53
settings .write (line )
49
- settings .close ()
50
54
print ("Done. Hard resetting board..." )
51
55
microcontroller .reset ()
52
56
except RuntimeError :
@@ -60,6 +64,7 @@ def pretty_name(toml_file):
60
64
name = name [0 ].upper () + name [1 :]
61
65
return f"{ name } toml file"
62
66
67
+
63
68
toml_files = enumerate_toml_files ()
64
69
65
70
if len (toml_files ) < 2 :
You can’t perform that action at this time.
0 commit comments