Getting 'Untyped decorator makes function "*" untyped' when using decorator inside a function
オープン
まだ誰も着手していません。
bug
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- PR マージ指標
- PR 指標を取得中
説明
Sorry for the long title! I found a small issue when using disallow-untyped-decorators and while having a decorated function inside another function, here's the reproduction:
from typing import Callable
def mydeco(f: Callable) -> Callable:
return f
# Failing case
def something():
class Query:
@mydeco
def search(self, input: str) -> str:
return input
reveal_type(Query.search)
# Failing case
def something():
@mydeco
def example() -> str:
return "str"
reveal_type(example)
# Ok case
class Query:
@mydeco
def search(self, input: str) -> str:
return input
reveal_type(Query.search)
# Ok case
@mydeco
def example() -> str:
return "str"
reveal_type(example)
I guess this is not a big deal since we don't normall define functions inside functions, but I got this issue while writing some tests and it'd be nice to get it fixed 😊
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされた mypy-play の再現例から始め、モジュールスコープで定義された関数と、別の関数またはクラスの内部で定義された関数について、デコレータの処理を比較します。ネストされたデコレート済み定義の型チェック経路を追跡します。再現例で型付けされていないデコレータが報告されなくなり、reveal_type の結果が適切に型付けされたままになれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100