<commit_before>"""A main program for Byterun."""

import argparse
import logging

from . import execfile

parser = argparse.ArgumentParser()
parser.add_argument('-m', dest='module', action='store_true')
parser.add_argument('-v', dest='verbose', action='store_true')
parser.add_argument('to_run')
parser.add_argument('arg', nargs=argparse.REMAINDER)
args = parser.parse_args()

if args.module:
    run_fn = execfile.run_python_module
else:
    run_fn = execfile.run_python_file

level = logging.DEBUG if args.verbose else logging.WARNING
logging.basicConfig(level=level)

argv = [args.to_run] + args.arg
run_fn(args.to_run, argv)
<commit_msg>Make the argument handling nicer.<commit_after>"""A main program for Byterun."""

import argparse
import logging

from . import execfile

parser = argparse.ArgumentParser(
    prog="byterun",
    description="Run Python programs with a Python bytecode interpreter.",
)
parser.add_argument(
    '-m', dest='module', action='store_true',
    help="prog is a module name, not a file name.",
)
parser.add_argument(
    '-v', '--versbose', dest='verbose', action='store_true',
    help="trace the execution of the bytecode.",
)
parser.add_argument(
    'prog',
    help="The program to run.",
)
parser.add_argument(
    'args', nargs=argparse.REMAINDER,
    help="Arguments to pass to the program.",
)
args = parser.parse_args()

if args.module:
    run_fn = execfile.run_python_module
else:
    run_fn = execfile.run_python_file

level = logging.DEBUG if args.verbose else logging.WARNING
logging.basicConfig(level=level)

argv = [args.prog] + args.args
run_fn(args.prog, argv)

{'fraction_non_alphanumeric': 0.13003095975232198, 'fraction_numerical': 0.0, 'mean_word_length': 4.96309963099631, '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': '6157583', 'n_tokens_mistral': 529, 'n_tokens_neox': 520, 'n_words': 131}