Skip to content
Open
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
17 changes: 14 additions & 3 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
from typing import Callable
from typing import Callable, Any


def cache(func: Callable) -> Callable:
# Write your code here
pass
storage = {}

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

print("Calculating new result")
result = func(*args)
storage[args] = result
return result

return wrapper
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The repository previously reported flake8 W292 (no newline at end of file) for app/main.py. The file still appears to end without a trailing newline. Please add a newline after the last line (return wrapper) so there's exactly one blank line at the end of the file, then save, commit, and push.

Loading