Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Type annotation for attr.ib wrappers functions

Đang mở
#779 8 bình luận 2 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
developer-experience

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Bug Typing

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]
Ngôn ngữ chính
Python
Star
5.8k
Fork
480
Merge trung bình
2 giờ 15 phút
Pull request đã merge (30 ngày)
2

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của python-attrs/attrs

Tất cả issue của python-attrs/attrs

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.