|
45 | 45 | from typing_extensions import assert_never |
46 | 46 |
|
47 | 47 | from bioimageio.spec import AnyModelDescr, InvalidDescr, load_description |
| 48 | +from bioimageio.spec._internal.io_basics import ZipPath |
48 | 49 | from bioimageio.spec._internal.types import NotEmpty |
49 | 50 | from bioimageio.spec.dataset import DatasetDescr |
50 | 51 | from bioimageio.spec.model import ModelDescr, v0_4, v0_5 |
@@ -298,20 +299,12 @@ def _example(self): |
298 | 299 |
|
299 | 300 | for t, src in zip(input_ids, example_inputs): |
300 | 301 | local = download(src).path |
301 | | - if isinstance(local, Path): |
302 | | - suffixes = local.suffixes |
303 | | - elif isinstance(local, zipfile.Path): |
304 | | - # .suffixes for zipfile.Path only added in py 3.11 |
305 | | - suffixes = PurePosixPath(local.at).suffixes |
306 | | - else: |
307 | | - assert_never(local) |
308 | | - |
309 | | - dst = Path(f"{example_path}/{t}/001{''.join(suffixes)}") |
| 302 | + dst = Path(f"{example_path}/{t}/001{''.join(local.suffixes)}") |
310 | 303 | dst.parent.mkdir(parents=True, exist_ok=True) |
311 | 304 | inputs001.append(dst.as_posix()) |
312 | 305 | if isinstance(local, Path): |
313 | 306 | shutil.copy(local, dst) |
314 | | - elif isinstance(local, zipfile.Path): |
| 307 | + elif isinstance(local, ZipPath): |
315 | 308 | _ = local.root.extract(local.at, path=dst) |
316 | 309 | else: |
317 | 310 | assert_never(local) |
|
0 commit comments