2 different `Dialect` types - one in `csv` module and other in `_csv` module
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 5.1k
- フォーク
- 2.1k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 82
説明
Consider this code:
from csv import get_dialect
def foo(s: str):
dialect = get_dialect(s)
reveal_type(dialect)
mypy reports
dialects.py:6: note: Revealed type is "_csv.Dialect"
One would expect the result would be csv.Dialect.
There are 2 classes called Dialect in typeshed:
https://github.com/python/typeshed/blob/2480d7e7c74493a024eaf254c5d2c6f452c80ee2/stdlib/_csv.pyi#L28
and
https://github.com/python/typeshed/blob/2480d7e7c74493a024eaf254c5d2c6f452c80ee2/stdlib/csv.pyi#L61
get_dialect() is imported in csv.pyi from _csv.pyi, so the declaration in _csv.pyi is returning _csv.Dialect instead of csv.Dialect, so the type checkers see that as 2 separate classes.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず stdlib/_csv.pyi と stdlib/csv.pyi を比較し、インポートされた get_dialect 宣言と 2 つの Dialect クラスに注目してください。再現用の mypy スニペットを実行し、reveal_type が _csv.Dialect ではなく csv.Dialect を報告することを確認してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 52/100