<commit_before># -*- coding: utf-8 -*-
from struct import unpack
import sys, time
from .constants import NO_KEY_DETECTED, FOUND_KEY_DOWN, FOUND_KEY_UP, \
     KEY_RELEASE_BITMASK, INVALID_PORT_BITS

import ftd2xx

class XidConnection(object):
    def __init__(self, device, baud_rate=115200):
        self.ftd2xx_intermediate = device<commit_msg>Inform users how to install if ftd2xx is not found<commit_after># -*- coding: utf-8 -*-
from struct import unpack
import sys, time
from .constants import NO_KEY_DETECTED, FOUND_KEY_DOWN, FOUND_KEY_UP, \
     KEY_RELEASE_BITMASK, INVALID_PORT_BITS

try:
    import ftd2xx
except OSError as e:
    if 'image not found' in str(e):
        raise OSError('ftd2xx drivers are not installed (or not in expected location)'
                      ' and these are required for the Cedrus pyxid2 library.\n'
                      '** Download from https://www.ftdichip.com/Drivers/D2XX.htm **')
    else:
        raise(e)  # not an error we know so pass it on



class XidConnection(object):
    def __init__(self, device, baud_rate=115200):
        self.ftd2xx_intermediate = device
{'fraction_non_alphanumeric': 0.08504923903312445, 'fraction_numerical': 0.019695613249776187, 'mean_word_length': 3.3166023166023164, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4182318', 'n_tokens_mistral': 383, 'n_tokens_neox': 362, 'n_words': 109}