<commit_before>import numba
from numba import types, typing
from numba.typing.templates import (signature, AbstractTemplate, infer,
        ConcreteTemplate, AttributeTemplate, bound_function, infer_global)
from numba.extending import typeof_impl, lower_cast
from numba.extending import type_callable, box, unbox, NativeValue
from numba.extending import models, register_model, infer_getattr
from numba.extending import lower_builtin, overload_method
from numba import cgutils
from llvmlite import ir as lir
import llvmlite.binding as ll

class DictType(types.Opaque):
    def __init__(self, key_typ, val_typ):
        self.key_typ = key_typ
        self.val_typ = val_typ
        super(DictType, self).__init__(name='DictType')

dict_int_int_type = DictType(types.intp, types.intp)

class DictIntInt(object):
    def __new__(cls, *args):
        return {}

@typeof_impl.register(DictIntInt)
def typeof_index(val, c):
    return dict_int_int_type

@type_callable(DictIntInt)
def type_dict(context):
    def typer():
        return dict_int_int_type
    return typer

@infer
class SetItemDict(AbstractTemplate):
    key = "setitem"

    def generic(self, args, kws):
        dict_t, idx, value = args
        if isinstance(dict_t, DictType):
            if isinstance(idx, types.Integer):
                return signature(types.none, dict_t, idx, dict_t.val_typ)

@infer
class GetItemDict(AbstractTemplate):
    key = "getitem"

    def generic(self, args, kws):
        dict_t, idx = args
        if isinstance(dict_t, DictType):
            if isinstance(idx, types.Integer):
                return signature(dict_t.val_typ, dict_t, idx)

@infer
class PrintDictIntInt(ConcreteTemplate):
    key = "print_item"
    cases = [signature(types.none, dict_int_int_type)]

@infer_getattr
class DictAttribute(AttributeTemplate):
    key = dict_int_int_type

    @bound_function("dict.get")
    def resolve_get(self, dict, args, kws):
        assert not kws
        assert len(args) == 2
        return signature(args[1], *args)

    @bound_function("dict.pop")
    def resolve_pop(self, dict, args, kws):
        assert not kws
        return signature(types.intp, *args)

    @bound_function("dict.keys")
    def resolve_keys(self, dict, args, kws):
        assert not kws
        return signature(dict_key_iterator_int_int_type)

register_model(DictType)(models.OpaqueModel)

@box(DictType)
def box_dict(typ, val, c):
    """
    """
    # interval = cgutils.create_struct_proxy(typ)(c.context, c.builder, value=val)
    # lo_obj = c.pyapi.float_from_double(interval.lo)
    # hi_obj = c.pyapi.float_from_double(interval.hi)
    class_obj = c.pyapi.unserialize(c.pyapi.serialize_object(DictIntInt))
    res = c.pyapi.call_function_objargs(class_obj, (val,))
    # c.pyapi.decref(lo_obj)
    # c.pyapi.decref(hi_obj)
    c.pyapi.decref(class_obj)
    return res

class DictKeyIteratorType(types.SimpleIterableType):
    def __init__(self, key_typ, val_typ):
        self.key_typ = key_typ
        self.val_typ = val_typ
        super(types.SimpleIterableType, self).__init__('DictKeyIteratorType')

dict_key_iterator_int_int_type = DictKeyIteratorType(types.intp, types.intp)

register_model(DictKeyIteratorType)(models.OpaqueModel)

@infer_global(min)
@infer_global(max)
class MinMaxDict(AbstractTemplate):
    def generic(self, args, kws):<commit_msg>dict int32 int32 type<commit_after>import numba
from numba import types, typing
from numba.typing.templates import (signature, AbstractTemplate, infer,
        ConcreteTemplate, AttributeTemplate, bound_function, infer_global)
from numba.extending import typeof_impl, lower_cast
from numba.extending import type_callable, box, unbox, NativeValue
from numba.extending import models, register_model, infer_getattr
from numba.extending import lower_builtin, overload_method
from numba import cgutils
from llvmlite import ir as lir
import llvmlite.binding as ll

