<commit_before>import copy
import fractions
import itertools
import math
import random
import re
import string
import sys
import collections
import numbers
from ast import literal_eval


# Type checking
def is_num(a):
    return isinstance(a, numbers.Number)


def is_seq(a):
    return isinstance(a, collections.Sequence)


def is_col(a):
    return isinstance(a, collections.Iterable)


# Error handling
class BadTypeCombinationError(Exception):
    def __init__(self, func, *args):
        self.args = args
        self.func = func

    def __str__(self):
        error_message = "\nError occured in function: %s" % self.func
        for i in range(len(self.args)):
            arg = self.args[i]
            arg_type = str(type(arg)).split("'")[1]
            error_message += "\nArg %d: %r, type %s." % (i + 1, arg, arg_type)
        return error_message


# Function library. See data for letter -> function correspondences.
# !. All.
def Pnot(a):
    return not a


# @.
def lookup(a, b):
    if isinstance(a, dict):
        return a[b]
    if is_seq(a) and isinstance(b, int):
        return a[b % len(a)]
    if is_col(a) and is_col(b):
        intersection = filter(lambda b_elm: b_elm in a, b)
        if isinstance(a, str):
            return ''.join(intersection)
        elif isinstance(a, tuple):
            return tuple(intersection)
        else:
            return list(intersection)
    raise BadTypeCombinationError("@", a, b)


# %. int, str.
def mod(a, b):
    if isinstance(a, int) and is_seq(b):
        return b[::a]
    if is_num(a) and is_num(b) or isinstance(a, str):
        return a % b
    raise BadTypeCombinationError("%", a, b)


# ^. int, str, list. Uses Psum
def Ppow(a, b):
    if is_num(a) and is_num(b):
        return pow(a, b)
    if is_col(a) and isinstance(b, int):
        if isinstance(a, str):
            return [''.join(group) for group in itertools.product(a, repeat=b)]
        elif isinstance(a, list):
            return [list(group) for group in itertools.product(a, repeat=b)]
        elif isinstance(a, set):
            return [set(group) for group in itertools.product(a, repeat=b)]
        else:
            return [group for group in itertools.product(a, repeat=b)]
    raise BadTypeCombinationError("^", a, b)


# *. int, str, list.
def times(a, b):
    if is_col(a) and is_col(b):
        return list(itertools.product(a, b))
    else:
        return a*b


# (. All types
def Ptuple(*a):
    return a


# -. int, set.
def minus(a, b):
    if is_num(a) and is_num(b):
        return a-b
    if is_num(a) and is_col(b):
        if isinstance(b, str):
            return minus(str(a), b)
        if isinstance(b, list):
            return minus([a], b)
        if isinstance(b, set):
            return minus({a}, b)
        if isinstance(b, tuple):
            return minus((a,), b)
    if is_num(b) and is_col(a):
        if isinstance(a, str):
            return minus(a, str(b))
        if isinstance(a, list):
            return minus(a, [b])
        if isinstance(a, set):
            return minus(a, {b})
        if isinstance(a, tuple):<commit_msg>Added type checking error for *<commit_after>import copy
import fractions
import itertools
import math
import random
import re
import string
import sys
import collections
import numbers
from ast import literal_eval


# Type checking
def is_num(a):
    return isinstance(a, numbers.Number)


def is_seq(a):
    return isinstance(a, collections.Sequence)


def is_col(a):
    return isinstance(a, collections.Iterable)


# Error handling
class BadTypeCombinationError(Exception):
    def __init__(self, func, *args):
        self.args = args
        self.func = func

    def __str__(self):
        error_message = "\nError occured in function: %s" % self.func
        for i in range(len(self.args)):
            arg = self.args[i]
            arg_type = str(type(arg)).split("'")[1]
            error_message += "\nArg %d: %r, type %s." % (i + 1, arg, arg_type)
        return error_message


# Function library. See data for letter -> function correspondences.
# !. All.
def Pnot(a):
    return not a


# @.
def lookup(a, b):
    if isinstance(a, dict):
        return a[b]
    if is_seq(a) and isinstance(b, int):
        return a[b % len(a)]
    if is_col(a) and is_col(b):
        intersection = filter(lambda b_elm: b_elm in a, b)
        if isinstance(a, str):
            return ''.join(intersection)
        elif isinstance(a, tuple):
            return tuple(intersection)
        else:
            return list(intersection)
    raise BadTypeCombinationError("@", a, b)


# %. int, str.
def mod(a, b):
    if isinstance(a, int) and is_seq(b):
        return b[::a]
    if is_num(a) and is_num(b) or isinstance(a, str):
        return a % b
    raise BadTypeCombinationError("%", a, b)


# ^. int, str, list. Uses Psum
def Ppow(a, b):
    if is_num(a) and is_num(b):
        return pow(a, b)
    if is_col(a) and isinstance(b, int):
        if isinstance(a, str):
            return [''.join(group) for group in itertools.product(a, repeat=b)]
        elif isinstance(a, list):
            return [list(group) for group in itertools.product(a, repeat=b)]
        elif isinstance(a, set):
            return [set(group) for group in itertools.product(a, repeat=b)]
        else:
            return [group for group in itertools.product(a, repeat=b)]
    raise BadTypeCombinationError("^", a, b)


# *. int, str, list.
def times(a, b):
    if is_col(a) and is_col(b):
        return list(itertools.product(a, b))
    if is_num(a) and is_num(b) or\
            isinstance(a, int) and is_seq(b) or\
            is_seq(a) and isinstance(b, int):
        return a*b
    raise BadTypeCombinationError("*", a, b)


# (. All types
def Ptuple(*a):
    return a


# -. int, set.
def minus(a, b):
    if is_num(a) and is_num(b):
        return a-b
    if is_num(a) and is_col(b):
        if isinstance(b, str):
            return minus(str(a), b)
        if isinstance(b, list):
            return minus([a], b)
        if isinstance(b, set):
            return minus({a}, b)
        if isinstance(b, tuple):
            return minus((a,), b)
    if is_num(b) and is_col(a):
        if isinstance(a, str):
            return minus(a, str(b))
        if isinstance(a, list):
            return minus(a, [b])
        if isinstance(a, set):
            return minus(a, {b})
        if isinstance(a, tuple):
{'fraction_non_alphanumeric': 0.1284890067051302, 'fraction_numerical': 0.0006237330422579137, 'mean_word_length': 2.366929133858268, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6452445', 'n_tokens_mistral': 2145, 'n_tokens_neox': 2109, 'n_words': 649}