action selection flag when patching#175
action selection flag when patching#175ZeitgeberH wants to merge 3 commits intoinveniosoftware:masterfrom
Conversation
|
I would also like to have this functionality |
|
One could also just filter the diffs returnerd by diffs = dictdiffer.diff(a, b)
diffs = [diff for diff in diffs if diff[0] == 'add'] # Only do add operations
a = dictdiffer.patch(diffs, a) |
I think that may not work, as |
I can confirm that this works. I have done this for my project and it worked fine. I don't assume that import dictdiffer
a = {'a': 1}
b = {'b': 2}
diffs = dictdiffer.diff(a, b)
diffs = [diff for diff in diffs if diff[0] == 'add']
dictdiffer.patch(diffs, a) # Results in {'a': 1, 'b': 2} |
|
I see.Yes, it would work in the code example you provided. |
Description
Add action selection flag in the
dictdiffer.patchfunction to allow selectively patching. For example, setaction_flags='a'would only applyadditems in thediffer_results. See examples in thetest_limit_actions_patchfunction in tests/test_utils.pyChecklist
Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:
Third-party code
If you've added third-party code (copy/pasted or new dependencies), please reach out to an architect.
Reminder
By using GitHub, you have already agreed to the GitHub’s Terms of Service including that: