Feature request: extend `merge_update` into BoxLists
评估
调研方向
首先定位 issue 中描述的 merge_update 行为和 BoxLists 处理,然后检查现有的 merge 相关测试(如果有)。将当前的数据替换方式与预期的逐元素更新进行比较,并将完成标准定义为:保留现有的列表字典,同时添加匹配的传入元素中的字段。
由索引模型根据 Issue 内容生成。
描述
Current
If I have these two BoxDicts:
In [1]: from box import Box
...: dict1 = Box({'data': [{'foo': 1, 'foobar': 20}, {'bar': 2}] }, box_dots=True)
...: dict2 = Box({'data': [{'foo': 1, 'baz': 10}] }, box_dots=True)
...: print(dict1.keys(dotted=True))
...: print(dict2.keys(dotted=True))
['data[0].foo', 'data[0].foobar', 'data[1].bar']
['data[0].baz', 'data[0].foo']
Then, if I use merge_update I get:
In [2]: dict1 + dict2
Out[2]: Box({'data': [{'foo': 1, 'baz': 10}]})
Expected behaviour
When merging the two datasets, it would be great if Box entered each list element and updated the dictionary:
In [1]: dict1 + dict2
Out[1]: Box({'data': [{'foo': 1, 'foobar': 20, 'baz': 10}, {'bar': 2}]})
Since the BoxDict has a pseudo-key for elements of the lists (e.g., 'data[0].foo') it feels like it should be possible.
Versions
python: 3.11
box: 7.1.1
- 主要语言
- Python
- 星标
- 2.8k
- 派生
- 145
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
cdgriffith/Box 的其他 Issue
-
subclass of `Box` does not unpickle correctly可能已有人在做 @koriyoshi2041 于 139 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
cdgriffith/Box#308 ·
-
难度 3/5 1-2 天 新手友好度 42/100
cdgriffith/Box#307 · 1 条评论 ·
-
Dotted keys read from YAML are lost with box_dots / default_box可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 3/5 1-2 天 新手友好度 48/100
cdgriffith/Box#305 ·
-
[Bug] Camel killer box and box dots gives unexpected behaviour可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 3/5 1-2 天 新手友好度 30/100
cdgriffith/Box#300 ·
-
难度 3/5 1-2 天 新手友好度 42/100
cdgriffith/Box#298 ·
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
jbacalso24/mimry#291 ·
维护者通常 1 天内回复
-
good first issue
难度 2/5 1 小时以内 新手友好度 82/100
eli-alvarado/us-watchlist-alerts#14 ·
维护者通常 1 天内回复
-
from-review-extraction python severity:nit
难度 2/5 1-3 小时 新手友好度 80/100
LearningCircuit/local-deep-research#7462 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
cathrynlavery/diagram-design#441 ·
维护者通常 2 天内回复
-
[Cleanup] Include the public header in work_split.cpp可能已有人在做 @blozano-tt 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
tenstorrent/tt-metal#60850 ·
维护者通常 1 天内回复