Skip to content

Commit

Permalink
Fix BaseImagesBatch.load error on path creation with src=None
Browse files Browse the repository at this point in the history
  • Loading branch information
cdtn committed Nov 7, 2022
1 parent a2cd076 commit 61c6bb9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion batchflow/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
5 changes: 3 additions & 2 deletions batchflow/batch_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 61c6bb9

Please sign in to comment.