benedict.core.keypaths   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 11
dl 0
loc 13
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A keypaths() 0 8 2
1
from benedict.core.keylists import keylists
2
from benedict.utils import type_util
3
4
5
def keypaths(d, separator=".", indexes=False):
6
    separator = separator or "."
7
    if not type_util.is_string(separator):
8
        raise ValueError("separator argument must be a (non-empty) string.")
9
    kls = keylists(d, indexes=indexes)
10
    kps = [separator.join([f"{key}" for key in kl]) for kl in kls]
11
    kps.sort()
12
    return kps
13