Uh oh!
There was an error while loading. Please reload this page.
action selection flag when patching - #175
Conversation
Napam
commented
Mar 4, 2023
I would also like to have this functionality |
Napam
commented
Mar 25, 2023
One could also just filter the diffs returnerd by diffs=dictdiffer.diff(a, b)
diffs= [difffordiffindiffsifdiff[0] =='add'] # Only do add operationsa=dictdiffer.patch(diffs, a) |
ZeitgeberH
commented
Mar 25, 2023
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 importdictdiffera= {'a': 1}
b= {'b': 2}
diffs=dictdiffer.diff(a, b)
diffs= [difffordiffindiffsifdiff[0] =='add']
dictdiffer.patch(diffs, a) # Results in {'a': 1, 'b': 2} |
ZeitgeberH
commented
Mar 25, 2023
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: