Skip to content

Commit

Permalink
- OmeCache bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Wim Pomp committed May 13, 2024
1 parent f70128e commit ff3a43d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
21 changes: 15 additions & 6 deletions ndbioimage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,23 @@ def __init__(self) -> None:
def __reduce__(self) -> tuple[type, tuple]:
return self.__class__, ()

def __getitem__(self, path: Path) -> OME:
return super().__getitem__(self.path_and_lstat(path))
def __getitem__(self, path: Path | str | tuple) -> OME:
if isinstance(path, tuple):
return super().__getitem__(path)
else:
return super().__getitem__(self.path_and_lstat(path))

def __setitem__(self, path: Path, value: OME) -> None:
super().__setitem__(self.path_and_lstat(path), value)
def __setitem__(self, path: Path | str | tuple, value: OME) -> None:
if isinstance(path, tuple):
super().__setitem__(path, value)
else:
super().__setitem__(self.path_and_lstat(path), value)

def __contains__(self, path: Path) -> bool:
return super().__contains__(self.path_and_lstat(path))
def __contains__(self, path: Path | str | tuple) -> bool:
if isinstance(path, tuple):
return super().__contains__(path)
else:
return super().__contains__(self.path_and_lstat(path))

@staticmethod
def path_and_lstat(path: str | Path) -> tuple[Path, Optional[os.stat_result], Optional[os.stat_result]]:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ndbioimage"
version = "2024.4.8"
version = "2024.5.0"
description = "Bio image reading, metadata and some affine registration."
authors = ["W. Pomp <w.pomp@nki.nl>"]
license = "GPLv3"
Expand Down

0 comments on commit ff3a43d

Please sign in to comment.