Given any path belonging to a multi-file model (e.g. foo.bin.1), return the whole list of paths in the model.
(path: Path)
| 1382 | |
| 1383 | |
| 1384 | def find_multifile_paths(path: Path) -> list[Path]: |
| 1385 | '''Given any path belonging to a multi-file model (e.g. foo.bin.1), return |
| 1386 | the whole list of paths in the model. |
| 1387 | ''' |
| 1388 | ret: list[Path] = [] |
| 1389 | for i in itertools.count(): |
| 1390 | nth_path = nth_multifile_path(path, i) |
| 1391 | if nth_path is None: |
| 1392 | break |
| 1393 | ret.append(nth_path) |
| 1394 | if not ret: |
| 1395 | # No matches. This should only happen if the file was named, e.g., |
| 1396 | # foo.0, and there was no file named foo. Oh well, try to process it |
| 1397 | # as a single file. |
| 1398 | return [path] |
| 1399 | return ret |
| 1400 | |
| 1401 | |
| 1402 | def load_some_model(path: Path) -> ModelPlus: |
no test coverage detected