Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions cachier/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _function_thread(core, key, func, args, kwds):
try:
func_res = func(*args, **kwds)
core.set_entry(key, func_res)
except BaseException as exc: # pylint: disable=W0703
except BaseException as exc:
print(f"Function call failed with the following exception:\n{exc}")


Expand All @@ -70,7 +70,6 @@ def _calc_entry(core, key, func, args, kwds):


def _default_hash_func(args, kwds):
# pylint: disable-next=protected-access
key = functools._make_key(args, kwds, typed=True)
hash = hashlib.sha256()
for item in key:
Expand Down Expand Up @@ -229,7 +228,7 @@ def cachier(
backend = _default_params["backend"]
core: _BaseCore
if backend == "pickle":
core = _PickleCore( # pylint: disable=R0204
core = _PickleCore(
hash_func=hash_func,
pickle_reload=pickle_reload,
cache_dir=cache_dir,
Expand Down Expand Up @@ -260,7 +259,7 @@ def _cachier_decorator(func):
core.set_func(func)

@wraps(func)
def func_wrapper(*args, **kwds): # pylint: disable=C0111,R0911
def func_wrapper(*args, **kwds):
nonlocal allow_none
_allow_none = (
allow_none
Expand All @@ -284,7 +283,7 @@ def func_wrapper(*args, **kwds): # pylint: disable=C0111,R0911
key, entry = core.get_entry(tuple(), kwargs)
if overwrite_cache:
return _calc_entry(core, key, func, args, kwds)
if entry is not None: # pylint: disable=R0101
if entry is not None:
_print("Entry found.")
if _allow_none or entry.get("value", None) is not None:
_print("Cached result found.")
Expand Down
2 changes: 1 addition & 1 deletion cachier/cores/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self, hash_func, default_params):
self.cache = {}
self.lock = threading.RLock()

def get_entry_by_key(self, key, reload=False): # pylint: disable=W0221
def get_entry_by_key(self, key, reload=False):
with self.lock:
return key, self.cache.get(key, None)

Expand Down
2 changes: 1 addition & 1 deletion cachier/cores/pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def _save_cache(self, cache, key=None, hash=None):
if key is None:
self._reload_cache()

def get_entry_by_key(self, key, reload=False): # pylint: disable=W0221
def get_entry_by_key(self, key, reload=False):
with self.lock:
if self.separate_files:
return key, self._get_cache_by_key(key)
Expand Down
10 changes: 0 additions & 10 deletions tests/test_quality.py

This file was deleted.