Skip to content
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

Make the forced_update of @cached and @memoize accept the same parameters as the decorated function #115

Merged

Conversation

gergelypolonkai
Copy link
Collaborator

@gergelypolonkai gergelypolonkai commented May 25, 2019

Fixes #112

@coveralls
Copy link

coveralls commented May 25, 2019

Coverage Status

Coverage increased (+0.2%) to 78.914% when pulling eba5f72 on gergelypolonkai:forced-update-parameters into 6976799 on sh4nks:master.

"""Check if the function wants any arguments
"""

try:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Now that Python 2 is removed, I guess we can simplify this now?

@@ -390,7 +413,7 @@ def decorated_function(*args, **kwargs):
args, kwargs, use_request=True
)

if callable(forced_update) and forced_update() is True:
if callable(forced_update) and (forced_update(*args, **kwargs) if wants_args(forced_update) else forced_update()) is True:
Copy link
Collaborator

Choose a reason for hiding this comment

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

The line is a bit to long. I'd like to keep the line length to 80.

I am using black to keep my python files nicely formatted (we gotta add this to our not yet existing CONTRIBUTING file :P)

@gergelypolonkai
Copy link
Collaborator Author

I think i fixed everything we talked about. Also, finally we have a coverage increase! 😄

@pallets-eco pallets-eco deleted a comment from coveralls May 30, 2019
tests/test_memoize.py Outdated Show resolved Hide resolved
@gergelypolonkai gergelypolonkai merged commit b9a25b4 into pallets-eco:master Jun 2, 2019
@gergelypolonkai gergelypolonkai deleted the forced-update-parameters branch June 2, 2019 05:36
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

forced_update parameter of cached and memoized might receive the some parameters as the function
3 participants