| Total Complexity | 2 |
| Total Lines | 13 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 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 |