Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Mypy 1.6.1 fails with returns 0.21.0 on use of `curry.partial`

オープン
#1,711 コメント 5 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
devtools

調査の方向性

まず returns/contrib/mypy/_features/partial.py と returns/contrib/mypy/_typeops/inference.py から始め、特に traceback に示されている呼び出しを確認します。Python 3.11.4、returns 0.21.0、mypy 1.6.1 で失敗を再現し、その後、関連する mypy plugin API の変更を調べます。curry.partial の例が TypeError なしで実行され、期待される callable 型が表示されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug

Bug report

I think mypy 1.6 has broken your plugin again. It seems like their API changes quite a lot. :(

What's wrong

my_partial = returns.curry.partial(foo, bar=baz(1))
reveal_type(my_partial)

Running mypy 1.6.1 against this, with the plugin installed and activated, results in:

https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 1.6.1
Traceback (most recent call last):
  File "mypy/checkexpr.py", line 5374, in accept
  File "mypy/nodes.py", line 1907, in accept
  File "mypy/checkexpr.py", line 452, in visit_call_expr
  File "mypy/checkexpr.py", line 581, in visit_call_expr_inner
  File "mypy/checkexpr.py", line 1420, in check_call_expr_with_callee_type
  File "mypy/checkexpr.py", line 1514, in check_call
  File "mypy/checkexpr.py", line 1734, in check_callable_call
  File "mypy/checkexpr.py", line 1194, in apply_function_plugin
  File "*/.venv/lib/python3.11/site-packages/returns/contrib/mypy/_features/partial.py", line 67, in analyze
    ).new_partial()
      ^^^^^^^^^^^^^
  File "*/.venv/lib/python3.11/site-packages/returns/contrib/mypy/_features/partial.py", line 135, in new_partial
    partial = self._create_partial_case(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "*/.venv/lib/python3.11/site-packages/returns/contrib/mypy/_features/partial.py", line 167, in _create_partial_case
    ).from_usage(self._applied_args)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "*/.venv/lib/python3.11/site-packages/returns/contrib/mypy/_typeops/inference.py", line 61, in from_usage
    constraints = self._infer_constraints(applied_args)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "*/.venv/lib/python3.11/site-packages/returns/contrib/mypy/_typeops/inference.py", line 83, in _infer_constraints
    constraints = infer_constraints_for_callable(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: infer_constraints_for_callable() missing required argument 'context' (pos 6)

How is that should be

path/to/execution.py:21: note: Revealed type is "def (id: builtins.str, df: Any, *, schema: Union[builtins.str, None] =) -> FooBarBaz"

System information

  • python version: 3.11.4

  • returns version: 0.21.0

  • mypy version: 1.6.1

  • pytest version (if any): 7.2.1

主要言語
Python
スター
4.4k
フォーク
154
平均マージ
3時間 5分
マージ済み PR(30日)
22

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

dry-python/returns のほかの issue

dry-python/returns の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。