<commit_before>from redux.codegenerator import compile_script
from argparse import ArgumentParser
from os.path import splitext

parser = ArgumentParser(description='Compile a Redux script to Rescript.')
parser.add_argument('filenames', metavar='FILE', nargs='+',
                    help='script to be compiled to Rescript')

args = parser.parse_args()

for filename in args.filenames:
    with open(filename, "rt") as file_:
        input_code = file_.read()

    base_filename, extension = splitext(filename)
    with open(base_filename + ".ais", "wt") as file_:
        file_.write(compile_script(filename, input_code))<commit_msg>Make compiler invocation more Makefile-friendly<commit_after>from redux.codegenerator import compile_script
from argparse import ArgumentParser
from os.path import splitext

parser = ArgumentParser(description='Compile a Redux script to Rescript.')
parser.add_argument('input_filename', metavar='FILE',
                    help='script to be compiled to Rescript')
parser.add_argument('output_filename', metavar='FILE',
                    help='script to be compiled to Rescript')

args = parser.parse_args()

filename = args.input_filename
assert filename, "no input file given"

with open(filename, "rt") as file_:
    input_code = file_.read()

output_code = compile_script(filename, input_code)

base_filename, extension = splitext(filename)
with open(args.output_filename, "wt") as file_:
    file_.write(output_code)
{'fraction_non_alphanumeric': 0.09746053534660261, 'fraction_numerical': 0.0, 'mean_word_length': 4.6953125, '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': '5128853', 'n_tokens_mistral': 417, 'n_tokens_neox': 405, 'n_words': 119}