from NiceTrie import *


class Trie(NiceTrie):
    def insert(self, string, index=None):
        super(Trie, self).insert(string + '\0', index)

    def search(self, string):
        return super(Trie, self).search(string + '\0')

    def present(self, string):
        return super(Trie, self).present(string + '\0')

    def match_prefix(self, prefix):
        node = self.root
        for ch in prefix:
            if node.children is None:
                return []
            list_node = node.children.search(ch)
            if list_node is None:
                return []
            node = list_node.value
        matches = []
        self.dump(node, prefix[:-1], matches)
        return matches

    def dump(self, node, prefix, my_list):
        if node.children is None:
            return my_list.append(prefix)
        prefix += node.ch
        for child in node.children:
            self.dump(child, prefix, my_list)

c650f15ed0d985869ed0b65c3ef6cb486970c2a2
<mask token>


class Trie(NiceTrie):

    def insert(self, string, index=None):
        super(Trie, self).insert(string + '\x00', index)

    def search(self, string):
        return super(Trie, self).search(string + '\x00')
    <mask token>
    <mask token>

    def dump(self, node, prefix, my_list):
        if node.children is None:
            return my_list.append(prefix)
        prefix += node.ch
        for child in node.children:
            self.dump(child, prefix, my_list)

<mask token>


class Trie(NiceTrie):

    def insert(self, string, index=None):
        super(Trie, self).insert(string + '\x00', index)

    def search(self, string):
        return super(Trie, self).search(string + '\x00')

    def present(self, string):
        return super(Trie, self).present(string + '\x00')
    <mask token>

    def dump(self, node, prefix, my_list):
        if node.children is None:
            return my_list.append(prefix)
        prefix += node.ch
        for child in node.children:
            self.dump(child, prefix, my_list)

<mask token>


class Trie(NiceTrie):

    def insert(self, string, index=None):
        super(Trie, self).insert(string + '\x00', index)

    def search(self, string):
        return super(Trie, self).search(string + '\x00')

    def present(self, string):
        return super(Trie, self).present(string + '\x00')

    def match_prefix(self, prefix):
        node = self.root
        for ch in prefix:
            if node.children is None:
                return []
            list_node = node.children.search(ch)
            if list_node is None:
                return []
            node = list_node.value
        matches = []
        self.dump(node, prefix[:-1], matches)
        return matches

    def dump(self, node, prefix, my_list):
        if node.children is None:
            return my_list.append(prefix)
        prefix += node.ch
        for child in node.children:
            self.dump(child, prefix, my_list)

from NiceTrie import *


class Trie(NiceTrie):

    def insert(self, string, index=None):
        super(Trie, self).insert(string + '\x00', index)

    def search(self, string):
        return super(Trie, self).search(string + '\x00')

    def present(self, string):
        return super(Trie, self).present(string + '\x00')

    def match_prefix(self, prefix):
        node = self.root
        for ch in prefix:
            if node.children is None:
                return []
            list_node = node.children.search(ch)
            if list_node is None:
                return []
            node = list_node.value
        matches = []
        self.dump(node, prefix[:-1], matches)
        return matches

    def dump(self, node, prefix, my_list):
        if node.children is None:
            return my_list.append(prefix)
        prefix += node.ch
        for child in node.children:
            self.dump(child, prefix, my_list)

from NiceTrie import *


class Trie(NiceTrie):
    def insert(self, string, index=None):
        super(Trie, self).insert(string + '\0', index)

    def search(self, string):
        return super(Trie, self).search(string + '\0')

    def present(self, string):
        return super(Trie, self).present(string + '\0')

    def match_prefix(self, prefix):
        node = self.root
        for ch in prefix:
            if node.children is None:
                return []
            list_node = node.children.search(ch)
            if list_node is None:
                return []
            node = list_node.value
        matches = []
        self.dump(node, prefix[:-1], matches)
        return matches

    def dump(self, node, prefix, my_list):
        if node.children is None:
            return my_list.append(prefix)
        prefix += node.ch
        for child in node.children:
            self.dump(child, prefix, my_list)
