-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add solution #765
Add solution #765
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several changes were requested.
app/main.py
Outdated
pass | ||
cache_memory = {} | ||
|
||
def wrapper(*args) -> dict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change your return type annotation for wrapper
, it could return Any
because the function output is not known in advance.
app/main.py
Outdated
pass | ||
cache_memory = {} | ||
|
||
def wrapper(*args) -> dict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using a decorator for wrapper
from functools
to preserve the wrapped function naming and docstring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several changes were requested.
app/main.py
Outdated
@@ -1,6 +1,17 @@ | |||
from typing import Callable | |||
from typing import Callable, Any | |||
import functools |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import
should precede from ... import
, place your import in the right order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Place your imports in the right order according to the previous comment.
app/main.py
Outdated
|
||
|
||
def cache(func: Callable) -> Callable: | ||
# Write your code here | ||
pass | ||
functools.wraps(func) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Place a wraps
decorator at the right place as provided in the documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several minor changes were requested.
app/main.py
Outdated
@@ -1,6 +1,17 @@ | |||
from typing import Callable | |||
from typing import Callable, Any | |||
import functools |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Place your imports in the right order according to the previous comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job!
No description provided.