"Set" classes are not iterable
还没有人认领这个 Issue。
评估
调研方向
从 Set 类开始,包括 tsp.trace_set.TraceSet,并找到 ExperimentSet、TraceSet、ConfigurationParameterDescriptorSet、ConfigurationSet、ConfigurationSourceSet 和 OutputDescriptorSet 的实现。将它们当前作为集合的行为与 issue 和链接的示例 commit 中的访问模式进行比较。完成的标准是每个类都可以直接迭代,并通过 len() 报告其大小,同时索引访问仍为可选。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Python
- 星标
- 6
- 派生
- 16
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
eclipse-cdt-cloud/tsp-python-client 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 35/100
-
Support endpoint to update experiments可能已有人在做 @bhufmann 于 1765 天前认领。 未关闭enhancement
难度 4/5 3-5 天 新手友好度 38/100
eclipse-cdt-cloud/tsp-python-client#45 · 1 条评论 ·
-
bug
难度 3/5 1-2 天 新手友好度 38/100
-
难度 4/5 3-5 天 新手友好度 38/100
-
难度 4/5 3-5 天 新手友好度 38/100
查看 eclipse-cdt-cloud/tsp-python-client 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
aicell-lab/bioengine#232 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
modelscope/evalscope#1836 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
-
bug
难度 1/5 1 小时以内 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
jbaruch/speaker-toolkit#480 ·
维护者通常 1 天内回复