+
     þÎj+/  ã                   ó8  € R t ^ RIt^ RIHt ^ RIHt ^ RIHtHtH	t	 ^ RI
HtHt ^ RIHtHtHtHtHtHtHtHtHt ^ RIHt  ! R R	4      tR
 tR tR tR tR t]R 4       t ! R R4      t ]! ]PB                  ]PD                  ]PD                  4      R 4       t#R# )z€Utilities for defining a mutable struct.

A mutable struct is passed by reference;
hence, structref (a reference to a struct).

N)Úcreate_struct_proxy)Únjit)ÚtypesÚimputilsÚcgutils)Údefault_managerÚmodels)	Úinfer_getattrÚlower_getattr_genericÚlower_setattr_genericÚlower_builtinÚboxÚunboxÚNativeValueÚ	intrinsicÚoverload)ÚAttributeTemplatec                   óB   a € ] tR t^t o RtR tR tR tR tR t	Rt
V tR# )	Ú_Utilsz;Internal builder-code utils for structref definitions.
    c                ó*   € Wn         W n        W0n        R# )zˆ
Parameters
----------
context :
    a numba target context
builder :
    a llvmlite IRBuilder
struct_type : numba.core.types.StructRef
N)ÚcontextÚbuilderÚstruct_type)Úselfr   r   r   s   &&&&ÚR/opt/data/home/.local/lib/python3.14/site-packages/numba/experimental/structref.pyÚ__init__Ú_Utils.__init__   s   € ð ŒØŒØ&Öó    c                ó’   € V P                   pV P                  pV P                  p\        P                  ! V4      ! W#4      pWn        V# )zKEncapsulate the MemInfo from a `StructRefPayload` in a `StructRef`
        )r   r   r   r   r   Úmeminfo)r   Úmir   r   r   Ústs   &&    r   Únew_struct_refÚ_Utils.new_struct_ref+   s@   € ð —,‘,ˆØ—,‘,ˆØ×&Ñ&ˆä×(Ò(¨Ô5°gÓGˆØŒ
Øˆ	r   c                ó†   € V P                   pV P                  pV P                  p\        P                  ! V4      ! W#VR7      # )z6Return a helper for accessing a StructRefType
        ©Úvalue)r   r   r   r   r   )r   Úvalr   r   r   s   &&   r   Úget_struct_refÚ_Utils.get_struct_ref6   s>   € ð —,‘,ˆØ—,‘,ˆØ×&Ñ&ˆä×*Ò*¨;Ô7Ø Cô
ð 	
r   c                ób  € V P                   pV P                  pV P                  pV P                  V4      pVP                  pVP
                  P                  W64      pVP                  4       pVP                  V,          p	V	P                  4       p
VP                  WzP                  4       4      pV# )zDGet the data pointer to the payload from a `StructRefType`.
        )r   r   r   r(   r   ÚnrtÚmeminfo_dataÚget_data_typeÚdata_model_managerÚget_value_typeÚbitcastÚ
as_pointer)r   r'   r   r   r   Ú	structvalr   Údata_ptrÚvaltypeÚmodelÚ
alloc_types   &&         r   Úget_data_pointerÚ_Utils.get_data_pointerA   s˜   € ð —,‘,ˆØ—,‘,ˆØ×&Ñ&ˆà×'Ñ'¨Ó,ˆ	Ø×#Ñ#ˆØ—;‘;×+Ñ+¨GÓ=ˆà×+Ñ+Ó-ˆØ×*Ñ*¨7Õ3ˆØ×)Ñ)Ó+ˆ
Ø—?‘? 8×-BÑ-BÓ-DÓEˆØˆr   c                óÌ   € V P                   pV P                  pV P                  pV P                  V4      pVP	                  4       p\
        P                  ! V4      ! W#VR7      pV# )zFGet a getter/setter helper for accessing a `StructRefPayload`
        )Úref)r   r   r   r7   r-   r   r   )r   r'   r   r   r   r3   r4   Údatavals   &&      r   Úget_data_structÚ_Utils.get_data_structR   s`   € ð —,‘,ˆØ—,‘,ˆØ×&Ñ&ˆà×(Ñ(¨Ó-ˆØ×+Ñ+Ó-ˆÜ×-Ò-¨gÔ6Ø (ô
