Skip to content

Commit

Permalink
#150 Guarantee that the output file has mention of the .json once
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolay-r committed Jul 31, 2024
1 parent 9f869c8 commit e27bb92
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions arelight/backend/d3js/utils_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ def save_graph(graph, out_dir, out_filename, convert_to_radial=True):
if not exists(out_dir):
makedirs(out_dir)

data_filepath = join(out_dir, "{}.json".format(out_filename))
# Make sure that we have no extention related to the expected format.
no_ext_basename = out_filename.replace(".json", "")
target_filepath = join(out_dir, f"{no_ext_basename}.json")
# Convert to radial graph.
radial_graph = graph_to_radial(graph) if convert_to_radial else graph
save_json(data=radial_graph, file_path=data_filepath)
save_json(data=radial_graph, file_path=target_filepath)

0 comments on commit e27bb92

Please sign in to comment.