<commit_before>#!/usr/bin/env python

import sys
import logging
import argparse
from importlib import import_module

import tasks

loglevels = {'info': logging.INFO,
             'debug': logging.DEBUG,
             'error': logging.ERROR,
             'warn': logging.WARN}

possible_actions = ['download', 'extract', 'transform']
data_types = ['sopr', 'house_xml']

parser = argparse.ArgumentParser(description='Run scripts')

parser.add_argument('action', choices=possible_actions)
parser.add_argument('data_type', choices=data_types)
parser.add_argument('--force', action='store_true')
parser.add_argument('--loglevel', default='debug')

options = parser.parse_args().__dict__
options['loglevel'] = loglevels[options['loglevel']]

try:
    task_mod = getattr(tasks, '{action}_{data_type}'.format(**options))
except AttributeError:
    "Not implemented yet, sorry!"
task_mod(options)<commit_msg>adding thread options to run<commit_after>#!/usr/bin/env python

import sys
import logging
import argparse
from importlib import import_module

import tasks

loglevels = {'info': logging.INFO,
             'debug': logging.DEBUG,
             'error': logging.ERROR,
             'warn': logging.WARN}

possible_actions = ['download', 'extract', 'transform']
data_types = ['sopr', 'house_xml']

parser = argparse.ArgumentParser(description='Run scripts')

parser.add_argument('action', choices=possible_actions)
parser.add_argument('data_type', choices=data_types)
parser.add_argument('--force', action='store_true')
parser.add_argument('--threaded', action='store_true')
parser.add_argument('--thread_num', action='store', type=int)
parser.add_argument('--loglevel', default='debug')

options = parser.parse_args().__dict__
options['loglevel'] = loglevels[options['loglevel']]

try:
    task_mod = getattr(tasks, '{action}_{data_type}'.format(**options))
except AttributeError:
    "Not implemented yet, sorry!"
task_mod(options)
{'fraction_non_alphanumeric': 0.1483402489626556, 'fraction_numerical': 0.0, 'mean_word_length': 5.697916666666667, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '1800633', 'n_tokens_mistral': 578, 'n_tokens_neox': 570, 'n_words': 120}