<commit_before>import struct

import lz4.frame
import pyarrow
from scipy.sparse import csc_matrix


# The magic intial bytes which tell us that a given binary chunk is LZ4
# compressed data
LZ4_MAGIC_NUMBER = struct.pack("<I", 0x184D2204)

context = pyarrow.SerializationContext()


def serialize_csc(matrix):
    """<commit_msg>Silence warning which is making cronjobs chatty<commit_after>import struct
import warnings

import lz4.frame
import pyarrow
from scipy.sparse import csc_matrix


# When we get the time to work on this we can just get rid of pyarrow
# altogether. The new pickle protocol (pickle 5) allows for zero-copy
# deserialisation and I've benchmarked this as being faster than pyarrow even
# with crude proof-of-concept code. See:
# https://gist.github.com/evansd/3707bc002938784632855f2c95c96be8
warnings.filterwarnings(
    "ignore", message="'pyarrow.SerializationContext' is deprecated", module="."
)


# The magic intial bytes which tell us that a given binary chunk is LZ4
# compressed data
LZ4_MAGIC_NUMBER = struct.pack("<I", 0x184D2204)

context = pyarrow.SerializationContext()


def serialize_csc(matrix):
    """
{'fraction_non_alphanumeric': 0.07699037620297462, 'fraction_numerical': 0.04199475065616798, 'mean_word_length': 5.150537634408602, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 1, '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': '4999658', 'n_tokens_mistral': 395, 'n_tokens_neox': 357, 'n_words': 123}