(source, *, max_images: Optional[int])
| 270 | #---------------------------------------------------------------------------- |
| 271 | |
| 272 | def open_dataset(source, *, max_images: Optional[int]): |
| 273 | if os.path.isdir(source): |
| 274 | if source.rstrip('/').endswith('_lmdb'): |
| 275 | return open_lmdb(source, max_images=max_images) |
| 276 | else: |
| 277 | return open_image_folder(source, max_images=max_images) |
| 278 | elif os.path.isfile(source): |
| 279 | if os.path.basename(source) == 'cifar-10-python.tar.gz': |
| 280 | return open_cifar10(source, max_images=max_images) |
| 281 | elif os.path.basename(source) == 'train-images-idx3-ubyte.gz': |
| 282 | return open_mnist(source, max_images=max_images) |
| 283 | elif file_ext(source) == 'zip': |
| 284 | return open_image_zip(source, max_images=max_images) |
| 285 | else: |
| 286 | assert False, 'unknown archive type' |
| 287 | else: |
| 288 | error(f'Missing input file or directory: {source}') |
| 289 | |
| 290 | #---------------------------------------------------------------------------- |
| 291 |
no test coverage detected