ˆð ˆr   )r   r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r"   r(   r7   r<   Ú__static_attributes__Ú__classdictcell__)Ú__classdict__s   @r   r   r      s(   ø‡ € ñò'ò	ò	
ò÷"ð r   r   c                ó‚   a € \          ! V 3R lR\        4      4       p\        S 4      R 4       p\        S 4      R 4       pR# )z‚Define attributes on `struct_typeclass`.

Defines both setters and getters in jit-code.

This is called directly in `register()`.
c                   ó.   <a € ] tR t^ht o  ZtR tRtV tR# )Ú*define_attributes.<locals>.StructAttributec                óP   € W!P                   9   d   VP                   V,          pV# R # ©N)Ú
field_dict)r   ÚtypÚattrÚattrtys   &&& r   Úgeneric_resolveÚ:define_attributes.<locals>.StructAttribute.generic_resolvel   s$   € Ø—~‘~Ô%ØŸ™¨Õ-�Ø�ñ &r   © N)r>   r?   r@   rA   ÚkeyrO   rC   rD   )rE   Ústruct_typeclasss   @€r   ÚStructAttributerH   h   s   ù‡ € áˆ÷	ð 	r   rT   c                 ó¦   € \        WV4      pVP                  V4      p\        Wd4      pVP                  V,          p\        P
                  ! WW‡4      # rJ   )r   r<   ÚgetattrrK   r   Úimpl_ret_borrowed)	r   r   rL   r'   rM   Úutilsr;   ÚretÚ	fieldtypes	   &&&&&    r   Ústruct_getattr_implÚ.define_attributes.<locals>.struct_getattr_implq   sI   € ä�w¨Ó-ˆØ×'Ñ'¨Ó,ˆÜ�gÓ$ˆØ—N‘N 4Õ(ˆ	Ü×)Ò)¨'¸IÓKÐKr   c                 óL  € VP                   w  rVVw  rx\        WV4      p	V	P                  V4      p
VP                  V,          pV P	                  WWk4      p\        W¤4      pV P                  P                  WV4       V P                  P                  WV4       \        W¤V4       R # rJ   )
Úargsr   r<   rK   ÚcastrV   r+   ÚincrefÚdecrefÚsetattr)r   r   Úsigr^   rM   Ú	inst_typeÚval_typeÚinstancer'   rX   r;   Ú
field_typeÚcastedÚ	old_values   &&&&&         r   Ústruct_setattr_implÚ.define_attributes.<locals>.struct_setattr_imply   s�   € à #§¡ÑˆØ‰ˆÜ�w¨Ó3ˆØ×'Ñ'¨Ó1ˆà×)Ñ)¨$Õ/ˆ
Ø—‘˜g¨HÓAˆä˜GÓ*ˆ	à�‰×Ñ˜7¨fÔ5à�‰×Ñ˜7¨iÔ8ä�˜vÖ&r   N)r	   r   r
   r   )rS   rT   r[   rj   s   f   r   Údefine_attributesrl   a   sU   ø€ ô ÷Ô+ó ó ðô Ð+Ó,ñLó -ðLô Ð+Ó,ñ'ó -ò'r   c                óÊ   a€ V \         P                  J d   \        R\         P                   24      hVP                  o\	        V 4      V3R l4       p\        V 4      R 4       pR# )a|  Define the boxing & unboxing logic for `struct_type` to `obj_class`.

Defines both boxing and unboxing.

- boxing turns an instance of `struct_type` into a PyObject of `obj_class`
- unboxing turns an instance of `obj_class` into an instance of
  `struct_type` in jit-code.


Use this directly instead of `define_proxy()` when the user does not
want any constructor to be defined.
úcannot register c                óš  <€ \        VP                  VP                  V 4      pVP                  V4      pVP                  p\
        P                  ! \
        P                  4      pVP                  We4      pVP                  P                  VP                  P                  S4      4      pVP                  P                  VP                  P                  V 4      4      p	VP                  P                  W‰V.4      p
VP                  P                  V4       VP                  P                  V	4       VP                  P                  V4       V
# )z(
Convert a raw pointer to a Python int.
)r   r   r   r(   r   r   ÚMemInfoPointerÚvoidptrr   ÚpyapiÚunserializeÚserialize_objectÚcall_function_objargsra   )rL   r'   ÚcrX   Ú
struct_refr   Úmip_typeÚboxed_meminfoÚctor_pyfuncÚty_pyobjÚresÚobj_ctors   &&&        €r   Úbox_struct_refÚ%define_boxing.<locals>.box_struct_refž   sñ   ø€ ô
 �q—y‘y !§)¡)¨SÓ1ˆØ×)Ñ)¨#Ó.ˆ
