A generator of all the end node keys in a box in box_dots format
(bx, current="")
| 201 | |
| 202 | |
| 203 | def _get_dot_paths(bx, current=""): |
| 204 | """A generator of all the end node keys in a box in box_dots format""" |
| 205 | |
| 206 | def handle_dicts(sub_bx, paths=""): |
| 207 | for key, value in sub_bx.items(): |
| 208 | yield f"{paths}.{key}" if paths else key |
| 209 | if isinstance(value, dict): |
| 210 | yield from handle_dicts(value, f"{paths}.{key}" if paths else key) |
| 211 | elif isinstance(value, list): |
| 212 | yield from handle_lists(value, f"{paths}.{key}" if paths else key) |
| 213 | |
| 214 | def handle_lists(bx_list, paths=""): |
| 215 | for i, value in enumerate(bx_list): |
| 216 | yield f"{paths}[{i}]" |
| 217 | if isinstance(value, list): |
| 218 | yield from handle_lists(value, f"{paths}[{i}]") |
| 219 | if isinstance(value, dict): |
| 220 | yield from handle_dicts(value, f"{paths}[{i}]") |
| 221 | |
| 222 | yield from handle_dicts(bx, current) |
| 223 | |
| 224 | |
| 225 | def _get_box_config(): |