-
Notifications
You must be signed in to change notification settings - Fork 157
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
Simplify cache namespace and key encoding logic for v1 #670
Simplify cache namespace and key encoding logic for v1 #670
Conversation
Replace lambda function with member function for self._build_key fallback Allows using 'namespace' as named parameter, as expected
Documenting for posterity how this test could have been clearer for previously expected functionality.
Tests now defines this functionality in tests/utils.py
Codecov Report
@@ Coverage Diff @@
## master #670 +/- ##
=======================================
Coverage 99.67% 99.67%
=======================================
Files 35 35
Lines 3743 3747 +4
=======================================
+ Hits 3731 3735 +4
Misses 12 12
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Would also be nice to add type annotations to the methods that have been edited/added (and the key_builder parameter), to get some movement in that direction. |
Sure. That should be a simple improvement. |
Co-authored-by: Sam Bull <[email protected]>
Include type annotations in updated functions.
I added the changes we discussed, and started on the type annotations. I could continue adding type annotations in these files, but would like to get your feedback before proceeding further. |
Let's keep the changes to a minimum for this PR, further type annotations can be done in another PR. However, I suspect that completing some of the 1.0 refactoring tasks first will make it easier. |
Yeah, I agree. |
It looks like the codecov fails are limited to the "if TYPE_CHECKING" conditional imports. |
#677 as well. Should be easier to get some typing working then. |
What do these changes do?
build_key()
member ofBaseCache
and its backend subclasses.key_builder
for a cache.Are there changes in behavior for the user?
key_builder
argument...namespace
argument passed to your customkey_builder
has already been resolved by the cache: It will be the namespace that was explicitly requested by a client (if requested); otherwise it will be the default namespace that was used to instantiate the cache._build_key()
member of a cache, replace those calls withbuild_key()
.Related issue number
Resolves issue #669.
Checklist
CHANGES
folder<issue_id>.<type>
(e.g.588.bugfix
)issue_id
change it to the pr id after creating the PR.feature
: Signifying a new feature..bugfix
: Signifying a bug fix..doc
: Signifying a documentation improvement..removal
: Signifying a deprecation or removal of public API..misc
: A ticket has been closed, but it is not of interest to users.Fix issue with non-ascii contents in doctest text files.