Passed
Push — master ( db2481...3bd527 )
by Fabio
03:28
created

benedict.core.merge   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 12
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A merge() 0 10 5
1
# -*- coding: utf-8 -*-
2
3
from benedict.utils import type_util
4
5
6
def merge(d, other, *args):
7
    others = [other] + list(args)
8
    for other in others:
9
        for key, value in other.items():
10
            src = d.get(key, None)
11
            if type_util.is_dict(src) and type_util.is_dict(value):
12
                merge(src, value)
13
            else:
14
                d[key] = value
15
    return d
16