argparse type=bool
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 5.1k
- フォーク
- 2.1k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 82
説明
When adding an argument with argparse.ArgumentParser.add_argument, it is tempting to pass type=bool to create an option that is specified without a value, such as --enable-foo. This doesn't work, and in fact creates a subtle bug: --enable-foo silently swallows the next argument, so a command like python3 program.py --enable-foo x y z will work but only leave y and z to be used as other arguments. https://stackoverflow.com/a/15008806
To prevent this, I think the best we can do is to add an overload that returns NoReturn when you pass in type=bool.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
argparse.ArgumentParser.add_argument の typeshed スタブから始めて、既存の overload を確認します。type=bool が次の引数を取り込んでしまうことについてのリンク先の説明を確認し、そのうえで、要求された NoReturn overload をスタブにどのように適合させるべきかを判断し、関連する typing チェックを追加または更新します。type=bool が有効な引数宣言に影響を与えることなくスタブによって拒否されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100