Skip to content

refactor: demote EvaluatorFormatHelper to functions in evaluator_output.py - #196

Closed
andreyholovko wants to merge 2 commits into
awslabs:devfrom
andreyholovko:refactor/rename-evaluator-format-helper
Closed

andreyholovko wants to merge 2 commits into
awslabs:devfrom
andreyholovko:refactor/rename-evaluator-format-helper

Conversation

@andreyholovko

Copy link
Copy Markdown
Contributor

Summary

Contributes to #134 (item from the helper-consolidation treatment table:
evaluator_format_helper - "earn the seam, rename" - "owns evaluator-
output formatting logic, the name is generic"). 5 of 13 items remain
(field_helper.py deferred separately due to a conflicting open PR #183,
not counted as done here); not closing the issue.

The issue doesn't give an explicit target filename for this one (unlike
hungarian_matching.py or scoring_formulas.py); picked
evaluator_output.py since that's what the module actually produces.

  • EvaluatorFormatHelper was already 100% @staticmethod, calling itself
    via class-qualified names. Converted all 3 methods
    (format_for_evaluator, calculate_list_item_metrics, and the internal
    _flatten_confusion_matrix_for_evaluator, kept underscore-prefixed
    since it's only called from format_for_evaluator itself) to
    module-level functions.
  • Only one caller file, structured_model.py (2 call sites, both thin
    delegating shims) - checked for the same kind of naming collision that
    came up in the rich_value_helper PR; none here.
  • Left the internal HungarianHelper/MetricsHelper imports and
    instantiations inside this file untouched - those belong to the
    currently-separate, still-open refactor: rename MetricsHelper to scoring_formulas.py (earn the seam) #193/refactor: rename HungarianHelper to HungarianMatching (earn the seam) #194 PRs in this series; touching
    them here would create unnecessary merge friction between independent
    PRs.

Testing

No behavior change: full suite passes unchanged, 1541 passed, 2
pre-existing unrelated skips. No new tests - pure rename/demotion, no new
formula or invariant to pin. ruff check clean on all touched files.

Updates the three usual docs plus two more references found in
structured_model_REFACTORING.md (a component-tree entry, a component
list, and a legacy-method mapping table - three separate mentions in that
one file).

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your choice.

…ut.py

Per issue #134's helper-consolidation plan (item: evaluator_format_helper -
"earn the seam, rename" - "owns evaluator-output formatting logic, the
name is generic"). The issue doesn't give an explicit target filename for
this one (unlike hungarian_matching.py or scoring_formulas.py); picked
evaluator_output.py since that's what the module actually produces.

EvaluatorFormatHelper was already 100% @staticmethod, calling itself via
class-qualified names (EvaluatorFormatHelper.method(...)). Converted all 3
methods (format_for_evaluator, calculate_list_item_metrics, and the
internal _flatten_confusion_matrix_for_evaluator, kept underscore-prefixed
since it's only called from format_for_evaluator itself) to module-level
functions. Only one caller file, structured_model.py (2 call sites, both
thin delegating shims) - checked for the same kind of naming collision
that bit the rich_value_helper PR, none here.

Left the internal HungarianHelper/MetricsHelper imports and instantiations
inside this file untouched - those belong to the (currently separate,
still-open) #193/#194 PRs in this series; touching them here would create
unnecessary merge friction between independent PRs.

No behavior change: full suite passes unchanged, 1541/1541, 2 pre-existing
unrelated skips. No new tests - pure rename/demotion, no new formula or
invariant to pin.

Updates the three usual docs plus two more references
(structured_model_REFACTORING.md had 3 separate mentions: a component-tree
entry, a component list, and a legacy-method mapping table).

Contributes to #134 (8 of 13 helpers; 5 remain, plus field_helper.py
deferred due to a conflicting open PR #183).
@andreyholovko
andreyholovko requested a review from sromoam as a code owner July 31, 2026 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant