<commit_before># -*- coding: utf-8 -*-
""" Fedmsg consumers that listen to `anitya <http://release-monitoring.org>`_.

Authors:    <NAME> <<EMAIL>>

"""

import socket

import bugzilla

import fedmsg
import fedmsg.consumers


class BugzillaTicketFiler(fedmsg.consumers.Consumer):
    topic = 'org.release-monitoring.prod.anitya.*'
    config_key = 'the_new_hotness.bugzilla.enabled'

    def __init__(self, hub):
        super(BugzillaTicketFiler, self).__init__(hub)

        # First, initialize fedmsg and bugzilla in this thread's context.
        hostname = socket.gethostname().split('.', 1)[0]
        fedmsg.init(name='hotness.%s' % hostname)

        default = 'https://partner-bugzilla.redhat.com'
        url = self.config.get('bugzilla.url', default)
        username = self.config['bugzilla.username']
        password = self.config['bugzilla.password']
        self.bugzilla = bugzilla.Bugzilla(url=url)
        self.log.info("Logging in to %s" % url)
        self.bugzilla.login(username, password)

        self.log.info("Initialized that new hotness.")

    def consume(self, msg):
        topic, msg = msg['topic'], msg['body']
        # TODO - file a bug and publish a fedmsg saying that we did so or
        # failed to do so.<commit_msg>Various bits to get this working.<commit_after># -*- coding: utf-8 -*-
""" Fedmsg consumers that listen to `anitya <http://release-monitoring.org>`_.

Authors:    <NAME> <<EMAIL>>

"""

import socket

import bugzilla

import fedmsg
import fedmsg.consumers


class BugzillaTicketFiler(fedmsg.consumers.FedmsgConsumer):
    topic = 'org.release-monitoring.prod.anitya.*'
    config_key = 'hotness.bugzilla.enabled'

    def __init__(self, hub):
        super(BugzillaTicketFiler, self).__init__(hub)

        if not self._initialized:
            return

        # This is just convenient.
        self.config = self.hub.config

        # First, initialize fedmsg and bugzilla in this thread's context.
        hostname = socket.gethostname().split('.', 1)[0]
        fedmsg.init(name='hotness.%s' % hostname)

        default = 'https://partner-bugzilla.redhat.com'
        url = self.config.get('bugzilla.url', default)
        username = self.config['bugzilla.username']
        password = self.<PASSWORD>['<PASSWORD>']
        self.bugzilla = bugzilla.Bugzilla(url=url)
        self.log.info("Logging in to %s" % url)
        self.bugzilla.login(username, password)

        self.log.info("That new hotness ticket filer is all initialized")

    def consume(self, msg):
        topic, msg = msg['topic'], msg['body']
        # TODO - file a bug and publish a fedmsg saying that we did so or
        # failed to do so.
{'fraction_non_alphanumeric': 0.1296711509715994, 'fraction_numerical': 0.002242152466367713, 'mean_word_length': 2.890988372093023, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 2, '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': '1634095', 'n_tokens_mistral': 863, 'n_tokens_neox': 809, 'n_words': 204}