
Product
Introducing Module Reachability: Focus on the Vulnerabilities That Matter
Module Reachability filters out unreachable CVEs so you can focus on vulnerabilities that actually matter to your application.
A fast and efficient trie-based collection for storing and searching millions of strings.
A fast and efficient trie-based set for storing and searching millions of short strings.
pip install fast_trie_set
from fast_trie import TRIE
# Initialize the Trie with a list of words
trie = TRIE(['hello', 'world', '!', ',', 'hen', 'hell'], case_insensitive=True)
# Add a word
trie.add('Help')
# Extend trie with a list of words
trie.extend(['HeLLo', 'WoRlD'])
# Check if a word exists
print('hello' in trie) # True
print('unknown' not in trie) # True
# Find index of a word
print(trie.find('hell')) # Index of 'hell'
# Match words with a given prefix
print(list(trie.prefix_match('he'))) # ['hello', 'hen', 'hell', 'help']
# Delete a word
trie.delete('hell')
print(list(trie)) # ['hello', 'world', '!', ',', 'hen', 'help']
# Export the trie to a JSON file
trie.export("trie.json")
# Import a trie from a JSON file
imported_trie = TRIE.import_trie("trie.json", case_insensitive=True)
print(list(imported_trie)) # ['hello', 'world', '!', ',', 'hen', 'help']
MIT License. See LICENSE file for more details.
FAQs
A fast and efficient trie-based collection for storing and searching millions of strings.
We found that fast-trie-set demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Module Reachability filters out unreachable CVEs so you can focus on vulnerabilities that actually matter to your application.
Company News
Socket is bringing best-in-class reachability analysis into the platform — cutting false positives, accelerating triage, and cementing our place as the leader in software supply chain security.
Product
Socket is introducing a new way to organize repositories and apply repository-specific security policies.