Enhance filtering and updating for set method#143
Enhance filtering and updating for set method#143sygutss wants to merge 4 commits intodpath-maintainers:masterfrom
Conversation
1. Added possibility to filter not only leaves but all dict structures like in search. Flag parameter "only_leaves" - by default is True and functionality is off (Backward compatibility) 2. Added possibility to update dictionaries (works only with "only_leaves" set to False and dictionaries nodes). With this flage we can update specified node (dictionary)
|
@sygutss Hey, are you still interested in working on this PR? |
|
Why not :) I can have a look in the meantime |
… feature/set_filter_not_for_leaves_and_update � Conflicts: � dpath/util.py � tests/test_util_set.py
|
Awesome! If you have any questions feel free to reach out here or on Gitter. |
1. Adjusted to the latest version of master branch. 2. Refactored one method '_split_path' to be more pythonic and concise
|
I've adjusted to the latest version of the master branch and refactored one method '_split_path' to be more pythonic |
|
Could you please provide some example code to give me a better idea of what this PR proposes? |
1. Fixed a small bug under new logic. 2. Provided more self-explained tests.
Description: With that approach we can eg. indicate some known levels Eg. "A/B/*" - in that case, are 'A' and 'B' known but the rest is unknown so we use "*". What else, we know that on some level there should be a specific key with some specific value eg. some type. We can filter using a provided function that is able to compare a specific key from the object from some level. Additionally, I've added the dictionary update possibility instead of the entire replacement during the setting process. |
Added possibility to filter not only leaves but all dict structures like in search.
Flag parameter "only_leaves" - by default is True and functionality is off (Backward compatibility)
Added possibility to update dictionaries (works only with "only_leaves" set to False
and dictionaries nodes). With this flag we can update specified node (dictionary).
By default is set to False (Backward compatibility)