Socket
Socket
Sign inDemoInstall

poetries

Package Overview
Dependencies
1
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    poetries

A thread safe implementation of a Trie.


Maintainers
1

Readme

Poe[Trie]s

Description

Poetries provides a thread-safe implementation of a Trie. While not limited, but the most common use case of a Trie is in implementing auto-completion. The collection type exposes APIs to perform the following operationsadd, find and get_all_words_with_prefix.

Dependencies

Python 3

Installation

pip install --upgrade poetries

Usage

from poetries.trie import Trie


trie = Trie()
trie.add('foobar')              # Adds 'foobar' to the trie
trie.find('foo')                # Returns False since the word is not present.
trie.add('bar')                 # Adds 'bar' to the trie
trie.find('bar')                # Returns True
trie.add('foob')                # Adds 'foob' to the trie
trie.add('foof')                # Adds 'foof' to the trie
arr = list(trie.prefix('foo'))  # Returns the list of words beginning with foo in a list form, ['foobar', 'foo', 'foob', 'foof']

License

MIT

Changelog

FAQs


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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc