Skip to content

Commit e16bd60

Browse files
committed
✨ feat: formated the files after adding tests
1 parent 80c3c1e commit e16bd60

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

hackagent/attacks/evaluator/metrics.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ def group_by_goal(results: List[Dict[str, Any]]) -> Dict[str, List[Dict[str, Any
7777
return grouped
7878

7979

80-
81-
8280
def extract_judge_scores(results: List[Dict[str, Any]]) -> Dict[str, List[int]]:
8381
"""Extract attack judge scores (eval_jb, eval_hb, eval_nj) as 0/1 lists."""
8482
judge_columns = ["eval_jb", "eval_hb", "eval_nj"]
@@ -259,7 +257,9 @@ def calculate_per_judge_strictness(results: list[dict]) -> dict:
259257
strictness[j] = sum(votes) / len(votes) if votes else 0.0
260258

261259
# Calculate bias gap
262-
bias_gap = max(strictness[j] for j in present_judges) - min(strictness[j] for j in present_judges)
260+
bias_gap = max(strictness[j] for j in present_judges) - min(
261+
strictness[j] for j in present_judges
262+
)
263263
strictness["bias_gap"] = bias_gap
264264

265265
return strictness

tests/unit/attacks/test_metrics.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ def test_mixed_votes(self):
266266
self.assertAlmostEqual(strictness["eval_nj"], 2 / 3)
267267
self.assertAlmostEqual(strictness["bias_gap"], 0.0)
268268

269+
269270
class TestGenerateSummaryReport(unittest.TestCase):
270271
"""Test generate_summary_report function."""
271272

@@ -315,4 +316,4 @@ def test_report_structure(self):
315316

316317

317318
if __name__ == "__main__":
318-
unittest.main()
319+
unittest.main()

0 commit comments

Comments
 (0)