Skip to content

Commit

Permalink
chore: remove CacheEnum.HDF (#909)
Browse files Browse the repository at this point in the history
Signed-off-by: Luka Peschke <luka.peschke@toucantoco.com>
  • Loading branch information
lukapeschke authored Nov 22, 2024
1 parent 3a30276 commit 9b1cb20
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### Changed

- Removed `CacheEnum.HDF`

## [0.14.0] - 2024-11-21

### Added
Expand Down
10 changes: 0 additions & 10 deletions peakina/cache.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import warnings
from abc import ABCMeta, abstractmethod
from collections.abc import Callable
from contextlib import suppress
Expand All @@ -20,21 +19,12 @@ class InMemoryCached(TypedDict):

class CacheEnum(str, Enum):
MEMORY = "memory"
# FIXME: to be removed in v0.15.0
HDF = "hdf"
PICKLE = "pickle"


class Cache(metaclass=ABCMeta):
@staticmethod
def get_cache(kind: CacheEnum, *args: Any, **kwargs: Any) -> "Cache":
if kind == CacheEnum.HDF:
warnings.warn(
"HDF Cache has been removed in v0.14.0, PickleCache will be used instead. "
"This will be an error in v0.15.0, please use CacheEnum.PICKLE instead",
DeprecationWarning,
)
kind = CacheEnum.PICKLE
if kind == CacheEnum.PICKLE:
return PickleCache(*args, **kwargs)
else:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_inmemory_cache(df_test):

def test_pickle_cache(mocker, tmp_path, df_test):
"""two pickle caches pointing to the same directory are equivalent"""
c1 = Cache.get_cache(CacheEnum.HDF, cache_dir=tmp_path)
c1 = Cache.get_cache(CacheEnum.PICKLE, cache_dir=tmp_path)
c2 = Cache.get_cache(CacheEnum.PICKLE, cache_dir=tmp_path)
assert isinstance(c1, PickleCache)
assert isinstance(c2, PickleCache)
Expand All @@ -60,7 +60,7 @@ def cache(request: Any, tmpdir: str) -> Cache:
if request.param == "memory":
return Cache.get_cache(CacheEnum.MEMORY)
elif request.param == "hdf":
return Cache.get_cache(CacheEnum.HDF, cache_dir=tmpdir)
return Cache.get_cache(CacheEnum.PICKLE, cache_dir=tmpdir)
else:
raise ValueError("invalid internal test config")

Expand Down

0 comments on commit 9b1cb20

Please sign in to comment.