99import os .path
1010from pathlib import Path
1111from types import TracebackType
12- from typing import Optional
12+ from typing import Any , Optional
1313from typing_extensions import Self
1414
1515from .error import HermesCacheError
@@ -24,7 +24,7 @@ class HermesCache:
2424
2525 Attributes:
2626 _cache_dir (Path): The directory the cache is located at.
27- _cached_data (dict[str, dict ]): The cache of the files in the cache. The key is the filename.
27+ _cached_data (dict[str, Any ]): The cache of the files in the cache. The key is the filename.
2828 """
2929 def __init__ (self : Self , cache_dir : Path ) -> None :
3030 """
@@ -56,15 +56,15 @@ def __enter__(self: Self) -> None:
5656 # return the cache object
5757 return self
5858
59- def __getitem__ (self : Self , item : str ) -> dict :
59+ def __getitem__ (self : Self , item : str ) -> Any :
6060 """
6161 Loads a file if necessary or returns the cached value.
6262
6363 Args:
6464 item (str): The name of the file.
6565
6666 Returns:
67- dict : The JSON value in the given file.
67+ Any : The JSON value in the given file.
6868 """
6969 # check whether or not the given file was already loaded
7070 if item not in self ._cached_data :
@@ -76,14 +76,14 @@ def __getitem__(self: Self, item: str) -> dict:
7676 # return the loaded json
7777 return self ._cached_data [item ]
7878
79- def __setitem__ (self : Self , key : str , value : dict ) -> None :
79+ def __setitem__ (self : Self , key : str , value : Any ) -> None :
8080 """
8181 Writes a value into the cache.\n
8282 Note that the files isn't immediately updated only the cache is.
8383
8484 Args:
8585 key (str): The filename the data is written too.
86- value (dict ): The JSON value for the file.
86+ value (Any ): The JSON value for the file.
8787
8888 Returns:
8989 None:
0 commit comments