dry-python / dry-python/returns

Mypy complains when currying a class

未关闭
#1,476 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
Python
星标
4.4k
派生
155
平均合并
2 小时 27 分钟
30 天内合并 PR
22

描述

# Bug report

Hi, I'm trying to curry a class constructor, but mypy complains

## What's wrong

```py
# main.py
from returns.curry import curry

@curry
class Person:
def __init__(self, name: str, age: int):
self.name = name
self.age = age

Person("bob")(33)

```

```
$ mypy main.py
main.py:10: error: Missing positional argument "age" in call to "Person"
main.py:10: error: "Person" not callable
Found 2 errors in 1 file (checked 1 source file)
```

Here is my mypy.ini file:
```
[mypy]
plugins =
returns.contrib.mypy.returns_plugin
```
## How is that should be

mypy should not report any error

## System information

- `python` version: 3.10.4
- `returns` version: 0.19.0
- `mypy` version: 0.971

- `hypothesis` version (if any): not installed
- `pytest` version (if any): not installed

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。