<commit_before># !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
===Description===
Module for configuring handlers.
Every handler converts its input to self.data

Kindle - from Kindle db.
Text - from txt file.
Input - from manual input
"""

import sqlite3


class Base(object):
    """
    Base class for all handlers.
    """
    data = []
    context = []

    def __init__(self, source):
        self.source = source
        self.data = []

    def get(self):
        return self.data

    def read(self):
        raise NotImplementedError('Not implemented yet')


class Kindle(Base):
    """
    Handler of Kindle's database
    """

    def read(self, only_new_words=False):
        """
        Reading data from database.
        All words - category = 100.
        New words - category = 0.
        """
        super(Kindle, self).read()
        conn = sqlite3.connect(self.source)
        command = None
        if only_new_words:
            command = "SELECT WORDS.stem, LOOKUPS.usage \
                        FROM WORDS INNER JOIN LOOKUPS ON \<commit_msg>Removed unneeded 'super'<commit_after># !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
===Description===
Module for configuring handlers.
Every handler converts its input to self.data

Kindle - from Kindle db.
Text - from txt file.
Input - from manual input
"""

import sqlite3


class Base(object):
    """
    Base class for all handlers.
    """
    data = []
    context = []

    def __init__(self, source):
        self.source = source
        self.data = []

    def get(self):
        return self.data

    def read(self):
        raise NotImplementedError('Not implemented yet')


class Kindle(Base):
    """
    Handler of Kindle's database
    """

    def read(self, only_new_words=False):
        """
        Reading data from database.
        All words - category = 100.
        New words - category = 0.
        """
        conn = sqlite3.connect(self.source)
        command = None
        if only_new_words:
            command = "SELECT WORDS.stem, LOOKUPS.usage \
                        FROM WORDS INNER JOIN LOOKUPS ON \
{'fraction_non_alphanumeric': 0.11268939393939394, 'fraction_numerical': 0.006628787878787879, 'mean_word_length': 2.0272206303724927, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7157974', 'n_tokens_mistral': 649, 'n_tokens_neox': 596, 'n_words': 190}