<commit_before>""" Simple SQL-like query language for dynamo. """
import os

import argparse
import logging.config
import six

from .cli import DQLClient
from .engine import Engine, FragmentEngine

__version__ = '0.5.21'


LOG_CONFIG = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'brief': {
            'format': "%(message)s",
        },
    },
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler',
            'formatter': 'brief',
            'stream': 'ext://sys.stdout',
        },
    },
    'root': {
        'level': 'ERROR',
        'handlers': [
            'console',
        ],
    },
    'loggers': {
        'dql': {
            'level': 'INFO',
            'propagate': True,
        },
    },
}


def main():
    """ Start the DQL client. """
    parse = argparse.ArgumentParser(description=main.__doc__)
    parse.add_argument('-c', '--command', help="Run this command and exit")
    region = os.environ.get('AWS_REGION', 'us-west-1')
    parse.add_argument('-r', '--region', default=region,
                       help="AWS region to connect to (default %(default)s)")
    parse.add_argument('-H', '--host', default=None,
                       help="Host to connect to if using a local instance "
                       "(default %(default)s)")
    parse.add_argument('-p', '--port', default=8000, type=int,
                       help="Port to connect to "
                       "(default %(default)d)")
    parse.add_argument('--version', action="store_true",
                       help="Print the version and exit")
    args = parse.parse_args()

    if args.version:
        six.print_(__version__)
        return

    logging.config.dictConfig(LOG_CONFIG)
    cli = DQLClient()
    cli.initialize(region=args.region, host=args.host, port=args.port)

    if args.command:
        command = args.command.strip()
        if not command.endswith(';'):
            command += ' ;'
        try:
            cli.run_command(command)
        except KeyboardInterrupt:
            pass
    else:
        cli.start()
<commit_msg>Fix #6: Error running non-dql statements with -c<commit_after>""" Simple SQL-like query language for dynamo. """
import os

import argparse
import logging.config
import six

from .cli import DQLClient
from .engine import Engine, FragmentEngine

__version__ = '0.5.21'


LOG_CONFIG = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'brief': {
            'format': "%(message)s",
        },
    },
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler',
            'formatter': 'brief',
            'stream': 'ext://sys.stdout',
        },
    },
    'root': {
        'level': 'ERROR',
        'handlers': [
            'console',
        ],
    },
    'loggers': {
        'dql': {
            'level': 'INFO',
            'propagate': True,
        },
    },
}


def main():
    """ Start the DQL client. """
    parse = argparse.ArgumentParser(description=main.__doc__)
    parse.add_argument('-c', '--command', help="Run this command and exit")
    region = os.environ.get('AWS_REGION', 'us-west-1')
    parse.add_argument('-r', '--region', default=region,
                       help="AWS region to connect to (default %(default)s)")
    parse.add_argument('-H', '--host', default=None,
                       help="Host to connect to if using a local instance "
                       "(default %(default)s)")
    parse.add_argument('-p', '--port', default=8000, type=int,
                       help="Port to connect to "
                       "(default %(default)d)")
    parse.add_argument('--version', action="store_true",
                       help="Print the version and exit")
    args = parse.parse_args()

    if args.version:
        six.print_(__version__)
        return

    logging.config.dictConfig(LOG_CONFIG)
    cli = DQLClient()
    cli.initialize(region=args.region, host=args.host, port=args.port)

    if args.command:
        command = args.command.strip()
        try:
            cli.run_command(command)
            if cli.engine.partial:
                cli.run_command(';')
        except KeyboardInterrupt:
            pass
    else:
        cli.start()

{'fraction_non_alphanumeric': 0.1474643608319701, 'fraction_numerical': 0.004907688712315962, 'mean_word_length': 1.935528120713306, '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': '6562682', 'n_tokens_mistral': 1297, 'n_tokens_neox': 1255, 'n_words': 286}