<commit_before>"""
Start a python interpreter or execute a python script within Rez's own execution context.
"""


def setup_parser(parser, completions=False):
    FILE_action = parser.add_argument(
        "FILE", type=str, nargs='?',
        help='python script to execute')
    parser.add_argument(
        "ARG", type=str, nargs='*',
        help='arguments to python script')

    if completions:
        from rez.cli._complete_util import FilesCompleter
        FILE_action.completer = FilesCompleter(dirs=False,
                                               file_patterns=["*.py"])


def command(opts, parser, extra_arg_groups=None):
    import sys

    if not opts.FILE:
        # run interactive interpreter
        import subprocess
        p = subprocess.Popen([sys.executable])
        p.wait()
        return

    with open(opts.FILE) as f:
        code = f.read()
    pyc = compile(code, opts.FILE, "exec")

    sys.argv = opts.ARG or []
    exec(pyc, globals(), locals())
<commit_msg>fixed bug in rez-python, should be using -E<commit_after>"""
Start a python interpreter or execute a python script within Rez's own execution context.
"""


def setup_parser(parser, completions=False):
    FILE_action = parser.add_argument(
        "FILE", type=str, nargs='?',
        help='python script to execute')
    parser.add_argument(
        "ARG", type=str, nargs='*',
        help='arguments to python script')

    if completions:
        from rez.cli._complete_util import FilesCompleter
        FILE_action.completer = FilesCompleter(dirs=False,
                                               file_patterns=["*.py"])


def command(opts, parser, extra_arg_groups=None):
    import sys

    if not opts.FILE:
        # run interactive interpreter
        import subprocess
        p = subprocess.Popen([sys.executable, "-E"])
        p.wait()
        return

    with open(opts.FILE) as f:
        code = f.read()
    pyc = compile(code, opts.FILE, "exec")

    sys.argv = opts.ARG or []
    exec(pyc, globals(), locals())

{'fraction_non_alphanumeric': 0.1144400785854617, 'fraction_numerical': 0.0, 'mean_word_length': 2.4408783783783785, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7422702', 'n_tokens_mistral': 604, 'n_tokens_neox': 583, 'n_words': 164}