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

"Set" classes are not iterable

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

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
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
api

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

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 eclipse-cdt-cloud/tsp-python-client

Tất cả issue của eclipse-cdt-cloud/tsp-python-client

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.