Repository navigation
Update cachetools to 5.0.0 #7455
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e66b742
Update cachetools to 5.0.0
Akuli 6cc651b
syntax error
Akuli 8dca588
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 68d8d7b
stubtest fixes
Akuli cb3a90e
Merge branch 'cachetools' of https://github.com/Akuli/typeshed into c…
Akuli 5ae63cc
tiny rearranging
Akuli 1d6a9ee
return _Timer
Akuli 5eff2d0
Update stubs/cachetools/cachetools/__init__.pyi
Akuli 1f6b48a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,22 @@ | ||
| cachetools.Cache.get | ||
| cachetools.cache.Cache.get | ||
|
|
||
| # it looks like cachetools stubs are really out of date, so none of the modules | ||
| # referenced exist anymore | ||
| cachetools\..*\.__(get|set|del)item__ # has extra argument | ||
| cachetools\..*TTLCache.__repr__ | ||
| # stubs omit defaulted arguments that are meant to be optimizations, not provided by user | ||
| cachetools.FIFOCache.__delitem__ | ||
| cachetools.FIFOCache.__setitem__ | ||
| cachetools.LFUCache.__delitem__ | ||
| cachetools.LFUCache.__getitem__ | ||
| cachetools.LFUCache.__setitem__ | ||
| cachetools.LRUCache.__delitem__ | ||
| cachetools.LRUCache.__getitem__ | ||
| cachetools.LRUCache.__setitem__ | ||
| cachetools.MRUCache.__delitem__ | ||
| cachetools.MRUCache.__getitem__ | ||
| cachetools.MRUCache.__setitem__ | ||
| cachetools.TLRUCache.__delitem__ | ||
| cachetools.TLRUCache.__getitem__ | ||
| cachetools.TLRUCache.__setitem__ | ||
| cachetools.TTLCache.__delitem__ | ||
| cachetools.TTLCache.__getitem__ | ||
| cachetools.TTLCache.__setitem__ | ||
| cachetools._TimedCache.__len__ | ||
| cachetools._TimedCache.__repr__ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| version = "4.2.*" | ||
| version = "5.0.*" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| from typing import Hashable | ||
|
|
||
| __all__ = ("hashkey", "typedkey") | ||
|
|
||
| def hashkey(*args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ... | ||
| def typedkey(*args: Hashable, **kwargs: Hashable) -> tuple[Hashable, ...]: ... |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Does it hurt that much to include the weird extra arguments in these signatures? I worry that if we allowlist all these functions, stubtest won't warn us if there are any other problems with any of them
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.
None of these allowlistings correspond with a
defstatement in the stubs. They are all inherited from other classes that don't have the extra arguments. So if we define something incorrectly in the stubs, we'll get a new stubtest error that points at the definition.Uh oh!
There was an error while loading. Please reload this page.
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.
And after thinking about this a bit more: Including the weird extra arguments also would mean including a new method definition for each of the lines I allowlisted. That would clutter the stubs and not help users in any way. CI checks should catch problems, not force you to do something weird and unnecessary IMO.
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.
Okay, sounds good! Will try to do a full review of the rest of the PR soon.
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.
Side point: I'm amazed a library that's concerned with such micro-optimisations is also using
functools.total_orderingin the same module.