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
- フォーク
- 140
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
cdgriffith/Box のほかの issue
-
subclass of `Box` does not unpickle correctly対応中かも @koriyoshi2041 が 135 日前に担当しました。 オープン
難易度 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対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
cdgriffith/Box#305 ·
-
[Bug] Camel killer box and box dots gives unexpected behaviour対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 30/100
cdgriffith/Box#300 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
cdgriffith/Box#298 ·
似ている issue
-
comp/gateway comp/plugins duplicate P3 type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
NousResearch/hermes-agent#137019 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
bot-triaged module: docs triaged
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
new-entry
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
BinWang28/audio-ai-hub#194 ·
-
confluence: a paged listing's links re-encode a parameter they carry, where real carries it as sentオープンfidelity
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
メンテナーはふだん 1 日以内に返信