File tree Expand file tree Collapse file tree 1 file changed +3
-11
lines changed
Expand file tree Collapse file tree 1 file changed +3
-11
lines changed Original file line number Diff line number Diff line change @@ -187,19 +187,11 @@ def update_import_file_mapping(
187187 # Create new entry
188188 import_mapping [notebook_name ] = files
189189
190- # Write back to file in original one-line-per-entry format
190+ # Write back to file with standard JSON formatting
191191 mapping_file = misc_dir / "import_file_mapping.json"
192192 with open (mapping_file , "w" , encoding = "utf-8" ) as f :
193- f .write ("{\n " )
194- items = list (import_mapping .items ())
195- for i , (notebook_name , files ) in enumerate (items ):
196- # Format: "notebook.ipynb": [ "file1.ext", "file2.ext"]
197- files_str = ", " .join (f' "{ file } "' for file in files )
198- line = f' "{ notebook_name } ": [{ files_str } ]'
199- if i < len (items ) - 1 :
200- line += ","
201- f .write (line + "\n " )
202- f .write ("}\n " )
193+ json .dump (import_mapping , f , indent = 4 )
194+ f .write ("\n " )
203195
204196 print (f"\n Updated { mapping_file } " )
205197 print (f"Added mappings for { len (missing_mappings )} notebook(s)" )
You can’t perform that action at this time.
0 commit comments