<commit_before>#
# Copyright (c) 2010 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
# along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
#
# Red Hat trademarks are not licensed under GPLv2. No permission is
# granted to use or replicate Red Hat trademarks that are incorporated
# in this software or its documentation.
#

"""
Demo plugin.
"""
import os
from gofer import Plugin
from gofer.decorators import *
from gofer.messaging.decorators import Remote
from gofer.collator import Collator
from gofer.agent.action import Actions
from gofer.agent.config import Config
from logging import getLogger

log = getLogger(__name__)


class TestAction:

    @action(minutes=10)
    def hello(self):
        cfg = Plugin.cfg(__name__)
        log.info('Hello:\n%s', cfg)


class AgentAdmin:

    @remote
    def hello(self):
        s = []
        cfg = Config()
        s.append('Hello, I am gofer agent "%s"' % cfg.main.uuid)
        s.append('Here is my configuration:\n%s' % cfg)
        s.append('Status: ready')
        return '\n'.join(s)
    
    @remote
    def help(self):
        s = []
        s.append('Plugins:')
        for p in Plugin.descriptor.keys():
            s.append('  %s' % p)
        s.append('Actions:')
        for a in self.__actions():
            s.append('  %s %s' % a)
        methods, functions = self.__remote()
        s.append('Methods:')
        for m in methods:
            s.append('  %s.%s()' % m)
        s.append('Functions:')
        for m in functions:
            s.append('  %s.%s()' % m)
        return '\n'.join(s)
    
    def __actions(self):
        actions = []<commit_msg>Rename builtin AgentAdmin to just Admin.<commit_after>#
# Copyright (c) 2010 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
# along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
#
# Red Hat trademarks are not licensed under GPLv2. No permission is
# granted to use or replicate Red Hat trademarks that are incorporated
# in this software or its documentation.
#

"""
Demo plugin.
"""
import os
from gofer import Plugin
from gofer.decorators import *
from gofer.messaging.decorators import Remote
from gofer.collator import Collator
from gofer.agent.action import Actions
from gofer.agent.config import Config
from logging import getLogger

log = getLogger(__name__)


class TestAction:

    @action(minutes=10)
    def hello(self):
        cfg = Plugin.cfg(__name__)
        log.info('Hello:\n%s', cfg)


class Admin:

    @remote
    def hello(self):
        s = []
        cfg = Config()
        s.append('Hello, I am gofer agent "%s"' % cfg.main.uuid)
        s.append('Here is my configuration:\n%s' % cfg)
        s.append('Status: ready')
        return '\n'.join(s)
    
    @remote
    def help(self):
        s = []
        s.append('Plugins:')
        for p in Plugin.descriptor.keys():
            s.append('  %s' % p)
        s.append('Actions:')
        for a in self.__actions():
            s.append('  %s %s' % a)
        methods, functions = self.__remote()
        s.append('Methods:')
        for m in methods:
            s.append('  %s.%s()' % m)
        s.append('Functions:')
        for m in functions:
            s.append('  %s.%s()' % m)
        return '\n'.join(s)
    
    def __actions(self):
        actions = []
{'fraction_non_alphanumeric': 0.11677887105126877, 'fraction_numerical': 0.006214396685655101, 'mean_word_length': 2.5472910927456383, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '5794856', 'n_tokens_mistral': 1202, 'n_tokens_neox': 1143, 'n_words': 403}