Passed
Push — master ( df3bcb...d239e0 )
by Fabio
01:14
created

benedict.core.keylists   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 13
dl 0
loc 18
rs 10
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A _get_keylist() 0 8 3
A keylists() 0 2 1
1
# -*- coding: utf-8 -*-
2
3
from benedict.utils import type_util
4
5
6
def _get_keylist(item, parent_keys):
7
    l = []
8
    for key, value in item.items():
9
        keys = parent_keys + [key]
10
        l += [keys]
11
        if type_util.is_dict(value):
12
            l += _get_keylist(value, keys)
13
    return l
14
15
16
def keylists(d):
17
    return _get_keylist(d, [])
18