<commit_before>#!/usr/bin/env python3
"""Cassandra model coupling framework

  usage:  cassandra_main.py <configfile>

  This program will run the cassandra model coupling system using the
  configuration details from the configuration file supplied on the
  command line.  The configuration file format and contents are
  described in the Cassandra Users' Guide.

"""

import sys
import re
import threading
import argparse
import logging


def bootstrap_sp(argvals):
    """
    Bootstrap the multithreaded (single processing) version of the
    calculation.

    :param argvals: Command line arguments parsed by argparse.
    :return: (component-list, capability-table)
    """

    from configobj import ConfigObj
    from cassandra import __version__
    from cassandra.compfactory import create_component

    # Configure logger
    if argvals.logdir is None:
        logging.basicConfig(stream=sys.stdout, level=argvals.loglvl)
        logging.info(f'This is Cassandra version {__version__}.')
    else:
        logging.basicConfig(filename=f'{argvals.logdir}/cassandra.log',
                            level=argvals.loglvl, filemode='w')
        # Write to screen the location of the logging output
        print(f'This is Cassandra version {__version__}.  Output will be logged to {argvals.logdir}/cassandra.log')

    cfgfile_name = argvals.ctlfile

    # initialize the structures that will receive the data we are
    # parsing from the file
    capability_table = {}
    component_list = []

    # cfgfile_name is a filename
    config = ConfigObj(cfgfile_name)<commit_msg>Create logdir (if necessary) in all cases of logging to disk file.<commit_after>#!/usr/bin/env python3
"""Cassandra model coupling framework

  usage:  cassandra_main.py <configfile>

  This program will run the cassandra model coupling system using the
  configuration details from the configuration file supplied on the
  command line.  The configuration file format and contents are
  described in the Cassandra Users' Guide.

"""

import sys
import re
import threading
import argparse
import logging
import os


def bootstrap_sp(argvals):
    """
    Bootstrap the multithreaded (single processing) version of the
    calculation.

    :param argvals: Command line arguments parsed by argparse.
    :return: (component-list, capability-table)
    """

    from configobj import ConfigObj
    from cassandra import __version__
    from cassandra.compfactory import create_component

    # Configure logger
    if argvals.logdir is None:
        logging.basicConfig(stream=sys.stdout, level=argvals.loglvl)
        logging.info(f'This is Cassandra version {__version__}.')
    else:
        os.makedirs(argvals.logdir, exist_ok=True)
        logging.basicConfig(filename=f'{argvals.logdir}/cassandra.log',
                            level=argvals.loglvl, filemode='w')
        # Write to screen the location of the logging output
        print(f'This is Cassandra version {__version__}.  Output will be logged to {argvals.logdir}/cassandra.log')

    cfgfile_name = argvals.ctlfile

    # initialize the structures that will receive the data we are
    # parsing from the file
    capability_table = {}
    component_list = []

    # cfgfile_name is a filename
    config = ConfigObj(cfgfile_name)
{'fraction_non_alphanumeric': 0.06908094948265368, 'fraction_numerical': 0.0006086427267194157, 'mean_word_length': 3.423956931359354, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '939271', 'n_tokens_mistral': 914, 'n_tokens_neox': 886, 'n_words': 312}