Skip to content

Commit

Permalink
chore: delete json conversion (#457)
Browse files Browse the repository at this point in the history
  • Loading branch information
hayato-m126 authored May 24, 2024
1 parent ba651df commit 7c04a66
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 31 deletions.
15 changes: 0 additions & 15 deletions driving_log_replayer_cli/core/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,3 @@ def display_all(output_directory: Path) -> None:
for result_path in result_paths:
print(f"scenario: {result_path.parent.name}") # noqa
display(result_path)


def convert_to_json(result_path: Path) -> None:
output_file_path = result_path.parent.joinpath("result.json")
if output_file_path.exists():
return
result_list = load_result(result_path)
with output_file_path.open("w") as out_file:
json.dump(result_list, out_file)


def convert_all(output_directory: Path) -> None:
result_paths = output_directory.glob("**/result.jsonl")
for result_path in result_paths:
convert_to_json(result_path)
11 changes: 0 additions & 11 deletions driving_log_replayer_cli/simulation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from driving_log_replayer_cli.core.config import Config
from driving_log_replayer_cli.core.config import load_config
from driving_log_replayer_cli.core.result import convert_all
from driving_log_replayer_cli.core.result import display_all
from driving_log_replayer_cli.simulation.run import dry_run as sim_dry_run
from driving_log_replayer_cli.simulation.run import run as sim_run
Expand Down Expand Up @@ -73,16 +72,6 @@ def show_result(output_directory: Path) -> None:
display_all(output_directory)


@simulation.command(context_settings=CONTEXT_SETTINGS)
@click.argument(
"output_directory",
type=click.Path(exists=True, file_okay=False, resolve_path=True, path_type=Path),
)
def convert_result(output_directory: Path) -> None:
"""Convert result.jsonl to result.json in output_directory."""
convert_all(output_directory)


@simulation.command(context_settings=CONTEXT_SETTINGS)
@click.option(
"--scenario",
Expand Down
7 changes: 2 additions & 5 deletions driving_log_replayer_cli/simulation/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import termcolor

from driving_log_replayer_cli.core.config import Config
from driving_log_replayer_cli.core.result import convert_all
from driving_log_replayer_cli.core.result import display_all
from driving_log_replayer_cli.core.scenario import Datasets
from driving_log_replayer_cli.core.scenario import get_dry_run_scenario_path
Expand Down Expand Up @@ -93,8 +92,7 @@ def run(
update_method,
)

# convert result file and display result
convert_all(output_dir_by_time)
# display result
display_all(output_dir_by_time)


Expand Down Expand Up @@ -141,8 +139,7 @@ def dry_run(
run_with_log(cmd, output_case.joinpath("console.log"))
except KeyboardInterrupt:
termcolor.cprint("Simulation execution canceled by Ctrl+C", "red")
# convert result file and display result
convert_all(output_dir_by_time)
# display result
display_all(output_dir_by_time)


Expand Down

0 comments on commit 7c04a66

Please sign in to comment.