- OmeCache bugfix

This commit is contained in:
Wim Pomp
2024-05-13 11:41:13 +02:00
parent f70128e426
commit ff3a43d3c9
2 changed files with 16 additions and 7 deletions

View File

@@ -152,14 +152,23 @@ class OmeCache(DequeDict):
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]]:

View File

@@ -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"