<commit_before>__author__    = '<NAME> <<EMAIL>>'
__date__      = '18 January 2013'
__copyright__ = 'Copyright (c) 2013 <NAME>'

import sys

b = lambda x: x.lower() in ('true', 't')

commands = {
    # Function name : (Iterable result, [Param types], Number of required arguments)])
    'search' : (True,  [str, str, b, b], 2),
    'chdir'  : (False, [str],            1),
    'mkdir'  : (False, [str],            1),
    'copy'   : (False, [str, str],       2),
    'gcopy'  : (False, [str, str],       2),
    'move'   : (False, [str, str],       2),
    'gmove'  : (False, [str, str],       2),
    'remove' : (False, [str],            1),
}


def print_help():
    print 'Usage: python -m tea.shutil [command] [params]'
    print
    print 'Commands: %s' % ', '.join(commands.keys())
    return 1

def print_func_help(func, required):
    import inspect
    args = inspect.getargspec(func).args
    print 'Usage: %s' % func.__name__,
    for i in range(required):
        print args[i],
    if required < len(args):
        print '[%s]' % ' '.join(args[required:])
    return 1


def main(args):
    # Configure logger
    from tea.logger import configure_logging
    configure_logging(stdout_level='WARN')
    
    if len(args) == 0:
        print_help()
    else:
        command = args[0]
        if command == 'help' or command not in commands:
            return print_help()
        else:
            args = args[1:]
            # get specs
            iterable, params, required = commands[command]
            # import function
            import __init__ as module
            func = getattr(module, command)
            if not (required <= len(args) <= len(params)):
                return print_func_help(func, required)
            parsed_args = []
            for i, arg in enumerate(args):
                try:
                    parsed_args.append(params[i](arg))
                except:
                    print 'Failed to parse argument: %s' % arg
                    return 1
            try:
                if iterable:<commit_msg>IronPython doesn't import the right __init__.py<commit_after>__author__    = '<NAME> <<EMAIL>>'
__date__      = '18 January 2013'
__copyright__ = 'Copyright (c) 2013 <NAME>'

import sys

b = lambda x: x.lower() in ('true', 't')

commands = {
    # Function name : (Iterable result, [Param types], Number of required arguments)])
    'search' : (True,  [str, str, b, b], 2),
    'chdir'  : (False, [str],            1),
    'mkdir'  : (False, [str],            1),
    'copy'   : (False, [str, str],       2),
    'gcopy'  : (False, [str, str],       2),
    'move'   : (False, [str, str],       2),
    'gmove'  : (False, [str, str],       2),
    'remove' : (False, [str],            1),
}


def print_help():
    print 'Usage: python -m tea.shutil [command] [params]'
    print
    print 'Commands: %s' % ', '.join(commands.keys())
    return 1

def print_func_help(func, required):
    import inspect
    args = inspect.getargspec(func).args
    print 'Usage: %s' % func.__name__,
    for i in range(required):
        print args[i],
    if required < len(args):
        print '[%s]' % ' '.join(args[required:])
    return 1


def main(args):
    # Configure logger
    from tea.logger import configure_logging
    configure_logging(stdout_level='WARN')
    
    if len(args) == 0:
        print_help()
    else:
        command = args[0]
        if command == 'help' or command not in commands:
            return print_help()
        else:
            args = args[1:]
            # get specs
            iterable, params, required = commands[command]
            # import function
            from tea import shutil
            func = getattr(shutil, command)
            if not (required <= len(args) <= len(params)):
                return print_func_help(func, required)
            parsed_args = []
            for i, arg in enumerate(args):
                try:
                    parsed_args.append(params[i](arg))
                except:
                    print 'Failed to parse argument: %s' % arg
                    return 1
            try:
                if iterable:
{'fraction_non_alphanumeric': 0.13606755126658626, 'fraction_numerical': 0.01158021712907117, 'mean_word_length': 1.8652384243261921, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 11, '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': '4121142', 'n_tokens_mistral': 1306, 'n_tokens_neox': 1252, 'n_words': 374}