`str-format` for fill and align specifiers
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- PR マージ指標
- PR 指標を取得中
説明
Feature
The fill and align string format specifiers do not currently have type checking, but are not supported by all types. Specifically, None does not support them.
Pitch
I ran into a bug where an optional type was being passed to string formatting using <. This would succeed most of the time, but error if the value was None:
>>> "{:<2}".format(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported format string passed to NoneType.__format__
It would be great if mypy would catch this code as a type violation.
I attempted to implement here: https://github.com/python/mypy/pull/18799 but this was more challenging than I anticipated and I am a first time contributor.
Thanks.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず PR #18799 で試みられた実装をレビューし、次に、fill および align 指定子に対する format-specifier の型チェックを mypy がどのように処理しているかを追跡します。完了条件は、None のようなオプショナル値がサポートされていない fill または align 指定子でフォーマットされたときに、mypy がエラーを報告することです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- devtools
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100