# Path: zdict/models.py
# class Record(peewee.Model):
#     class Meta:


from zdict.models import Record, db


class DictCompleter:
    def __init__(self):
        self.db = db
        self.db.connection()

    def __del__(self):
        self.db.close()

    def complete(self, text, state):
        if state == 0:  # new query
            self.records = iter(

# Path: zdict/models.py
# class Record(peewee.Model):
#     class Meta:


# Path: zdict/completer.py
from zdict.models import Record, db



class DictCompleter:
    def __init__(self):
        self.db = db
        self.db.connection()

    def __del__(self):
        self.db.close()

    def complete(self, text, state):
        if state == 0:  # new query
            self.records = iter(

                Record.select().where(Record.word.startswith(text)))