Ø×$Ñ$ˆä×'Ò'¬¯©Ó6ˆØŸ™˜hÓ0ˆà—g‘g×)Ñ)¨!¯'©'×*BÑ*BÀ8Ó*LÓMˆØ—7‘7×&Ñ& q§w¡w×'?Ñ'?ÀÓ'DÓEˆà�g‰g×+Ñ+Ø MÐ2ó
ˆð 	
�‰�‰�{Ô#Ø	�‰�‰�xÔ Ø	�‰�‰�}Ô%Øˆ
r   c                 óˆ  € VP                   P                  VR 4      p\        P                  ! \        P                  4      pVP                  WC4      P                  p\        VP                  VP                  V 4      pVP                  V4      pVP                  4       pVP                   P                  V4       \        V4      # )Ú_meminfo)rr   Úobject_getattr_stringr   rp   rq   r   r&   r   r   r   r"   Ú	_getvaluera   r   )	rL   Úobjrv   Úmi_objrx   r    rX   rw   Úouts	   &&&      r   Úunbox_struct_refÚ'define_boxing.<locals>.unbox_struct_refµ   s�   € à—‘×.Ñ.¨s°JÓ?ˆä×'Ò'¬¯©Ó6ˆà�W‰W�XÓ&×,Ñ,ˆä�q—y‘y !§)¡)¨SÓ1ˆØ×)Ñ)¨"Ó-ˆ
Ø×"Ñ"Ó$ˆà	�‰�‰�vÔÜ˜3ÓÐr   N)r   Ú	StructRefÚ
ValueErrorÚ_numba_box_r   r   )r   Ú	obj_classr~   r‡   r}   s   &&  @r   Údefine_boxingr�   Œ   sd   ø€ ð ”e—o‘oÓ%ÜÐ+¬E¯O©OÐ+<Ð=Ó>Ð>à×$Ñ$€HäˆÓôó ðô, ˆ;Óñ ó ò r   c                ó:  € RP                  V4      pRp. pV F  pVP                  RV RV 24       K  	  RV 2P                  V4      pRV R\        V4       RV RV R	V R
2p\        V\        R7      p	\        W‰4       V	R,          p
\        V 4      ! V
4       R# )zÉDefine the jit-code constructor for `struct_typeclass` using the
Python type `py_class` and the required `fields`.

Use this instead of `define_proxy()` if the user does not want boxing
logic defined.
z, zst.z = Ú
z

def ctor(z/):
    struct_type = struct_typeclass(list(zip(z, [z])))
    def impl(z)):
        st = new(struct_type)
        z#
        return st
    return impl
)rS   ÚnewÚctorNz        )ÚjoinÚappendÚlistÚdictr�   Úexecr   )Úpy_classrS   ÚfieldsÚparamsÚindentÚinit_fields_bufÚkÚinit_fieldsÚsourceÚglbsr‘   s   &&&        r   Údefine_constructorr    Å   sÂ   € ð �Y‰Y�vÓ€FØ€FØ€OÛˆØ×Ñ  Q C s¨1¨#˜Ö/ñ à�v�h�-×$Ñ$ _Ó5€Kð
Ø
ˆð -Ü-1°&«\¨N¸#¸f¸Xð FØˆXð 	à	ˆð ð€Fô Ð!1´sÔ;€DÜˆÔØ��<€DäˆXÔ�tÖr   c                ó4   € \        WV4       \        W4       R# )aÃ  Defines a PyObject proxy for a structref.

