Type hints and a function returning property
オープン
まだ誰も着手していません。
bug
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- 平均マージ
- 1日 18時間
- マージ済み PR(30日)
- 54
説明
Bug Report
I have a function that works correctly.
This function uses a string as an argument and return a property.
But when I add type hints that argument is a string and return is a property, mypy says:
main.py:4: error: "property" used with a non-method
main.py:14: error: Incompatible return value type (got overloaded function, expected "property")'
Found 2 errors in 1 file (checked 1 source file)
To Reproduce
A reproducible playground link
Expected Behavior
I expect that the function has to pass mypy test without errors.
Actual Behavior
main.py:4: error: "property" used with a non-method
main.py:14: error: Incompatible return value type (got overloaded function, expected "property")'
Found 2 errors in 1 file (checked 1 source file)
Your Environment
- Mypy version used: 0.981
- Mypy command-line flags: no flags
- Mypy configuration options from
mypy.ini(and other config files): default config - Python version used: 3.10
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされている mypy playground の再現例と、表示された main.py のエラーから始め、デフォルト設定の Python 3.10 で mypy 0.981 を使用します。関数の string 引数と property の戻り値アノテーションがどのようにチェックされるかを追跡します。再現例が報告されたエラーなしで実行され、かつ関数の動作が維持されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100