<commit_before>import io
from ctypes import create_string_buffer

def pack_message(message):
    return message.struct.pack(message.__class__.id, *message.deflate())

def pack_messages(messages):
    lng = 0
    for msg in messages:
        lng += msg.binary_length

    buf = create_string_buffer(lng)
    offset = 0

    for msg in messages:
        msg.struct.pack_into(buf, offset, msg.__class__.id, *msg.deflate())
        offset += msg.binary_length

    return buf.raw


def pack_messages_of_single_type(messages):
    lng = messages[0].binary_length * len(messages)
    buf = create_string_buffer(lng)
    offset = 0

    for msg in messages:
        msg.struct.pack_into(buf, offset, msg.__class__.id, *msg.deflate())
        offset += msg.__class__.binary_length

    return buf.raw<commit_msg>Minor fixes to packers<commit_after>import io
from ctypes import create_string_buffer

def pack_message(message):
    return message.struct.pack(message.__class__.id, *message.deflate())

def pack_messages(messages):
    lng = 0
    for msg in messages:
        lng += msg.binary_length

    buf = create_string_buffer(lng)
    offset = 0

    for msg in messages:
        msg.struct.pack_into(buf, offset, msg.__class__.id, *msg.deflate())
        offset += msg.binary_length

    return buf.raw


def pack_messages_of_single_type(messages):
    buf = create_string_buffer(messages[0].binary_length * len(messages))
    offset = 0

    for msg in messages:
        msg.struct.pack_into(buf, offset, msg.__class__.id, *msg.deflate())
        offset += msg.binary_length

    return buf.raw
{'fraction_non_alphanumeric': 0.09918392969240426, 'fraction_numerical': 0.005021971123666039, 'mean_word_length': 3.3315217391304346, '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': '2234541', 'n_tokens_mistral': 517, 'n_tokens_neox': 497, 'n_words': 116}