<commit_before>from setuptools import setup
import os
import emit

setup(
    name='emit',
    version=emit.__version__,
    description='Emitter for stream processing',
    url='http://github.com/brianhicks/emit',
    author='<NAME>',
    author_email='<EMAIL>',
    license='MIT',
    packages=['emit'],
    scripts=['emit/bin/emit_digraph'],
    zip_safe=False
)<commit_msg>add cc and mi to setup.py<commit_after>from setuptools import setup
import os
from subprocess import Popen, PIPE
import sys

import emit

# add a few commands for measurement
def cc():
    proc = Popen(['radon', 'cc'] + sys.argv[1:], stdout=PIPE)
    stdout, _ = proc.communicate()
    sys.stdout.write(stdout.decode('utf-8'))
    return 1 if stdout else 0

def mi():
    proc = Popen(['radon', 'mi'] + sys.argv[1:], stdout=PIPE)
    stdout, _ = proc.communicate()
    sys.stdout.write(stdout.decode('utf-8'))
    for line in stdout.decode('utf-8').strip().split('\n'):
        if not line.endswith('A'):
            sys.stdout.write('One or more modules did not get an A. Failing.\n')
            return 1

    return 0

if __name__ == '__main__':
    try:
        arg = sys.argv[1]
    except IndexError:
        arg = ''
    command = {'cc': cc, 'mi': mi}.get(arg, None)
    if command:
        sys.exit(command())

# pass execution to setuptools
setup(
    name='emit',
    version=emit.__version__,
    description='Emitter for stream processing',
    url='http://github.com/brianhicks/emit',
    author='<NAME>',
    author_email='<EMAIL>',
    license='MIT',
    packages=['emit'],
    scripts=['emit/bin/emit_digraph'],
    zip_safe=False
)
{'fraction_non_alphanumeric': 0.15569230769230769, 'fraction_numerical': 0.006153846153846154, 'mean_word_length': 3.2233766233766232, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '270508', 'n_tokens_mistral': 539, 'n_tokens_neox': 536, 'n_words': 131}