From f4225f63bf5d70a00436f465d1ca90acd40c66da Mon Sep 17 00:00:00 2001 From: Silen Naihin Date: Tue, 1 Aug 2023 17:55:00 +0100 Subject: [PATCH] linter and handling errs --- .github/PULL_REQUEST_TEMPLATE.md | 3 +-- agbenchmark/reports/processing/gen_combined_chart.py | 2 -- agbenchmark/reports/processing/process_report.py | 8 +++++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 22e4f1b5..5144742f 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -13,6 +13,5 @@ black . --exclude test.py isort . mypy . - autoflake --remove-all-unused-imports --recursive --ignore-init-module-imports --ignore-pass-after-docstring agbenchmark" -agbenchmark/start_benchmark.py + autoflake --remove-all-unused-imports --recursive --ignore-init-module-imports --ignore-pass-after-docstring --in-place agbenchmark ``` diff --git a/agbenchmark/reports/processing/gen_combined_chart.py b/agbenchmark/reports/processing/gen_combined_chart.py index 0cc96d91..784e8ff9 100644 --- a/agbenchmark/reports/processing/gen_combined_chart.py +++ b/agbenchmark/reports/processing/gen_combined_chart.py @@ -21,8 +21,6 @@ def generate_combined_chart() -> None: categories = all_agent_categories(reports_data) - print("Agent categories:", categories) - # Count the number of directories in this directory num_dirs = len([f for f in combined_charts_folder.iterdir() if f.is_dir()]) diff --git a/agbenchmark/reports/processing/process_report.py b/agbenchmark/reports/processing/process_report.py index ac8729af..72b5a5c4 100644 --- a/agbenchmark/reports/processing/process_report.py +++ b/agbenchmark/reports/processing/process_report.py @@ -1,7 +1,7 @@ import json import os from pathlib import Path -from typing import Any, Optional +from typing import Any from agbenchmark.reports.processing.get_files import ( get_latest_report_from_agent_directories, @@ -41,7 +41,7 @@ def get_agent_category(report: Report) -> dict[str, Any]: categories.setdefault(category, 0) if data.metrics.success: num_dif = STRING_DIFFICULTY_MAP[data.metrics.difficulty] - if num_dif > categories.setdefault(category, 0): + if num_dif > categories[category]: categories[category] = num_dif for _, test_data in report.tests.items(): @@ -59,6 +59,8 @@ def all_agent_categories(reports_data: dict[str, Any]) -> dict[str, Any]: for name, report in reports_data.items(): categories = get_agent_category(report) - all_categories[name] = categories + if categories: # only add to all_categories if categories is not empty + print(f"Adding {name}: {categories}") + all_categories[name] = categories return all_categories