<commit_before>import platform
import re
import subprocess

from time import sleep

def verify_provisioned(akt_info, conf):
    # Verify that device HAS provisioned.
    stdout, stderr, retcode = run_subprocess([str(akt_info), '--config', str(conf), '--wait-until-provisioned'])
    machine = platform.node()
    if (b'Device ID: ' not in stdout or
            b'Primary ecu hardware ID: ' + machine.encode() not in stdout or
            b'Fetched metadata: yes' not in stdout):
        print('Provisioning failed: ' + stderr.decode() + stdout.decode())
        return 1
    p = re.compile(r'Device ID: ([a-z0-9-]*)\n')
    m = p.search(stdout.decode())
    if not m or m.lastindex <= 0:
        print('Device ID could not be read: ' + stderr.decode() + stdout.decode())
        return 1
    print('Device successfully provisioned with ID: ' + m.group(1))
    return 0


def run_subprocess(command, **kwargs):
    print('> Running {}'.format(' '.join(command)))
    proc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs)
    try:
        stdout, stderr = proc.communicate(timeout=60)
    except TimeoutExpired:
        proc.kill()
        stdout, stderr = proc.communicate()<commit_msg>Fix a python undefined name in test scripts<commit_after>import platform
import re
import subprocess


def verify_provisioned(akt_info, conf):
    # Verify that device HAS provisioned.
    stdout, stderr, retcode = run_subprocess([str(akt_info), '--config', str(conf), '--wait-until-provisioned'])
    machine = platform.node()
    if (b'Device ID: ' not in stdout or
            b'Primary ecu hardware ID: ' + machine.encode() not in stdout or
            b'Fetched metadata: yes' not in stdout):
        print('Provisioning failed: ' + stderr.decode() + stdout.decode())
        return 1
    p = re.compile(r'Device ID: ([a-z0-9-]*)\n')
    m = p.search(stdout.decode())
    if not m or m.lastindex <= 0:
        print('Device ID could not be read: ' + stderr.decode() + stdout.decode())
        return 1
    print('Device successfully provisioned with ID: ' + m.group(1))
    return 0


def run_subprocess(command, **kwargs):
    print('> Running {}'.format(' '.join(command)))
    proc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs)
    try:
        stdout, stderr = proc.communicate(timeout=60)
    except subprocess.TimeoutExpired:
        proc.kill()
        stdout, stderr = proc.communicate()
{'fraction_non_alphanumeric': 0.13444354183590576, 'fraction_numerical': 0.007311129163281885, 'mean_word_length': 3.1816638370118846, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7627901', 'n_tokens_mistral': 791, 'n_tokens_neox': 767, 'n_words': 216}