Given a list of paths, convert them into a nested structure that will match the pages config.
(paths)
| 336 | |
| 337 | |
| 338 | def nest_paths(paths): |
| 339 | """ |
| 340 | Given a list of paths, convert them into a nested structure that will match |
| 341 | the pages config. |
| 342 | """ |
| 343 | nested = [] |
| 344 | |
| 345 | for path in paths: |
| 346 | parts = PurePath(path).parent.parts |
| 347 | |
| 348 | branch = nested |
| 349 | for part in parts: |
| 350 | part = dirname_to_title(part) |
| 351 | branch = find_or_create_node(branch, part) |
| 352 | |
| 353 | branch.append(path) |
| 354 | |
| 355 | return nested |
| 356 | |
| 357 | |
| 358 | class DuplicateFilter: |
no test coverage detected
searching dependent graphs…