<commit_before>"""Handle invoking Conan from the command line."""

from __future__ import absolute_import
import argparse
import logging
import os

from conan.anonymize_files import anonymize_files_in_dir


def main():
    """Conan tool entry point."""
    parser = argparse.ArgumentParser()
    parser.add_argument('-i', '--inputdirectory',
                        help='Directory containing configurtions to anonymize',
                        default='./configs/')
    parser.add_argument('-o', '--outputdirectory',
                        help='Directory to place anonymized configs',
                        default='./anon_configs/')
    parser.add_argument('-p', '--anonymizepwdandcomm',
                        help='Remove password and snmp community lines',
                        action='store_true', default=False)
    parser.add_argument('-a', '--anonymizeipaddr',
                        help='Anonymize IP addresses',
                        action='store_true', default=False)
    parser.add_argument('-s', '--salt',
                        help='Salt for IP and sensitive keyword anonymization',
                        default=None)
    parser.add_argument('-d', '--dumpipaddrmap',
                        help='Dump IP address anonymization map to specified file',
                        default=None)
    parser.add_argument('-u', '--undoanonymizeipaddr',
                        help='Undo IP address anonymization (must specify salt)',
                        action='store_true', default=False)
    parser.add_argument('--sensitivewords', help='Comma separated list of '
                        'keywords to anonymize', default=None)
    loglevel_choices = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']
    parser.add_argument('-l', '--loglevel',
                        help='Determines what level of logs to display',
                        choices=loglevel_choices, default='INFO')
    options = parser.parse_args()
    input_dir = options.inputdirectory
    output_dir = options.outputdirectory

    loglevel = logging.getLevelName(options.loglevel)
    logging.basicConfig(format='%(levelname)s %(message)s', level=loglevel)

    if not os.path.exists(output_dir):
        os.makedirs(output_dir)

    sensitive_words = None
    if options.sensitivewords is not None:<commit_msg>Allow passing args into main manually (#33)<commit_after>"""Handle invoking Conan from the command line."""

from __future__ import absolute_import
import argparse
import logging
import os

from conan.anonymize_files import anonymize_files_in_dir


def main(args=None):
    """Conan tool entry point."""
    parser = argparse.ArgumentParser()
    parser.add_argument('-i', '--inputdirectory',
                        help='Directory containing configurtions to anonymize',
                        default='./configs/')
    parser.add_argument('-o', '--outputdirectory',
                        help='Directory to place anonymized configs',
                        default='./anon_configs/')
    parser.add_argument('-p', '--anonymizepwdandcomm',
                        help='Remove password and snmp community lines',
                        action='store_true', default=False)
    parser.add_argument('-a', '--anonymizeipaddr',
                        help='Anonymize IP addresses',
                        action='store_true', default=False)
    parser.add_argument('-s', '--salt',
                        help='Salt for IP and sensitive keyword anonymization',
                        default=None)
    parser.add_argument('-d', '--dumpipaddrmap',
                        help='Dump IP address anonymization map to specified file',
                        default=None)
    parser.add_argument('-u', '--undoanonymizeipaddr',
                        help='Undo IP address anonymization (must specify salt)',
                        action='store_true', default=False)
    parser.add_argument('--sensitivewords', help='Comma separated list of '
                        'keywords to anonymize', default=None)
    loglevel_choices = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']
    parser.add_argument('-l', '--loglevel',
                        help='Determines what level of logs to display',
                        choices=loglevel_choices, default='INFO')
    options = parser.parse_args(args)
    input_dir = options.inputdirectory
    output_dir = options.outputdirectory

    loglevel = logging.getLevelName(options.loglevel)
    logging.basicConfig(format='%(levelname)s %(message)s', level=loglevel)

    if not os.path.exists(output_dir):
        os.makedirs(output_dir)

    sensitive_words = None
    if options.sensitivewords is not None:
{'fraction_non_alphanumeric': 0.11175337186897881, 'fraction_numerical': 0.00042817383857846286, 'mean_word_length': 2.287825475017593, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4366761', 'n_tokens_mistral': 1251, 'n_tokens_neox': 1177, 'n_words': 289}