Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New recursive diff master #55759

Merged
merged 10 commits into from
Jan 4, 2020
Merged

Conversation

github-abcde
Copy link
Contributor

Port to master of #53715

What does this PR do?

It adds recursive_diff to salt.utils.data. This is a recursive diff that can handle mixed nested mappings/iterables. This is an alternative to salt/utils/dictdiffer.py or salt/utils/listdiffer.py that can only handle nested dicts and list-of-nested-dicts respectively.

What issues does this PR fix or reference?

None that I'm aware of.

Previous Behavior

Only nested dicts or list-of-nested-dicts could be recursively diffed. Nothing is available to recursively diff a mix of lists, dicts, OrderedDicts, sets, tuples or other mapping or iterable type.

New Behavior

salt.utils.data.recursive_diff is able to produce a dict with old and new keys for any combination of nested mapping- or iterable types. Some options are only applicable to certain types, like ignore_keys and ignore_missing_keys will only work on (nested) mappings, and ignore_order will only make a difference on ordered datatypes (like OrderedDict and list).

Tests written?

Yes

Commits signed with GPG?

Yes

… iterable recursively. Also added unittests.
This will make it more compatible with the existing dictdiffer.
Also added tests for the new parameter.
Also remove FilterFalseyTestCase class as this is part of another PR
Remove is_iterable as it is already implemented in is_iter;
Replaced all elif after return with if;
Remove else after return or continue;
Added function docstrings where they were missing.
@github-abcde github-abcde requested a review from a team as a code owner December 30, 2019 11:37
@ghost ghost requested a review from xeacott December 30, 2019 11:37
@dwoz dwoz merged commit 0838f1e into saltstack:master Jan 4, 2020
@github-abcde github-abcde deleted the new_recursive_diff-master branch January 6, 2020 08:35
@github-abcde github-abcde mentioned this pull request Jan 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants