mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #14560 from dagwieers/merge_hash_v2
Improve efficiency of merge_hash (Ansible v2.0)
This commit is contained in:
commit
d87fd68287
1 changed files with 6 additions and 0 deletions
|
@ -74,6 +74,12 @@ def merge_hash(a, b):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_validate_mutable_mappings(a, b)
|
_validate_mutable_mappings(a, b)
|
||||||
|
|
||||||
|
# if a is empty or equal to b, return b
|
||||||
|
if a == {} or a == b:
|
||||||
|
return b.copy()
|
||||||
|
|
||||||
|
# if b is empty the below unfolds quickly
|
||||||
result = a.copy()
|
result = a.copy()
|
||||||
|
|
||||||
# next, iterate over b keys and values
|
# next, iterate over b keys and values
|
||||||
|
|
Loading…
Reference in a new issue