Skip to content

Commit

Permalink
fix: removed code block for appending mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
newgene committed Jun 15, 2023
1 parent 1c4e59d commit dbddf23
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions biothings/management/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,14 +435,17 @@ def clean_big_nums(k, v):
console.print(mapping_table)

if "mapping" in mode and mapping and output:
with open(output, "w+") as fp:
current_content = fp.read()
if current_content:
current_content = load_json(current_content)
else:
current_content = {}
current_content.update(mapping)
fp.write(to_json(current_content, indent=True, sort_keys=True))
# TODO: the following block is commented out because we don't need to append the mapping info to the existing. Delete this block if we verify it's not needed.
# with open(output, "w+") as fp:
# current_content = fp.read()
# if current_content:
# current_content = load_json(current_content)
# else:
# current_content = {}
# current_content.update(mapping)
# fp.write(to_json(current_content, indent=True, sort_keys=True))
with open(output, "w") as fp:
fp.write(to_json(mapping, indent=True, sort_keys=True))
rprint(f"[green]Successful writing the mapping info to the JSON file: [bold]{output}[/bold][/green]")


Expand Down

0 comments on commit dbddf23

Please sign in to comment.