<commit_before># the loadusr function
import subprocess
import shlex
import time

def loadusr(command, wait=False, wait_name=None, wait_timeout=5.0, shell=False, **kwargs):
    cmd = command

    for key in kwargs.keys():  # pass arguments using kwargs
        arg = kwargs[key]
        prefix = '--'
        if len(key) == 1:  # single length arguments have single prefix
            prefix = '-'
        if isinstance(arg, bool):  # boolean is store_true type argument
            if arg is True:
                cmd += ' %s%s' % (prefix, key)
        else:
            cmd += ' %s%s %s' % (prefix, key, str(arg))

    if not shell:
        cmd = shlex.split(cmd)  # correctly split the command
    p = subprocess.Popen(cmd, shell=shell)

    wait = wait or (wait_name is not None)

    if not wait:
        return

    if wait_name is None:
        wait_name = command.split(' ')[0]  # guess the name

    timeout = 0.0
    while True:
        p.poll()
        # check if process is alive
        ret = p.returncode
        if ret is not None:
            raise RuntimeError(command + ' exited with return code ' + str(ret))
        # check if component exists
        if (wait_name is not None) and (wait_name in components):
            return components[wait_name]
        # check for timeout
        if timeout >= wait_timeout:
            p.kill()
            raise RuntimeError(command + ' did not start')

        timeout += 0.1
        time.sleep(0.1)<commit_msg>hal: fix race conditions with loadusr<commit_after># the loadusr function
import subprocess
import shlex
import time

def loadusr(command, wait=False, wait_name=None, wait_timeout=5.0, shell=False, **kwargs):
    cmd = command

    for key in kwargs.keys():  # pass arguments using kwargs
        arg = kwargs[key]
        prefix = '--'
        if len(key) == 1:  # single length arguments have single prefix
            prefix = '-'
        if isinstance(arg, bool):  # boolean is store_true type argument
            if arg is True:
                cmd += ' %s%s' % (prefix, key)
        else:
            cmd += ' %s%s %s' % (prefix, key, str(arg))

    if not shell:
        cmd = shlex.split(cmd)  # correctly split the command
    p = subprocess.Popen(cmd, shell=shell)

    wait = wait or (wait_name is not None)

    if not wait:
        return

    if wait_name is None:
        wait_name = command.split(' ')[0]  # guess the name

    timeout = 0.0
    while True:
        p.poll()
        # check if process is alive
        ret = p.returncode
        if ret is not None:
            raise RuntimeError(command + ' exited with return code ' + str(ret))
        # check if component exists
        if (wait_name is not None) and (wait_name in components) and (components[wait_name].state == COMP_READY):
            return components[wait_name]
        # check for timeout
        if timeout >= wait_timeout:
            p.kill()
            raise RuntimeError(command + ' did not start')

        timeout += 0.1
        time.sleep(0.1)
{'fraction_non_alphanumeric': 0.09867549668874172, 'fraction_numerical': 0.006622516556291391, 'mean_word_length': 2.036180904522613, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4140791', 'n_tokens_mistral': 887, 'n_tokens_neox': 867, 'n_words': 307}