<commit_before>"""
Some extra picklers needed to gracefully dump and load a canvas.
"""

import copy_reg


# Allow instancemethod to be pickled:

import new

def construct_instancemethod(funcname, self, clazz):
    func = getattr(clazz, funcname)
    return new.instancemethod(func, self, clazz)

def reduce_instancemethod(im):
    return construct_instancemethod, (im.__func__.__name__, im.__self__, im.__self__.__class__)

copy_reg.pickle(new.instancemethod, reduce_instancemethod, construct_instancemethod)


# Allow cairo.Matrix to be pickled:

import cairo

def construct_cairo_matrix(*args):
    return cairo.Matrix(*args)

def reduce_cairo_matrix(m):
    return construct_cairo_matrix, tuple(m)

copy_reg.pickle(cairo.Matrix, reduce_cairo_matrix, construct_cairo_matrix)


# vim:sw=4:et:ai
<commit_msg>Futurize future_standard_library: copy_reg to copyreg<commit_after>"""
Some extra picklers needed to gracefully dump and load a canvas.
"""

from future import standard_library
standard_library.install_aliases()
import copyreg


# Allow instancemethod to be pickled:

import new

def construct_instancemethod(funcname, self, clazz):
    func = getattr(clazz, funcname)
    return new.instancemethod(func, self, clazz)

def reduce_instancemethod(im):
    return construct_instancemethod, (im.__func__.__name__, im.__self__, im.__self__.__class__)

copyreg.pickle(new.instancemethod, reduce_instancemethod, construct_instancemethod)


# Allow cairo.Matrix to be pickled:

import cairo

def construct_cairo_matrix(*args):
    return cairo.Matrix(*args)

def reduce_cairo_matrix(m):
    return construct_cairo_matrix, tuple(m)

copyreg.pickle(cairo.Matrix, reduce_cairo_matrix, construct_cairo_matrix)


# vim:sw=4:et:ai

{'fraction_non_alphanumeric': 0.08690614136732329, 'fraction_numerical': 0.0011587485515643105, 'mean_word_length': 6.16597510373444, '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': '3781859', 'n_tokens_mistral': 556, 'n_tokens_neox': 549, 'n_words': 133}