<commit_before>import weakref
import fontMath
from fontParts.base.errors import FontPartsError
from fontParts.base.base import BaseDict, dynamicProperty, interpolate
from fontParts.base import normalizers


class BaseKerning(BaseDict):

    keyNormalizer = normalizers.normalizeKerningKey
    valueNormalizer = normalizers.normalizeKerningValue

    # -------
    # Parents
    # -------

    def getParent(self):
        """
        This is a backwards compatibility method.
        """
        return self.font

    # Font

    _font = None

    font = dynamicProperty("font", "The kerning's parent font.")

    def _get_font(self):
        if self._font is None:
            return None
        return self._font()

    def _set_font(self, font):
        assert self._font is None
        if font is not None:
            font = weakref.ref(font)
        self._font = font

    # --------------
    # Transformation
    # --------------

    def scaleBy(self, value):
        """
        Scale all kernng pairs by value.
        """
        value = normalizers.normalizeTransformationScale(value)
        self._scale(value)

    def _scale(self, value):
        """
        Subclasses may override this method.
        """
        value = value[0]
        for k, v in self.items():
            v *= value
            self[key] = v

    # -------------
    # Normalization
    # -------------

    def round(self, multiple=1):
        """
        Round the kerning pair values to increments of multiple.
        """
        if not isinstance(multiple, int):
            raise FontPartsError("The round multiple must be an int not %s." % multiple.__class__.__name__)<commit_msg>k not key<commit_after>import weakref
import fontMath
from fontParts.base.errors import FontPartsError
from fontParts.base.base import BaseDict, dynamicProperty, interpolate
from fontParts.base import normalizers


class BaseKerning(BaseDict):

    keyNormalizer = normalizers.normalizeKerningKey
    valueNormalizer = normalizers.normalizeKerningValue

    # -------
    # Parents
    # -------

    def getParent(self):
        """
        This is a backwards compatibility method.
        """
        return self.font

    # Font

    _font = None

    font = dynamicProperty("font", "The kerning's parent font.")

    def _get_font(self):
        if self._font is None:
            return None
        return self._font()

    def _set_font(self, font):
        assert self._font is None
        if font is not None:
            font = weakref.ref(font)
        self._font = font

    # --------------
    # Transformation
    # --------------

    def scaleBy(self, value):
        """
        Scale all kernng pairs by value.
        """
        value = normalizers.normalizeTransformationScale(value)
        self._scale(value)

    def _scale(self, value):
        """
        Subclasses may override this method.
        """
        value = value[0]
        for k, v in self.items():
            v *= value
            self[k] = v

    # -------------
    # Normalization
    # -------------

    def round(self, multiple=1):
        """
        Round the kerning pair values to increments of multiple.
        """
        if not isinstance(multiple, int):
            raise FontPartsError("The round multiple must be an int not %s." % multiple.__class__.__name__)
{'fraction_non_alphanumeric': 0.12171837708830549, 'fraction_numerical': 0.0011933174224343676, 'mean_word_length': 1.8105616093880972, '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': '1335672', 'n_tokens_mistral': 919, 'n_tokens_neox': 868, 'n_words': 261}