+
    :i+/                     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# )zUtilities 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   &&&&Z/var/www/html/photoedit/myenv/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@     ,,,,&&((5g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# )zDefine 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W4      # 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$NN4(	))'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\        W4      pV P                  P                  WV4       V P                  P                  WV4       \        WV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))$/
gHAG*	7f57i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                  WV.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    
 qyy!))S1))#.
$$''6h0gg))!''*B*B8*LM77&&qww'?'?'DEgg++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    ..sJ?''6WWX&,,qyy!))S1))"-
""$	v3r   N)r   	StructRef
ValueError_numba_box_r   r   )r   	obj_classr~   r   r}   s   &&  @r   define_boxingr      sd     eoo%+EOO+<=>>$$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	\        W4       V	R,          p
\        V 4      ! V
4       R# )zDefine 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     YYvFFOQCs1#/ vh-$$_5K

 --1&\N#fX FX 		 F !1s;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    & x6:"-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 eoo%+EOO+<=>>[&*?*?@k"r   c                N   aa ^ RI Ho VP                  oVV3R lpS! V4      pW23# )znew(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                  WP                  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Wnni8

 {{//A|5J5J5L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  zA 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# )zCalled 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)zConstruct 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    Dz!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     zz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W4      # )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     DAxxHC$WQ?GGE$WQ?GGE  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__eoo>	5 ?	5r   