<commit_before># -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license*.
from superdesk.io.registry import register_feed_parser, register_feeding_service_parser
from superdesk.io.feeding_services.file_service import FileFeedingService
from .text_file import TextFileParser
from superdesk.errors import AlreadyExistsError
import time


class TickerFileParser(TextFileParser):
    """
    A simple parser for ticker files, the headline gives an indication it is an AAP ticker story. The body of the
    story is the content for the ticker.
    """

    NAME = 'AAP Ticker File'

    def parse(self, filename, provider=None):
        item = super().parse(filename, provider)
        item['headline'] = 'AAP Ticker on {}'.format(time.strftime("%A %H:%M:%S", time.localtime()))
        return item

    def post_process_item(self, item):
        item['headline'] = item['headline'][:40]
        return item


try:
    register_feed_parser(TickerFileParser.NAME, TickerFileParser())
except AlreadyExistsError as ex:
    pass
register_feeding_service_parser(FileFeedingService.NAME, TickerFileParser.NAME)<commit_msg>(fix) Fixing the ticker parser registry.<commit_after># -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license*.
from superdesk.io.registry import register_feed_parser
from .text_file import TextFileParser
from superdesk.errors import AlreadyExistsError
import time


class TickerFileParser(TextFileParser):
    """
    A simple parser for ticker files, the headline gives an indication it is an AAP ticker story. The body of the
    story is the content for the ticker.
    """

    NAME = 'AAP Ticker File'

    def parse(self, filename, provider=None):
        item = super().parse(filename, provider)
        item['headline'] = 'AAP Ticker on {}'.format(time.strftime("%A %H:%M:%S", time.localtime()))
        return item

    def post_process_item(self, item):
        item['headline'] = item['headline'][:40]
        return item


try:
    register_feed_parser(TickerFileParser.NAME, TickerFileParser())
except AlreadyExistsError as ex:
    pass
{'fraction_non_alphanumeric': 0.09836065573770492, 'fraction_numerical': 0.00858704137392662, 'mean_word_length': 4.095427435387674, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '6709357', 'n_tokens_mistral': 773, 'n_tokens_neox': 726, 'n_words': 245}