"Set" classes are not iterable
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
- 52/100
Hướng nghiên cứu
Bắt đầu với các lớp Set, bao gồm tsp.trace_set.TraceSet, và tìm các phần triển khai của ExperimentSet, TraceSet, ConfigurationParameterDescriptorSet, ConfigurationSet, ConfigurationSourceSet và OutputDescriptorSet. So sánh hành vi collection hiện tại của chúng với các mẫu truy cập trong issue và commit ví dụ được liên kết. Được xem là hoàn tất khi mỗi lớp có thể được lặp trực tiếp và trả về kích thước bằng len(), trong khi việc lập chỉ mục vẫn là tùy chọn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
The Set classes, ExperimentSet, TraceSet, ConfigurationParameterDescriptorSet, ConfigurationSet, ConfigurationSourceSet and OutputDescriptorSet are not usable by themselves as collections.
This gives you access patterns like:
from tsp.trace_set import TraceSet
traces = TraceSet([{"name": "trace0"}, {"name": "trace1"}])
for trace in traces.traces:
print(t.name)
# trace0
# trace1
print(len(traces.traces))
# 2
This is especially inconvenient when working with experiments, since to loop over traces, you must do:
for t in experiment.traces.traces
We could make the classes easier to work with by making them implement collection interfaces.
This would give you the following access patterns instead:
from tsp.trace_set import TraceSet
traces = TraceSet([{"name": "trace0"}, {"name": "trace1"}])
for trace in traces:
print(t.name)
# trace0
# trace1
print(len(traces))
# 2
See example in this commit.
__getitem__ could be implemented as well to allow indexing with integers (traces[0]), but it is not implemented for Python sets, so it would make the "Set" classes look less like sets.
If this kind of functionality is wanted, I can help provide patches.
- Ngôn ngữ chính
- Python
- Star
- 6
- Fork
- 16
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
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 eclipse-cdt-cloud/tsp-python-client
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
eclipse-cdt-cloud/tsp-python-client#45 · 1 bình luận ·
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 38/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
Tất cả issue của eclipse-cdt-cloud/tsp-python-client
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
anthropics/skills#1811 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
speaches-ai/speaches#678 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
datalayer/mcp-compose#42 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
conda-forge/spacy-feedstock#177 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
UKGovernmentBEIS/inspect_evals#2523 ·