Consistently mark types with `| MaybeNone` whenever it is applicable
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 5.1k
- フォーク
- 2.1k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 82
説明
I noticed that there's a special type alias MaybeNone that represents this specific intent:
We didn't dare to change the type to
X | Noneso instead we changed it toAny
You can find an example in a relatively recent addition of this.
And while this approach makes me very sad, it is good that such cases are marked with MaybeNone, for the purpose of looking at them specially. Maybe some type checker will arise that will have specific handling for it and do something smarter instead.
With that in mind, it would be good to ensure that all such cases are consistently marked.
I noticed at least one case that is not marked like this. It has | Any directly written instead of | MaybeNone. This is in re.match.group*:
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
stdlib/re.pyi から始め、特に 93–117 行付近の re.match.group* 定義を確認し、stdlib/_typeshed/init.pyi の MaybeNone エイリアスと比較してください。これと同じ意図が Any で表現されている stubs 内の類似ケースを確認してください。該当するケースが一貫して代わりに MaybeNone を使用し、マークされていない例外が見つからなければ完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- tooling
- issue の種類
- リファクタリング
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100