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

GitAuto: Depreciation warning from marisa_trie #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gitauto-ai[bot]
Copy link

@gitauto-ai gitauto-ai bot commented Dec 20, 2024

Resolves #1

Why the bug occurs

The marisa_trie library has deprecated the Trie.has_keys_with_prefix method, which will be removed in marisa_trie version 0.8.0. This deprecation causes a DeprecationWarning when the method is used in the current codebase.

How to reproduce

Run the application using the Trie.has_keys_with_prefix method. This will trigger the following warning:

/home/miniconda3/envs/db-manage/lib/python3.6/site-packages/trie_search/trie.py:44: DeprecationWarning: Trie.has_keys_with_prefix is deprecated and will be removed in marisa_trie 0.8.0. Please use Trie.iterkeys instead.

How to fix

Update the trie_search/trie.py file by replacing Trie.has_keys_with_prefix with Trie.iterkeys. This change will eliminate the deprecation warning and ensure compatibility with future versions of marisa_trie.

# Before
if trie.has_keys_with_prefix(prefix):
    # existing logic

# After
if any(trie.iterkeys(prefix)):
    # existing logic

Test these changes locally

git checkout -b gitauto/issue-1-20241220-000421
git pull origin gitauto/issue-1-20241220-000421

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Depreciation warning from marisa_trie
0 participants