<commit_before><commit_msg>Restored missing plugin for tests<commit_after>import logging
from flexget.feed import Entry
from flexget.plugin import *

log = logging.getLogger('input_mock')

class InputMock:
    """
        Allows adding mock input entries. Example:
        
        input_mock:
          - {title: foobar, url: http://some.com }
          - {title: mock, url: http://another.com }
    """
    def validator(self):
        from flexget import validator
        container = validator.factory('list')
        entry = container.accept('dict')
        entry.accept('url', key='url')
        entry.accept('text', key='title', required=True)
        entry.accept_any_key('text')
        entry.accept_any_key('number')
        return container

    def on_feed_input(self, feed):
        config = feed.config.get('input_mock', [])
        for line in config:
            entry = Entry()
            for k,v in line.iteritems():
                entry[k] = v
            # no url specified, add random one (ie. test)
            if not 'url' in entry:
                import string
                import random
                entry['url'] = 'http://localhost/mock/%s' % ''.join([random.choice(string.letters+string.digits) for x in range(1, 30)])
            feed.entries.append(entry)

register_plugin(InputMock, 'input_mock', debug=True)
{'fraction_non_alphanumeric': 0.12249443207126949, 'fraction_numerical': 0.0022271714922048997, 'mean_word_length': 2.2481927710843372, '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': '1437804', 'n_tokens_mistral': 386, 'n_tokens_neox': 375, 'n_words': 97}