How should we annotate functions that forward to their superclass?
オープン
まだ誰も着手していません。
topic: feature
- 主要言語
- Python
- スター
- 1.8k
- フォーク
- 302
- 平均マージ
- 23時間
- マージ済み PR(30日)
- 8
説明
Consider this real code:
from typing import SuperKwargs
class InferenceManager(Generic[T]):
@override
def __init__(self,
*,
default_trajectory: T,
progress_manager: None | ProgressManager,
wandb_run: None | Run
) -> None:
super().__init__()
self._progress_manager = progress_manager
self._results: list[T] = []
self._trajectory = default_trajectory
self._wandb_run = wandb_run
class TrainingInferenceManager(InferenceManager[RLTrainingResult]):
def __init__(self, training_result: TrainingResult, **kwargs: SuperKwargs):
self.training_result = training_result
super().__init__(**kwargs)
If we want full annotations for TrainingInferenceManager.__init__, we currently need to duplicate all of the superclass's parameters. I suggest adding typing.SuperKwargs that stands in place of them.
(This could be made more complicated by allowing the child class to synthesize some of the parameters.)
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
実装ファイル、テスト、エントリーポイントは指定されていません。まず、提案されている SuperKwargs の動作と関連する mypy issue #8769 を読みます。実装の範囲を定める前に、この issue では転送されるパラメーターと合成されるパラメーターについて合意された設計が必要です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- tooling
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 25/100