Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[eval] DRY: drop repeated "winml.modelkit.eval." prefix in _EVALUATOR_REGISTRY

オープン 初心者向け
#808 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
84/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
python

調査の方向性

eval/evaluate.py の _EVALUATOR_REGISTRY と get_evaluator_class から始め、続いて tests/unit/eval/test_eval.py::test_registered_task_returns_class を読みます。繰り返されている package prefix なしで registry のエントリを保存し、import 時に単一の prefix を追加し、module path の assertion を更新して、動作が変わっていないことを確認するために対象の test を実行します。

索引モデルが issue の本文から書いたものです。

説明

P2 refactor triaged

Component: eval
Type: cleanup / quality

Context

eval/evaluate.py::_EVALUATOR_REGISTRY maps task -> "module_path:ClassName", e.g.:

"image-feature-extraction":
    "winml.modelkit.eval.image_feature_extraction_evaluator:WinMLImageFeatureExtractionEvaluator",

The winml.modelkit.eval. prefix is repeated for all 15 entries. Because the full single-line entries exceed the 100-char limit, the dict is currently wrapped in # fmt: off / # fmt: on to preserve the readable key/value-per-line layout (otherwise ruff-format collapses each entry onto one >100-char line, which trips E501). Introduced/surfaced in #807.

Proposed cleanup

  • Store the relative "<module>:<ClassName>" (drop the repeated package prefix).
  • Prepend winml.modelkit.eval. once in get_evaluator_class: importlib.import_module(f"winml.modelkit.eval.{module_path}").
  • Most entries then fit on a single line naturally; only the 3 longest (image-feature-extraction, zero-shot-classification, zero-shot-image-classification) still need # noqa: E501.
  • This removes the # fmt: off / # fmt: on block.

Note

tests/unit/eval/test_eval.py::test_registered_task_returns_class asserts cls.__module__ == module_path; update it to compare against the full prefixed path.

Out of scope

Behavior is unchanged — purely a storage-format/readability cleanup.

主要言語
Python
スター
40
フォーク
11
平均マージ
19時間 32分
マージ済み PR(30日)
51

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/winml-cli のほかの issue

microsoft/winml-cli の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。