<commit_before># -*- coding: utf-8 -*-

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import math


def kageInt(s):
    """Imitates Math.floor in ECMAScript (returns an int).

    KAGE Engine uses Math.floor to parse numbers in KAGE data.
    """
    if isinstance(s, (str, unicode)):
        s = s.strip()
        if s == "":
            return 0
    elif isinstance(s, float):
        return int(math.floor(s))
    try:
        # decimal integer literal (may have leading 0 digits)
        return int(s)
    except ValueError:
        try:
            # hexadecimal, octal, binary integer literal
            return int(s, 0)
        except ValueError:
            # contains decimal point and/or exponent part
            return int(math.floor(float(s)))


def kageIntSuppressError(s):
    """The same as kageInt except that it returns None when s is invalid"""
    try:
        return kageInt(s)
    except (ValueError, OverflowError):
        return None


_cachelambdas = {<commit_msg>Make kageInt accept only string-like<commit_after># -*- coding: utf-8 -*-

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import math


def kageInt(s):
    """Imitates Math.floor(+s) in ECMAScript (returns an int).

    KAGE Engine uses Math.floor to parse numbers in KAGE data.
    """
    s = s.strip()
    if s == "":
        return 0
    try:
        # decimal integer literal (may have leading 0 digits)
        return int(s)
    except ValueError:
        try:
            # hexadecimal, octal, binary integer literal
            return int(s, 0)
        except ValueError:
            # contains decimal point and/or exponent part
            return int(math.floor(float(s)))


def kageIntSuppressError(s):
    """The same as kageInt except that it returns None when s is invalid"""
    try:
        return kageInt(s)
    except (ValueError, OverflowError):
        return None


_cachelambdas = {
{'fraction_non_alphanumeric': 0.08372978116079924, 'fraction_numerical': 0.003805899143672693, 'mean_word_length': 2.516722408026756, 'pattern_counts': {'":': 2, '<': 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': '1149184', 'n_tokens_mistral': 612, 'n_tokens_neox': 597, 'n_words': 217}