<commit_before># -*- coding: utf-8 -*-
""" A fedmsg consumer that listens to FAS messages to run fasclient via Ansible

Authors:    <NAME> <<EMAIL>>
            <NAME> <<EMAIL>>
            <NAME> <<EMAIL>>

"""

import pprint
import subprocess
import fedmsg.consumers
import moksha.hub.reactor


class FasClientConsumer(fedmsg.consumers.FedmsgConsumer):

    # Because we are interested in a variety of topics, we tell moksha that
    # we're interested in all of them (it doesn't know how to do complicated
    # distinctions).  But then we'll filter later in our consume() method.
    topic = '*'
    interesting_topics = [
        'org.fedoraproject.prod.fas.group.member.sponsor',
        'org.fedoraproject.prod.fas.group.member.remove',
        'org.fedoraproject.prod.fas.user.update',
    ]

    config_key = 'fasclient.consumer.enabled'

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

        # This is required.  It is the number of seconds that we should wait
        # until we ultimately act on a pkgdb message.
        self.delay = self.hub.config['fasclient.consumer.delay']

        # This is the serial that is passed onto ansible specifying how many
        # hosts to run at the same time.
        self.serial = self.hub.config.get('fasclient.consumer.serial', 3)

        # We use this to manage our state
        self.queued_messages = []

    def consume(self, msg):
        if msg['topic'] not in self.interesting_topics:
            return

        # Only run fasclient if the user changed his/her ssh key in FAS
        if msg['topic'] == 'org.fedoraproject.prod.fas.user.update':
            if 'ssh_key' not in msg['msg']['fields']:
                return<commit_msg>Fix the inheritance to use the proper class name<commit_after># -*- coding: utf-8 -*-
""" A fedmsg consumer that listens to FAS messages to run fasclient via Ansible

Authors:    <NAME> <<EMAIL>>
            <NAME> <<EMAIL>>
            <NAME> <<EMAIL>>

"""

import pprint
import subprocess
import fedmsg.consumers
import moksha.hub.reactor


class FasClientConsumer(fedmsg.consumers.FedmsgConsumer):

    # Because we are interested in a variety of topics, we tell moksha that
    # we're interested in all of them (it doesn't know how to do complicated
    # distinctions).  But then we'll filter later in our consume() method.
    topic = '*'
    interesting_topics = [
        'org.fedoraproject.prod.fas.group.member.sponsor',
        'org.fedoraproject.prod.fas.group.member.remove',
        'org.fedoraproject.prod.fas.user.update',
    ]

    config_key = 'fasclient.consumer.enabled'

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

        # This is required.  It is the number of seconds that we should wait
        # until we ultimately act on a pkgdb message.
        self.delay = self.hub.config['fasclient.consumer.delay']

        # This is the serial that is passed onto ansible specifying how many
        # hosts to run at the same time.
        self.serial = self.hub.config.get('fasclient.consumer.serial', 3)

        # We use this to manage our state
        self.queued_messages = []

    def consume(self, msg):
        if msg['topic'] not in self.interesting_topics:
            return

        # Only run fasclient if the user changed his/her ssh key in FAS
        if msg['topic'] == 'org.fedoraproject.prod.fas.user.update':
            if 'ssh_key' not in msg['msg']['fields']:
                return
{'fraction_non_alphanumeric': 0.10128755364806867, 'fraction_numerical': 0.0011444921316165952, 'mean_word_length': 2.6153050672182006, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '1832334', 'n_tokens_mistral': 1073, 'n_tokens_neox': 1025, 'n_words': 335}