Skip to content

Commit

Permalink
Try to fix Valentine's remarks ver.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ihorhalyskiy committed Dec 3, 2024
1 parent 8866462 commit f7828d6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
from typing import Callable
from typing import Callable, Any


def cache(func: Callable) -> Callable:
cached_data = {}

def wrapper(*args) -> Callable:

def wrapper(*args) -> Any:
if args in cached_data:
print("Getting from cache")
return cached_data[args]

else:
print("Calculating new result")
cached_data[args] = func(*args)
return cached_data[args]
return cached_data[args]

return wrapper

0 comments on commit f7828d6

Please sign in to comment.