Skip to content

Commit

Permalink
fix: patch coverages
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiragAgg5k committed Nov 20, 2024
1 parent 03d8d37 commit 4c64529
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
11 changes: 3 additions & 8 deletions lightly/data/_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
from lightly.data._image_loaders import default_loader


class ImageLoader(Protocol):
def __call__(self, path: str) -> torch.Tensor:
...


class DatasetFolder(datasets.VisionDataset): # type: ignore
"""Implements a dataset folder.
Expand Down Expand Up @@ -46,7 +41,7 @@ class DatasetFolder(datasets.VisionDataset): # type: ignore
def __init__(
self,
root: str,
loader: ImageLoader = default_loader,
loader: Callable[[str], Any] = default_loader,
extensions: Optional[Tuple[str, ...]] = None,
transform: Optional[Callable[[Any], Any]] = None,
target_transform: Optional[Callable[[Any], Any]] = None,
Expand All @@ -73,9 +68,9 @@ def __init__(

samples = _make_dataset(self.root, extensions, is_valid_file)
if len(samples) == 0:
msg = f"Found 0 files in folder: {self.root}\n"
msg = "Found 0 files in folder: {}\n".format(self.root)
if extensions is not None:
msg += f"Supported extensions are: {','.join(extensions)}"
msg += "Supported extensions are: {}".format(",".join(extensions))
raise RuntimeError(msg)

self.loader = loader
Expand Down
3 changes: 2 additions & 1 deletion lightly/data/lightly_subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def index_to_filename(
Returns:
The filename of the sample at the specified subset index.
"""
return self.filenames_subset[index_subset]
fname = self.filenames_subset[index_subset]
return fname

@property
def input_dir(self) -> str:
Expand Down

0 comments on commit 4c64529

Please sign in to comment.