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

Complexity

Conditions 4

Size

Total Lines 8
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 4
nop 4
1
def move(d, key_src, key_dest, overwrite=True):
2
    if key_dest == key_src:
3
        return
4
    if key_dest in d and not overwrite:
5
        raise KeyError(
6
            f"Invalid key: '{key_dest}', key already in target dict and 'overwrite' is disabled."
7
        )
8
    d[key_dest] = d.pop(key_src)
9