Skip to content

Commit

Permalink
write_traffic_situation_to_file.py: exclude fields the value of which…
Browse files Browse the repository at this point in the history
… is either None or the default value.
  • Loading branch information
ClaasRostock committed Nov 25, 2023
1 parent db91fb5 commit edd9e7c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/trafficgen/write_traffic_situation_to_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ def write_traffic_situations_to_json_file(situations: List[Situation], write_fol
for i, situation in enumerate(situations):
file_number: int = i + 1
output_file_path: Path = write_folder / f"traffic_situation_{file_number:02d}.json"
data: str = situation.model_dump_json(indent=4)
data: str = situation.model_dump_json(
indent=4,
exclude_defaults=True,
exclude_none=True,
)
with open(output_file_path, "w", encoding="utf-8") as outfile:
outfile.write(data)

0 comments on commit edd9e7c

Please sign in to comment.