This makes `py_class` a valid constructor for creating a instance of
`struct_typeclass` that contains the members as defined by `fields`.

Parameters
----------
py_class : type
    The Python class for constructing an instance of `struct_typeclass`.
struct_typeclass : numba.core.types.Type
    The structref type class to bind to.
fields : Sequence[str]
    A sequence of field names.

Returns
-------
None
N)r    r�   )r—   rS   r˜   s   &&&r   Údefine_proxyr¢   å   s   € ô& �x°6Ô:ÜÐ"Ö-r   c                óÆ   € V \         P                  J d   \        R\         P                   24      h\        P                  ! V \
        P                  4       \        V 4       V # )aP  Register a `numba.core.types.StructRef` for use in jit-code.

This defines the data-model for lowering an instance of `struct_type`.
This defines attributes accessor and mutator for an instance of
`struct_type`.

Parameters
----------
struct_type : type
    A subclass of `numba.core.types.StructRef`.

Returns
-------
struct_type : type
    Returns the input argument so this can act like a decorator.

Examples
--------

.. code-block::

    class MyStruct(numba.core.types.StructRef):
        ...  # the simplest subclass can be empty

    numba.experimental.structref.register(MyStruct)

rn   )r   r‰   rŠ   r   Úregisterr   ÚStructRefModelrl   )r   s   &r   r¤   r¤   ü   sL   € ð8 ”e—o‘oÓ%ÜÐ+¬E¯O©OÐ+<Ð=Ó>Ð>Ü×Ò˜[¬&×*?Ñ*?Ô@Ü�kÔ"ØÐr   c                óN   aa€ ^ RI Ho VP                  oVV3R lpS! V4      pW23# )zùnew(struct_type)

A jit-code only intrinsic. Used to allocate an **empty** mutable struct.
The fields are zero-initialized and must be set manually after calling
the function.

Example:

    instance = new(MyStruct)
    instance.field = field_value
)Úimp_dtorc           	      ó0  <€ V P                   SP                  4       ,          pVP                  4       pV P                  V4      pV P                  P                  VV P                  \        P                  V4      S
! WP                  S4      4      pV P                  P                  W4      pVP                  W…P                  4       4      pVP                  \        P                  ! V4      V4       V P!                  VS4      p	Wyn        V	P%                  4       # rJ   )r.   r-   r/   Úget_abi_sizeofr+   Úmeminfo_alloc_dtorÚget_constantr   ÚuintpÚmoduler,   r0   r1   Ústorer   Úget_null_valueÚmake_helperr   rƒ   )r   r   Ú	signaturer^   r5   r6   Ú
alloc_sizer   Údata_pointerÚinst_structr§   rd   s   &&&&      €€r   ÚcodegenÚnew.<locals>.codegen0  sâ   ø€ à×*Ñ*¨9×+BÑ+BÓ+DÕEˆØ×)Ñ)Ó+ˆ
Ø×+Ñ+¨JÓ7ˆ
à—+‘+×0Ñ0ØØ× Ñ ¤§¡¨jÓ9Ù�WŸn™n¨iÓ8ó
ˆð
 —{‘{×/Ñ/°ÓAˆØ—‘ |×5JÑ5JÓ5LÓMˆð 	�‰”g×,Ò,¨ZÓ8¸,ÔGà×)Ñ)¨'°9Ó=ˆØ%Ôà×$Ñ$Ó&Ð&r   )Ú numba.experimental.jitclass.baser§   Úinstance_type)Ú	typingctxr   rµ   rc   r§   rd   s   &&  @@r   r�   r�     s,   ù€ õ :à×)Ñ)€Iö'ñ, �KÓ
 €CØˆ<Ðr   c                   óZ   a a€ ] tR tRt oRtRt]V 3R l4       tR t]	R 4       t
