<commit_before>'''
Hub templates
'''
from kitty.model import UInt8, LE16, RandomBytes
from kitty.model import Size
from generic import Descriptor
from enum import _DescriptorTypes


# hub_descriptor

'''
 d = struct.pack(
            '<BBHBB',
            DescriptorType.hub,
            self.num_ports,
            self.hub_chars,
            self.pwr_on_2_pwr_good,
            self.hub_contr_current,
        )
        num_bytes = self.num_ports // 7
        if self.num_ports % 7 != 0:
            num_bytes += 1
        d += '\x00' * num_bytes
        d += '\xff' * num_bytes
        d = struct.pack('B', len(d) + 1) + d
        return d
'''

hub_descriptor = Descriptor(
    name='hub_descriptor',
    descriptor_type=_DescriptorTypes.HUB,
    fields=[
        Size(name='bNbrPorts', sized_field='DeviceRemoveable', length=8, calc_func=lambda x: len(x) * 7),<commit_msg>[HubDevice] fixed typo in hub descriptor template<commit_after>'''
Hub templates
'''
from kitty.model import UInt8, LE16, RandomBytes
from kitty.model import Size
from generic import Descriptor
from enum import _DescriptorTypes


# hub_descriptor

'''
 d = struct.pack(
            '<BBHBB',
            DescriptorType.hub,
            self.num_ports,
            self.hub_chars,
            self.pwr_on_2_pwr_good,
            self.hub_contr_current,
        )
        num_bytes = self.num_ports // 7
        if self.num_ports % 7 != 0:
            num_bytes += 1
        d += '\x00' * num_bytes
        d += '\xff' * num_bytes
        d = struct.pack('B', len(d) + 1) + d
        return d
'''

hub_descriptor = Descriptor(
    name='hub_descriptor',
    descriptor_type=_DescriptorTypes.HUB,
    fields=[
        Size(name='bNbrPorts', sized_field='DeviceRemovable', length=8, calc_func=lambda x: len(x) * 7),
{'fraction_non_alphanumeric': 0.11415780637940683, 'fraction_numerical': 0.014549524342473419, 'mean_word_length': 2.3420560747663552, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6409736', 'n_tokens_mistral': 590, 'n_tokens_neox': 570, 'n_words': 133}