Skip to content

Commit 03616b1

Browse files
committed
feat: check_misc_references.py json format update
1 parent 04be7f5 commit 03616b1

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

misc/check_misc_references.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff 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"\nUpdated {mapping_file}")
205197
print(f"Added mappings for {len(missing_mappings)} notebook(s)")

0 commit comments

Comments
 (0)