<commit_before># command.py
#
# The leaf classes in this module implement Paste Script commands; they
# are runnable with "paster thing", where thing is one of the commands
# listed in the openspending section of "paster help".
#
# They are registered in openspending's setup.py.
#
# See http://pythonpaste.org/script/developer.html for documentation of
# Paste Script.

import os
import sys
import argparse
import logging
import logging.config

from paste.deploy import appconfig
from openspending.ui.config.environment import load_environment

log = logging.getLogger(__name__.split('.')[0])

parser = argparse.ArgumentParser(description='Interface to common administrative tasks for OpenSpending.')
parser.add_argument('-v', '--verbose',
                    dest='verbose', action='append_const', const=1,
                    help='Increase the logging level')
parser.add_argument('-q', '--quiet',
                    dest='verbose', action='append_const', const=-1,
                    help='Decrease the logging level')
parser.add_argument('config', help='Paste configuration file')

subparsers = parser.add_subparsers(title='subcommands')

from . import db, solr, user, importer

for mod in (db, solr, user, importer):
    mod.configure_parser(subparsers)

try:
    from openspending.etl import command as etl_command
except ImportError:
    pass
else:
    etl_command.configure_parsers(subparsers)

def main():
    args = parser.parse_args()

    config_file = os.path.abspath(args.config)
    _configure_logging(config_file)
    _configure_pylons(config_file)

    args.verbose = 0 if args.verbose is None else sum(args.verbose)
    log.setLevel(max(10, log.getEffectiveLevel() - 10 * args.verbose))

    sys.exit(args.func(args))

def _configure_logging(config_file):
    logging.config.fileConfig(config_file,
                              dict(__file__=config_file,
                                   here=os.path.dirname(config_file)))

def _configure_pylons(config_file):
    conf = appconfig('config:%s' % os.path.basename(config_file),
                     relative_to=os.path.dirname(config_file))
    load_environment(conf.global_conf, conf.local_conf)

if __name__ == '__main__':
    main()
<commit_msg>report missing config file, fixes #335 <commit_after># command.py
#
# The leaf classes in this module implement Paste Script commands; they
# are runnable with "paster thing", where thing is one of the commands
# listed in the openspending section of "paster help".
#
# They are registered in openspending's setup.py.
#
# See http://pythonpaste.org/script/developer.html for documentation of
# Paste Script.

import os
import sys
import argparse
import logging
import logging.config

from paste.deploy import appconfig
from openspending.ui.config.environment import load_environment

log = logging.getLogger(__name__.split('.')[0])

parser = argparse.ArgumentParser(description='Interface to common administrative tasks for OpenSpending.')
parser.add_argument('-v', '--verbose',
                    dest='verbose', action='append_const', const=1,
                    help='Increase the logging level')
parser.add_argument('-q', '--quiet',
                    dest='verbose', action='append_const', const=-1,
                    help='Decrease the logging level')
parser.add_argument('config', help='Paste configuration file')

subparsers = parser.add_subparsers(title='subcommands')

from . import db, solr, user, importer

for mod in (db, solr, user, importer):
    mod.configure_parser(subparsers)

try:
    from openspending.etl import command as etl_command
except ImportError:
    pass
else:
    etl_command.configure_parsers(subparsers)

def main():
    args = parser.parse_args()

    config_file = os.path.abspath(args.config)
    if not os.path.exists(config_file):
        print "Config file not found: %s" % config_file
        sys.exit(1)
    _configure_logging(config_file)
    _configure_pylons(config_file)

    args.verbose = 0 if args.verbose is None else sum(args.verbose)
    log.setLevel(max(10, log.getEffectiveLevel() - 10 * args.verbose))

    sys.exit(args.func(args))

def _configure_logging(config_file):
    logging.config.fileConfig(config_file,
                              dict(__file__=config_file,
                                   here=os.path.dirname(config_file)))

def _configure_pylons(config_file):
    conf = appconfig('config:%s' % os.path.basename(config_file),
                     relative_to=os.path.dirname(config_file))
    load_environment(conf.global_conf, conf.local_conf)

if __name__ == '__main__':
    main()

{'fraction_non_alphanumeric': 0.10580279232111693, 'fraction_numerical': 0.004363001745200698, 'mean_word_length': 3.548611111111111, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6119204', 'n_tokens_mistral': 1373, 'n_tokens_neox': 1331, 'n_words': 341}