mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-08-29 18:36:07 +00:00
fixup typing for @diskcache [pr] (#10529)
This commit is contained in:
+2
-2
@@ -220,8 +220,8 @@ def diskcache_put(table:str, key:Union[dict, str, int], val:Any, prepickled=Fals
|
||||
cur.close()
|
||||
return val
|
||||
|
||||
def diskcache(func):
|
||||
def wrapper(*args, **kwargs) -> bytes:
|
||||
def diskcache(func:Callable[..., T]):
|
||||
def wrapper(*args, **kwargs) -> T:
|
||||
table, key = f"cache_{func.__name__}", hashlib.sha256(pickle.dumps((args, kwargs))).hexdigest()
|
||||
if (ret:=diskcache_get(table, key)) is not None: return ret
|
||||
return diskcache_put(table, key, func(*args, **kwargs))
|
||||
|
||||
Reference in New Issue
Block a user