<commit_before>
import sys
import platform
import threading
import fibre

def did_discover_device(device,
                        interactive_variables, discovered_devices,
                        branding_short, branding_long,
                        logger, app_shutdown_token):
    """
    Handles the discovery of new devices by displaying a
    message and making the device available to the interactive
    console
    """
    serial_number = '{:012X}'.format(device.serial_number) if hasattr(device, 'serial_number') else "[unknown serial number]"
    if serial_number in discovered_devices:
        verb = "Reconnected"
        index = discovered_devices.index(serial_number)
    else:
        verb = "Connected"
        discovered_devices.append(serial_number)
        index = len(discovered_devices) - 1
    interactive_name = branding_short + str(index)

    # Publish new device to interactive console
    interactive_variables[interactive_name] = device
    globals()[interactive_name] = device # Add to globals so tab complete works
    logger.info("{} to {} {} as {}".format(verb, branding_long, serial_number, interactive_name))<commit_msg>fix shell printing<commit_after>
import sys
import platform
import threading
import fibre

def did_discover_device(device,
                        interactive_variables, discovered_devices,
                        branding_short, branding_long,
                        logger, app_shutdown_token):
    """
    Handles the discovery of new devices by displaying a
    message and making the device available to the interactive
    console
    """
    serial_number = '{:012X}'.format(device.serial_number) if hasattr(device, 'serial_number') else "[unknown serial number]"
    if serial_number in discovered_devices:
        verb = "Reconnected"
        index = discovered_devices.index(serial_number)
    else:
        verb = "Connected"
        discovered_devices.append(serial_number)
        index = len(discovered_devices) - 1
    interactive_name = branding_short + str(index)

    # Publish new device to interactive console
    interactive_variables[interactive_name] = device
    globals()[interactive_name] = device # Add to globals so tab complete works
    logger.notify("{} to {} {} as {}".format(verb, branding_long, serial_number, interactive_name))
{'fraction_non_alphanumeric': 0.07675722294092281, 'fraction_numerical': 0.0034497628288055198, 'mean_word_length': 3.1952983725135624, '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': '1318911', 'n_tokens_mistral': 609, 'n_tokens_neox': 592, 'n_words': 175}