
    J/PhV                        d dl Z d dlmZmZmZ d dlmZmZmZm	Z	m
Z
 d Zd Zd Z  ee j        ej        ej                  e             ee j        ej        ej                  e             ee j        ej        ej                  e            eej                  d             Z e
ej                  d             Z eej        ej                  d	             Z eej        ej                  d
             Z eej        ej                   eej        ej                  d                         ZdS )    N)typestypingcgutils)
lower_castlower_builtinlower_getattr_genericimpl_ret_untrackedlower_setattr_genericc                     t           j        S N)r   true_bitcontextbuildersigargss       S/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/numba/core/optional.pyalways_return_true_implr   
   s        c                     t           j        S r   )r   	false_bitr   s       r   always_return_false_implr      s    r   c                    |j         \  }}|\  }}|t          j        k    r||}}||}}|}|}	|                     |||	          }
|                    t          j        ||
j                            }t          | ||j	        |          S )z/
    Check if an Optional value is invalid
    )
r   r   nonemake_helpernot_r   as_bool_bitvalidr	   return_type)r   r   r   r   ltyrtylvalrvalopt_typeopt_valoptress               r   optional_is_noner(      s     JS#LT4 ejS4dHG


gx
9
9C
,,w*7CI>>
?
?CgwEEEr   c                     |j         }|                     ||||          }|                     ||          } || ||||          S )z?
    Optional.__getattr__ => redirect to the wrapped type.
    )typecastget_getattr)r   r   typvalueattr
inner_typevalimps           r   optional_getattrr3   .   sO    
 J
,,wsJ
7
7C


j$
/
/C3wS$777r   c                     |j         \  }}|\  }}|j        }	|                     ||||	          }t          j        |j        |	|          }
|                     ||
          } ||||f          S )z?
    Optional.__setattr__ => redirect to the wrapped type.
    )r   r*   r+   r   	signaturer   get_setattr)r   r   r   r   r/   basetyvaltytargetr1   target_typenewsigr2   s               r   optional_setattrr<   9   sw    
 HMFEKFC+K\\'66;??Fco{EBBF


dF
+
+C3w&&&r   c                 d   |                      |||          }t          j        ||j                  }|                      ||          }|                    |          5 \  }}	|5  t          j        |_        |                     ||j        |j        |j                  |_        ddd           n# 1 swxY w Y   |	5  t          j	        |_        t          j
        |j        j                  |_        ddd           n# 1 swxY w Y   ddd           n# 1 swxY w Y   |                                S )a  
    The handling of optional->optional cast must be special cased for
    correct propagation of None value.  Given type T and U. casting of
    T? to U? (? denotes optional) should always succeed.   If the from-value
    is None, the None value the casted value (U?) should be None; otherwise,
    the from-value is casted to U. This is different from casting T? to U,
    which requires the from-value must not be None.
    r.   N)r   r   r   r   if_elser   r+   datar*   r   get_null_value	_getvalue)
r   r   fromtytotyr1   optvalvalidbit	outoptvalis_validis_not_valids
             r   optional_to_optionalrJ   H   s      & <<F"7FL99H##GT22I		"	" %&>x 	B 	B%.IO$\\'6;*0+tyB BIN	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B  	% 	%%/IO$3#% %IN	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	%% % % % % % % % % % % % % % %    sZ   D$>B."D.B2	2D5B2	6D;5C<0D<D 	 DD 	DDDc                     |t           j        k    r|                     ||j                  S |                     ||||j                  }|                     ||j        |          S r   )r   r   make_optional_noner*   r+   make_optional_value)r   r   rC   rD   r1   s        r   any_to_optionalrN   g   sZ    ))'49===ll7C;;**7DIsCCCr   c                    |                      |||          }t          j        ||j                  }|                    |                    |          d          5  d|j        d}| j                            |t          |f           d d d            n# 1 swxY w Y   | 
                    ||j        |j        |          S )Nr>   F)likelyz	expected z
, got None)r   r   r   r   if_thenr   r*   	call_convreturn_user_exc	TypeErrorr+   r@   )r   r   rC   rD   r1   rE   rF   msgs           r   optional_to_anyrV   p   s	      & <<F"7FL99H	h//	>	> F F F)/6))'9sfEEEF F F F F F F F F F F F F F F <<fk4@@@s   .BBB)operator
numba.corer   r   r   numba.core.imputilsr   r   r   r	   r
   r   r   r(   is_r   Optionalr3   r<   rJ   AnyrN   BooleanrV    r   r   <module>r_      s    - - - - - - - - - -8 8 8 8 8 8 8 8 8 8 8 8 8 8
    F F F* 4hlEJ
 3 34K L L L 8hlENEJ 7 78H I I I 7hlEJ 7 78H I I I u~&&8 8 '&8 u~&&' ' '&' ENEN++! ! ,+!< EIu~&&D D '&D ENEI&&ENEM**A A +* '&A A Ar   