Can't use a subscripted `ThingSlot`
Maintainer thường phản hồi trong vòng 3 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
Start by reading the ThingSlot and BaseDescriptor definitions and the code that handles __orig_class__; the issue identifies the mismatch between the one-parameter subscription and the descriptor’s two type parameters. Check existing tests for thing_slot() and descriptor typing behavior. Done means ThingSlot[MyOtherThing]() works as expected or the supported behavior is documented clearly.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
The public API says I should define a Thing Slot like:
class MyThing(lt.Thing):
other_thing: MyOtherThing = lt.thing_slot()
This works fine.
I expected I could also do this:
class MyThing(lt.Thing):
other_thing = ThingSlot[MyOtherThing]()
The second form (which isn't recommended anywhere) does not work. The reason for this is that BaseDescriptor expects two type parameters, the first is the host class and the second is the value. When it calls __orig_class__, it gets ThingSlot[ValueType] and not BaseDescriptor[lt.Thing, ValueType].
To Reproduce
Define a ThingSlot using the type in a subscript, as shown above.
Expected behaviour
I hoped the two examples above would be equivalent.
Additional context
The subscripted form is not really used or recommended anywhere. We could just remove it - but I feel like it has its uses. This isn't blocking anything, so it's likely to sit in the backlog for a little while.
- Ngôn ngữ chính
- Python
- Star
- 10
- Fork
- 4
- Merge trung bình
- 4 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 11
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của labthings/labthings-fastapi
-
Tests can fail on `anyio < 4.14`Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
labthings/labthings-fastapi#438 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
labthings/labthings-fastapi#435 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Consider atomic JSON writesCó thể làm lại được @ashiishe2-oss đã nhận 26 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
labthings/labthings-fastapi#412 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Use `Exception.add_note`Đang mởdrop-python-version
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
labthings/labthings-fastapi#354 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Log propagation issueĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
labthings/labthings-fastapi#312 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của labthings/labthings-fastapi
Issue tương tự
-
bug feature request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Qiskit/qiskit-obp#156 ·
-
perf(batch-jobs): discover-misses reads the state list without running the whole stage reportĐang mởaction-item enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
getcommunityone/open-navigator#1658 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
review-panel severity:low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
kristovatlas/coin-accounting#636 ·
Maintainer thường phản hồi trong vòng 1 ngày