RtVtV ;t# )ÚStructRefProxyiJ  z¤A PyObject proxy to the Numba allocated structref data structure.

Notes
-----

* Subclasses should not define ``__init__``.
* Subclasses can override ``__new__``.
c                ó>   <€ \         SV `  V 4      pWn        W#n        V# )zïCalled by boxing logic, the conversion of Numba internal
representation into a PyObject.

Parameters
----------
ty :
    a Numba type instance.
mi :
    a wrapped MemInfoPointer.

Returns
-------
instance :
     a StructRefProxy instance.
)ÚsuperÚ__new__Ú_typer�   )ÚclsÚtyr    rf   Ú	__class__s   &&& €r   r‹   ÚStructRefProxy._numba_box_U  s#   ø€ ô" ‘7‘? 3Ó'ˆØŒØÔØˆr   c                óx   a €  S P                   pV! V!  #   \         d    \        T 3R l4       pTS n          L)i ; i)z¬Construct a new instance of the structref.

This takes positional-arguments only due to limitation of the compiler.
The arguments are mapped to ``cls(*args)`` in jit-code.
c                  ó   <€ S! V !  # rJ   rQ   )r^   rÀ   s   *€r   r‘   Ú$StructRefProxy.__new__.<locals>.ctorv  s   ø€ á˜D‘zÐ!r   )Ú_StructRefProxy__numba_ctorÚAttributeErrorr   )rÀ   r^   r‘   s   f* r   r¾   ÚStructRefProxy.__new__k  sL   ø€ ð		$à×#Ñ#ˆDñ �T‰{Ðøô ô 	$äô"ó ð"ð  $ˆCÖð	$ús   ƒ •!9¸9c                ó   € V P                   # )z^Returns the Numba type instance for this structref instance.

Subclasses should NOT override.
)r¿   )r   s   &r   Ú_numba_type_ÚStructRefProxy._numba_type_}  s   € ð �z‰zÐr   rQ   )r¿   r�   )r>   r?   r@   rA   rB   Ú	__slots__Úclassmethodr‹   r¾   ÚpropertyrË   rC   rD   Ú__classcell__)rÂ   rE   s   @@r   r»   r»   J  sA   ù‡ € ñð &€Iàôó ðò*ð$ ñó ÷ð r   r»   c                ó¾   € Vw  rEVP                   w  rg\        V4      ! WVR7      P                  p\        V4      ! WVR7      P                  p	VP                  RW‰4      # )z~
Define the 'is' operator for structrefs by comparing the memory addresses.
This is the identity check for structref objects.
r%   z==)r^   r   r   Úicmp_unsigned)
r   r   rc   r^   ÚaÚbÚatyÚbtyÚa_ptrÚb_ptrs
   &&&&      r   Ústructref_isrÙ   †  sW   € ð �D€AØ�x‰x�H€CÜ Ô$ W¸QÔ?×GÑG€EÜ Ô$ W¸QÔ?×GÑG€EØ× Ñ   uÓ4Ð4r   )$rB   ÚoperatorÚnumba.core.cgutilsr   Únumbar   Ú
numba.corer   r   r   Únumba.core.datamodelr   r   Únumba.core.extendingr	   r
   r   r   r   r   r   r   r   Únumba.core.typing.templatesr   r   rl   r�   r    r¢   r¤   r�   r»   Úis_r‰   rÙ   rQ   r   r   Ú<module>râ      s¥   ðñó Ý 2Ý ß /Ñ /ß 8÷
÷ 
õ 
õ :÷Dñ DòN('òV6 òrò@.ò. ðF ñ'ó ð'÷T9ñ 9ñx ˆx�|‰|˜UŸ_™_¨e¯o©oÓ>ñ	5ó ?ò	5r   