False positive with attrs converter
オープン
まだ誰も着手していません。
bug
topic-attrs
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- PR マージ指標
- PR 指標を取得中
説明
Looks like mypy can't infer generic parameter properly when used in attrs converter.
from attr import attrs, attrib
from typing import FrozenSet, Text
@attrs
class Test(object):
values = attrib(type=FrozenSet[Text], converter=frozenset)
Test(values={'a'})
Actual: reporting error
error: Argument 1 to <set> has incompatible type "str"; expected "_T"
Expected: no errors.
mypy version 0.770, python 3.5.2, no flags are used.
Latest master has basically the same error message except generic param has a different name:
error: Argument 1 to <set> has incompatible type "str"; expected "_T_co"
Possibly related: https://github.com/python/mypy/issues/5313
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、報告された mypy のバージョンまたは最新の master で、提供された Python 再現コードを実行し、attrs converter とジェネリックパラメーターの推論に焦点を当てます。例が型チェックエラーを出さず、宣言された FrozenSet[Text] 型を維持すれば、作業は完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100