Unflattens a single-level dictionary into a nested dictionary, with keys as tuples.
(d: Dict[str, Any])
| 99 | |
| 100 | |
| 101 | def unflatten_nested_dict(d: Dict[str, Any]) -> Dict[str, Any]: |
| 102 | """ |
| 103 | Unflattens a single-level dictionary into a nested dictionary, with keys as tuples. |
| 104 | """ |
| 105 | result = {} |
| 106 | for k, v in d.items(): |
| 107 | sub_dict = result |
| 108 | for k_ in k[:-1]: |
| 109 | if k_ not in sub_dict: |
| 110 | sub_dict[k_] = {} |
| 111 | sub_dict = sub_dict[k_] |
| 112 | sub_dict[k[-1]] = v |
| 113 | return result |
| 114 | |
| 115 | |
| 116 | def read_jsonl(file): |
nothing calls this directly
no outgoing calls
no test coverage detected