<commit_before>import sys

from tambo import Transport
from merfi import logger
from merfi import backends
import merfi
from merfi.decorators import catches


class Merfi(object):
    _help = """
merfi: A utility to find Release files and sign them with a given backend
signature engine like rpm-sign or gpg.

Version: %s

Global Options:
--log, --logging    Set the level of logging. Acceptable values:
                    debug, warning, error, critical

Sub Commands:
rpm-sign            Uses the `rpm-sign` utility to sign files
gpg                 Uses `gpg` to sign files

    """

    mapper = {
        'rpm-sign': backends.rpm_sign.RpmSign,
        'gpg': backends.gpg.Gpg
    }

    def __init__(self, argv=None, parse=True):
        self.plugin_help = "No plugins found/loaded"
        if argv is None:
            argv = sys.argv
        if parse:
            self.main(argv)

    def help(self):
        return self._help % (merfi.__version__)

    @catches(KeyboardInterrupt)
    def main(self, argv):
        options = [['--log', '--logging']]
        parser = Transport(argv, mapper=self.mapper,
                           options=options, check_help=False,
                           check_version=False)
        parser.parse_args()
        merfi.config['verbosity'] = parser.get('--log', 'info')
        parser.catch_help = self.help()
        parser.catch_version = merfi.__version__
        parser.mapper = self.mapper
        if len(argv) <= 1:
            return parser.print_help()
        parser.dispatch()
        parser.catches_help()
        parser.catches_version()
<commit_msg>add check mode that pretends to do stuff<commit_after>import sys

from tambo import Transport
from merfi import logger
from merfi import backends
import merfi
from merfi.decorators import catches


class Merfi(object):
    _help = """
merfi: A utility to find Release files and sign them with a given backend
signature engine like rpm-sign or gpg.

Version: %s

Global Options:
--log, --logging    Set the level of logging. Acceptable values:
                    debug, warning, error, critical
--check             Don't perform any actions, attempt to determine what would
                    happen and spit output as similar as possible

Sub Commands:
rpm-sign            Uses the `rpm-sign` utility to sign files
gpg                 Uses `gpg` to sign files

    """

    mapper = {
        'rpm-sign': backends.rpm_sign.RpmSign,
        'gpg': backends.gpg.Gpg
    }

    def __init__(self, argv=None, parse=True):
        self.plugin_help = "No plugins found/loaded"
        if argv is None:
            argv = sys.argv
        if parse:
            self.main(argv)

    def help(self):
        return self._help % (merfi.__version__)

    @catches((RuntimeError, KeyboardInterrupt))
    def main(self, argv):
        options = [['--log', '--logging']]
        parser = Transport(argv, mapper=self.mapper,
                           options=options, check_help=False,
                           check_version=False)
        parser.parse_args()
        merfi.config['verbosity'] = parser.get('--log', 'info')
        merfi.config['check'] = parser.has('--check')
        parser.catch_help = self.help()
        parser.catch_version = merfi.__version__
        parser.mapper = self.mapper
        if len(argv) <= 1:
            return parser.print_help()
        parser.dispatch()
        parser.catches_help()
        parser.catches_version()

{'fraction_non_alphanumeric': 0.09785755645628257, 'fraction_numerical': 0.0005790387955993051, 'mean_word_length': 2.1523722627737225, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5645125', 'n_tokens_mistral': 1006, 'n_tokens_neox': 976, 'n_words': 296}