class DictType(types.Opaque):
    def __init__(self, key_typ, val_typ):
        self.key_typ = key_typ
        self.val_typ = val_typ
        super(DictType, self).__init__(name='DictType{}{}'.format(key_typ, val_typ))

dict_int_int_type = DictType(types.intp, types.intp)
dict_int32_int32_type = DictType(types.int32, types.int32)

class DictIntInt(object):
    def __new__(cls, *args):
        return {}

class DictInt32Int32(object):
    def __new__(cls, *args):
        return {}

@typeof_impl.register(DictIntInt)
def typeof_index(val, c):
    return dict_int_int_type

@typeof_impl.register(DictInt32Int32)
def typeof_index(val, c):
    return dict_int32_int32_type

@type_callable(DictIntInt)
def type_dict(context):
    def typer():
        return dict_int_int_type
    return typer

@type_callable(DictInt32Int32)
def type_dict(context):
    def typer():
        return dict_int32_int32_type
    return typer

@infer
class SetItemDict(AbstractTemplate):
    key = "setitem"

    def generic(self, args, kws):
        dict_t, idx, value = args
        if isinstance(dict_t, DictType):
            if isinstance(idx, types.Integer):
                return signature(types.none, dict_t, idx, dict_t.val_typ)

@infer
class GetItemDict(AbstractTemplate):
    key = "getitem"

    def generic(self, args, kws):
        dict_t, idx = args
        if isinstance(dict_t, DictType):
            if isinstance(idx, types.Integer):
                return signature(dict_t.val_typ, dict_t, idx)

@infer
class PrintDictIntInt(ConcreteTemplate):
    key = "print_item"
    cases = [signature(types.none, dict_int_int_type),
            signature(types.none, dict_int32_int32_type)]

@infer_getattr
class DictAttribute(AttributeTemplate):
    key = DictType

    @bound_function("dict.get")
    def resolve_get(self, dict, args, kws):
        assert not kws
        assert len(args) == 2
        return signature(args[1], *args)

    @bound_function("dict.pop")
    def resolve_pop(self, dict, args, kws):
        assert not kws
        return signature(dict.val_typ, *args)

    @bound_function("dict.keys")
    def resolve_keys(self, dict, args, kws):
        assert not kws
        return signature(DictKeyIteratorType(dict.key_typ, dict.val_typ))

register_model(DictType)(models.OpaqueModel)

@box(DictType)
def box_dict(typ, val, c):
    """
    """
    # interval = cgutils.create_struct_proxy(typ)(c.context, c.builder, value=val)
    # lo_obj = c.pyapi.float_from_double(interval.lo)
    # hi_obj = c.pyapi.float_from_double(interval.hi)
    class_obj = c.pyapi.unserialize(c.pyapi.serialize_object(DictIntInt))
    res = c.pyapi.call_function_objargs(class_obj, (val,))
    # c.pyapi.decref(lo_obj)
    # c.pyapi.decref(hi_obj)
    c.pyapi.decref(class_obj)
    return res

class DictKeyIteratorType(types.SimpleIterableType):
    def __init__(self, key_typ, val_typ):
        self.key_typ = key_typ
        self.val_typ = val_typ
        super(types.SimpleIterableType, self).__init__(
                            'DictKeyIteratorType{}{}'.format(key_typ, val_typ))

dict_key_iterator_int_int_type = DictKeyIteratorType(types.intp, types.intp)

register_model(DictKeyIteratorType)(models.OpaqueModel)

@infer_global(min)
@infer_global(max)
class MinMaxDict(AbstractTemplate):
    def generic(self, args, kws):
{'fraction_non_alphanumeric': 0.1012605624047652, 'fraction_numerical': 0.0055409336473195734, 'mean_word_length': 3.914908100748809, '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': '7272405', 'n_tokens_mistral': 2463, 'n_tokens_neox': 2416, 'n_words': 502}