Replace local cache dictionaries with functools.lru_cache#236
Closed
Replace local cache dictionaries with functools.lru_cache#236
Conversation
Contributor
|
Important Review skippedIgnore keyword(s) in the title. ⛔ Ignored keywords (2)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Comment |
Co-authored-by: MrIbrahem <26301308+MrIbrahem@users.noreply.github.com>
Collaborator
|
@copilot Replace all local cache (some of them has typo cash) dictionaries by functools cacheReplace all local cache dictionaries by functools lru_cache, You can also add functools lru_cache to some functions if it's will be helpful |
Co-authored-by: MrIbrahem <26301308+MrIbrahem@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Replace local cache dictionaries with functools lru_cache
Replace local cache dictionaries with functools.lru_cache
Dec 23, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Replaces manual dictionary-based caching patterns with
@lru_cachedecorators for cleaner, more efficient memoization.Changes
copy_text/text_bot.py,copy_to_en/medwiki.py,copy_to_en/mdwikicx.py:text_cache,revid_cache,un_wb_tag_cachedictionaries@lru_cache(maxsize=128)toget_text_revid()andget_un_wb_tag()get_un_wb_tag(x)to derivealltextfrom cachedget_text_revid(x)instead of taking it as a parameterwprefs/bots/replace_except.py:_regex_cachedictionary and_create_default_regexes()function_DEFAULT_REGEXES(static) and_SITE_SPECIFIC_PATTERNS(require site data)@lru_cacheto_tag_regex()and new_compile_site_regex()functionsNot Changed
z/z_api/api_wrap.py:logins_cacheis mutable state shared with externalLoginWrapAPI, not a pure function cacheExample
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.