o
    8Î®c¡  ã                   @   s   d dl mZmZ ddd„ZdS )é    )ÚtypesÚconfigNc                    sB   | durˆ du rt | tƒs| ‰ d} ‡ fdd„}| du r|S || ƒS )a¦  
    A function for creating a jitclass.
    Can be used as a decorator or function.

    Different use cases will cause different arguments to be set.

    If specified, ``spec`` gives the types of class fields.
    It must be a dictionary or sequence.
    With a dictionary, use collections.OrderedDict for stable ordering.
    With a sequence, it must contain 2-tuples of (fieldname, fieldtype).

    Any class annotations for field names not listed in spec will be added.
    For class annotation `x: T` we will append ``("x", as_numba_type(T))`` to
    the spec if ``x`` is not already a key in spec.


    Examples
    --------

    1) ``cls_or_spec = None``, ``spec = None``

    >>> @jitclass()
    ... class Foo:
    ...     ...

    2) ``cls_or_spec = None``, ``spec = spec``

    >>> @jitclass(spec=spec)
    ... class Foo:
    ...     ...

    3) ``cls_or_spec = Foo``, ``spec = None``

    >>> @jitclass
    ... class Foo:
    ...     ...

    4) ``cls_or_spec = spec``, ``spec = None``
    In this case we update ``cls_or_spec, spec = None, cls_or_spec``.

    >>> @jitclass(spec)
    ... class Foo:
    ...     ...

    5) ``cls_or_spec = Foo``, ``spec = spec``

    >>> JitFoo = jitclass(Foo, spec)

    Returns
    -------
    If used as a decorator, returns a callable that takes a class object and
    returns a compiled version.
    If used as a function, returns the compiled class (an instance of
    ``JitClassType``).
    Nc                    s*   t jr| S ddlm}m} || ˆ tj|ƒS )Nr   )Úregister_class_typeÚClassBuilder)r   ÚDISABLE_JITÚ numba.experimental.jitclass.baser   r   r   Ú	ClassType)Úclsr   r   ©Úspec© úM/tmp/pip-target-vg8gfxp4/lib/python/numba/experimental/jitclass/decorators.pyÚwrapG   s   zjitclass.<locals>.wrap)Ú
isinstanceÚtype)Úcls_or_specr   r   r   r
   r   Újitclass   s   9ÿþr   )NN)Ú
numba.corer   r   r   r   r   r   r   Ú<module>   s    