From 61c6bb96b00be038dafbdc696aeb62665b035460 Mon Sep 17 00:00:00 2001 From: cdtn <53620809+cdtn@users.noreply.github.com> Date: Mon, 7 Nov 2022 17:58:32 +0400 Subject: [PATCH] Fix `BaseImagesBatch.load` error on path creation with `src=None` --- batchflow/batch.py | 2 +- batchflow/batch_image.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/batchflow/batch.py b/batchflow/batch.py index 378afae12..18131a419 100755 --- a/batchflow/batch.py +++ b/batchflow/batch.py @@ -90,7 +90,7 @@ class Batch(metaclass=MethodsTransformingMeta): def __init__(self, index, dataset=None, pipeline=None, preloaded=None, copy=False, *args, **kwargs): _ = args - if self.components is not None and not isinstance(self.components, tuple): + if self.components is not None and not isinstance(self.components, tuple): raise TypeError("components should be a tuple of strings with components names") self.index = index self._preloaded_lock = threading.Lock() diff --git a/batchflow/batch_image.py b/batchflow/batch_image.py index 1878a5746..0339464ae 100644 --- a/batchflow/batch_image.py +++ b/batchflow/batch_image.py @@ -49,8 +49,9 @@ def _make_path(self, ix, src=None): path : str Full path to an element. """ - - if isinstance(src, FilesIndex): + if src is None: + path = str(ix) + elif isinstance(src, FilesIndex): path = src.get_fullpath(ix) elif isinstance(self.index, FilesIndex): path = self.index.get_fullpath(ix)