A generator of all the end node keys in a box in box_dots format
(bx, current="")
| 109 | |
| 110 | |
| 111 | def _get_dot_paths(bx, current=""): |
| 112 | """A generator of all the end node keys in a box in box_dots format""" |
| 113 | |
| 114 | def handle_dicts(sub_bx, paths=""): |
| 115 | for key, value in sub_bx.items(): |
| 116 | yield f"{paths}.{key}" if paths else key |
| 117 | if isinstance(value, dict): |
| 118 | yield from handle_dicts(value, f"{paths}.{key}" if paths else key) |
| 119 | elif isinstance(value, list): |
| 120 | yield from handle_lists(value, f"{paths}.{key}" if paths else key) |
| 121 | |
| 122 | def handle_lists(bx_list, paths=""): |
| 123 | for i, value in enumerate(bx_list): |
| 124 | yield f"{paths}[{i}]" |
| 125 | if isinstance(value, list): |
| 126 | yield from handle_lists(value, f"{paths}[{i}]") |
| 127 | if isinstance(value, dict): |
| 128 | yield from handle_dicts(value, f"{paths}[{i}]") |
| 129 | |
| 130 | yield from handle_dicts(bx, current) |
| 131 | |
| 132 | |
| 133 | def _get_box_config(): |