benedict.core.swap.swap()   A
last analyzed

Complexity

Conditions 4

Size

Total Lines 8
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 4
nop 3
1
def swap(d, key1, key2):
2
    if key1 == key2:
3
        return
4
    val1 = d[key1]
5
    val1 = val1.copy() if isinstance(val1, dict) else val1
6
    val2 = d[key2]
7
    val2 = val2.copy() if isinstance(val2, dict) else val2
8
    d[key1], d[key2] = val2, val1
9