Type annotation for attr.ib wrappers functions
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- python
调研方向
Reproduce the example with mypy 0.812, Python 3.7.3, and attrs 20.3.0, focusing on the unexpected keyword argument for the wrapped attribute. Then inspect the attrs typing integration and determine what support is needed; done means the example type-checks without the acme error.
由索引模型根据 Issue 内容生成。
描述
It's possible to type a method that wraps an attr.ib attribute?
Example:
import attr
from typing import Any
def typed() -> Any:
return attr.ib(type=str)
@attr.s
class TestingParams:
foo = attr.ib(type=str)
acme = typed()
TestingParams(foo='1', acme='3')
Executing mypy (0.812) with Python (3.7.3) and attrs (20.3.0) I got the following output
error: Unexpected keyword argument "acme" for "TestingParams" [call-arg]
- 主要语言
- Python
- 星标
- 5.8k
- 派生
- 480
- 平均合并
- 2 小时 15 分钟
- 30 天内合并 PR
- 2
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python-attrs/attrs 的其他 Issue
-
难度 5/5 一周以上 新手友好度 20/100
python-attrs/attrs#1620 ·
-
难度 3/5 1-2 天 新手友好度 55/100
python-attrs/attrs#1596 · 2 条评论 · 1 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 35/100
python-attrs/attrs#1549 · 3 条评论 ·
-
难度 4/5 3-5 天 新手友好度 38/100
python-attrs/attrs#1543 · 2 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
python-attrs/attrs#1532 ·
查看 python-attrs/attrs 的全部 Issue
相似的 Issue
-
area: harness bug status: needs-triage
难度 2/5 1-3 小时 新手友好度 75/100
Human-Agent-Society/reef#625 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 1/5 1 小时以内 新手友好度 80/100
learningequality/kolibri#15351 · 2 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
Name consistency 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
eellak/triplestore#65 · 1 条评论 ·