
    AeM                        d dl mZ  G d de      Z	 dZdZdZdZdZdZ	dZ
dZdZdZdZdZdZdZdZdZdZ ed      ZdZdZdZd	 Zi d
dddddddddddddddddddddddddddddddddi ddddddddd dd!dd"dd#dd$dd%dd&dd'dd(dd)dd*dd+d,d-di d.dd/dddd0dd1dd2dd3dd4dd5dd6dd7dd8dd9dd:dd;dd<dd=dddddg g ddd>Zdddd?Zd@ ZdA Zi d&ededBe dCededDed!edEedFddGddHddIddJddKedLedMe!dNe!ee" ed,dOdPdQ      eedRZ#ejI                         D ]  \  Z%Z&e%e#vs e!e&      e#e%<    i ddSdCdTddUdHdVdFdUdGdUdMdVdNdVdBdVdIdVdKdWdLdWdDdWdJdXd#dYd%dYd$dYdYdZdZdWdYdYdYdYdSdYdYdYdYd[d\Z'dad]Z(	 	 dbd^Z)d_ Z*dcd`Z+y)d    )absolute_importc                   0    e Zd Zg ZddZd Zd Zd Zd Zy)ShouldBeFromDirectiveNc                 l    || _         |xs || _        || _        | j                  j	                  |        y N)options_namedirective_namedisallowknown_directivesappend)selfr   r	   r
   s       7lib/python3.12/site-packages/Cython/Compiler/Options.py__init__zShouldBeFromDirective.__init__   s2    (,< $$T*    c                 $    | j                          y r   _bad_accessr   s    r   __nonzero__z!ShouldBeFromDirective.__nonzero__       r   c                 $    | j                          y r   r   r   s    r   __int__zShouldBeFromDirective.__int__   r   r   c                 *    t        t        |             r   )RuntimeErrorreprr   s    r   r   z!ShouldBeFromDirective._bad_access   s    4:&&r   c                 <    d| j                   d| j                  dS )NzIllegal access of 'z-' from Options module rather than directive '')r   r	   r   s    r   __repr__zShouldBeFromDirective.__repr__   s     d11	3	4r   )NF)	__name__
__module____qualname__r   r   r   r   r   r    r   r   r   r      s!    +'4r   r   TFNold_style_globals   c                  R   t         j                  D ]  } t               j                  | j                        }| j
                  t        v sJ t        |t               rK| j                  r&t        d| j                  d| j
                  d      |t        | j
                  <    t        S )NzOption 'z' must be set from directive 'r   )r   r   globalsgetr   r	   _directive_defaults
isinstancer
   r   option_name)
old_optionvalues     r   get_directive_defaultsr-      s     ,<< 
G
	j556((,???%!67"""**J,E,EGH H
 BG#J$=$=>
G r   boundscheck	nonecheckinitializedcheckembedsignature
auto_cpdefauto_pickle	cdivisioncdivision_warningsc_api_binop_methodscpowoverflowcheckzoverflowcheck.foldalways_allow_keywordsallow_none_for_extension_args
wraparoundccomplexcallspec nogilprofile	linetraceemit_code_commentsannotation_typinginfer_typeszinfer_types.verboseautotestdictzautotestdict.cdefzautotestdict.alllanguage_levelfast_getattr
py2_importpreliminary_late_includes_cy28iterable_coroutinec_string_typebytesc_string_encodingtype_version_tagunraisable_tracebacks
np_pythranfast_gilset_initial_pathwarnzwarn.undeclaredwarn.unreachablewarn.maybe_uninitializedwarn.unusedzwarn.unused_argzwarn.unused_resultzwarn.multiple_declaratorszoptimize.inline_defnode_callszoptimize.unpack_method_callsz&optimize.unpack_method_calls_in_pyinit)zoptimize.use_switchremove_unreachablezcontrol_flow.dot_outputzcontrol_flow.dot_annotate_defstest_assert_path_existstest_fail_if_path_existsbindingformal_grammar)rU   rT   rV   c                        fd}|S )Nc                 8    |vrt        | dd|d      |S )Nz directive must be one of z, got 'r   )
ValueError)namer,   argss     r   validatezone_of.<locals>.validate   s+    dE# $ $ Lr   r"   )r`   ra   s   ` r   one_ofrb      s     Or   c                     |sy|j                         dv r|j                         S ddl}	 |j                  |      }dD ]  }|j                  |      |k(  s|c S  |S # t        $ r |cY S w xY w)a  
    >>> normalise_encoding_name('c_string_encoding', 'ascii')
    'ascii'
    >>> normalise_encoding_name('c_string_encoding', 'AsCIi')
    'ascii'
    >>> normalise_encoding_name('c_string_encoding', 'us-ascii')
    'ascii'
    >>> normalise_encoding_name('c_string_encoding', 'utF8')
    'utf8'
    >>> normalise_encoding_name('c_string_encoding', 'utF-8')
    'utf8'
    >>> normalise_encoding_name('c_string_encoding', 'deFAuLT')
    'default'
    >>> normalise_encoding_name('c_string_encoding', 'default')
    'default'
    >>> normalise_encoding_name('c_string_encoding', 'SeriousLyNoSuch--Encoding')
    'SeriousLyNoSuch--Encoding'
    r>   )defaultasciiutf8r   N)re   rf   )lowercodecs
getdecoderLookupError)r*   encodingrh   decoderr_   s        r   normalise_encoding_namerm   	  s    & ~~77~~##H- " T"g-K O  s   A A+*A+localsfinalinternalrZ   cfuncccallinlinestaticmethodcclassno_gc_clearno_gcreturns	exceptval	bytearraystrunicode)rR   freelistrK   rM   r7   )moduleru   )ru   function)r   with statement)r   )ru   )classru   r   )r~   )r   r   ru   )r~   r   )rR   rX   rY   r}   rB   rC   rK   rM   rN   rF   r#   rP   rQ   rJ   c                    t         j                  |       }|sy|}|t        u rDt        |      }|dk(  ry|dk(  ry|r|j	                         }|dv ry|dv ryt        | d|d	      |t        u r	 t        |      S |t        u rt        |      S t        |      r	 || |      S J # t
        $ r t        | d
|d	      w xY w)a  
    Parses value as an option value for the given name and returns
    the interpreted value. None is returned if the option does not exist.

    >>> print(parse_directive_value('nonexisting', 'asdf asdfd'))
    None
    >>> parse_directive_value('boundscheck', 'True')
    True
    >>> parse_directive_value('boundscheck', 'true')
    Traceback (most recent call last):
       ...
    ValueError: boundscheck directive must be set to True or False, got 'true'

    >>> parse_directive_value('c_string_encoding', 'us-ascii')
    'ascii'
    >>> parse_directive_value('c_string_type', 'str')
    'str'
    >>> parse_directive_value('c_string_type', 'bytes')
    'bytes'
    >>> parse_directive_value('c_string_type', 'bytearray')
    'bytearray'
    >>> parse_directive_value('c_string_type', 'unicode')
    'unicode'
    >>> parse_directive_value('c_string_type', 'unnicode')
    Traceback (most recent call last):
    ValueError: c_string_type directive must be one of ('bytes', 'bytearray', 'str', 'unicode'), got 'unnicode'
    NTrueTFalseF)trueyes)falsenoz. directive must be set to True or False, got 'r   z+ directive must be set to an integer, got ')directive_typesr'   boolr{   rg   r^   intcallable)r_   r,   relaxed_booltype
orig_values        r   parse_directive_valuer   p  s    8 t$DJt|E
F?GKKME'/)*  			#u: 
5z	$D%    	#j" # #	#s   0
B$ $B?c                    |i }n|}| j                  d      D ]  }|j                         }|sd|vrt        d|z        |j                         j                  dd      D  cg c]  } | j                          c} \  }}|t        vr^d}|j	                  d      r7|dd }	t        D ])  }
|
j                  |	      sd	}t        |
||
      }|||
<   + |r|rt        d|z        t        |||
      }|||<    |S c c} w )aJ  
    Parses a comma-separated list of pragma options. Whitespace
    is not considered.

    >>> parse_directive_list('      ')
    {}
    >>> (parse_directive_list('boundscheck=True') ==
    ... {'boundscheck': True})
    True
    >>> parse_directive_list('  asdf')
    Traceback (most recent call last):
       ...
    ValueError: Expected "=" in option "asdf"
    >>> parse_directive_list('boundscheck=hey')
    Traceback (most recent call last):
       ...
    ValueError: boundscheck directive must be set to True or False, got 'hey'
    >>> parse_directive_list('unknown=True')
    Traceback (most recent call last):
       ...
    ValueError: Unknown option: "unknown"
    >>> warnings = parse_directive_list('warn.all=True')
    >>> len(warnings) > 1
    True
    >>> sum(warnings.values()) == len(warnings)  # all true.
    True
    N,=Expected "=" in option "%s"   Fz.allT)r   zUnknown option: "%s")splitstripr^   r(   endswith
startswithr   )sr   ignore_unknowncurrent_settingsresultitemr_   r,   foundprefix	directiveparsed_values               r   parse_directive_listr     s   : ! (zz|d?:TABB*.**,*<*<S!*DEQqwwyEe**E}}V$cr!4 9I ++F3 $'<Y\h'i,8y)	9
  !7$!>??0u<XL'F4L)(* M Fs   #C=c                     | dk(  ry| dk(  ry| dk(  ry| j                         rt        |       S 	 t        |       } | S # t        $ r Y | S w xY w)a  
    Parses value as an option value for the given name and returns
    the interpreted value.

    >>> parse_variable_value('True')
    True
    >>> parse_variable_value('true')
    'true'
    >>> parse_variable_value('us-ascii')
    'us-ascii'
    >>> parse_variable_value('str')
    'str'
    >>> parse_variable_value('123')
    123
    >>> parse_variable_value('1.23')
    1.23

    r   Tr   FNoneN)isdigitr   float	Exception)r,   s    r   parse_variable_valuer     sd    & 	'		&	5z	%LE   		s   < 	A	A	c                    |i }n|}| j                  d      D ]f  }|j                         }|sd|vrt        d|z        |j                  dd      D  cg c]  } | j                          c} \  }}t        |      ||<   h |S c c} w )a  
    Parses a comma-separated list of pragma options. Whitespace
    is not considered.

    >>> parse_compile_time_env('      ')
    {}
    >>> (parse_compile_time_env('HAVE_OPENMP=True') ==
    ... {'HAVE_OPENMP': True})
    True
    >>> parse_compile_time_env('  asdf')
    Traceback (most recent call last):
       ...
    ValueError: Expected "=" in option "asdf"
    >>> parse_compile_time_env('NUM_THREADS=4') == {'NUM_THREADS': 4}
    True
    >>> parse_compile_time_env('unknown=anything') == {'unknown': 'anything'}
    True
    r   r   r   r   )r   r   r^   r   )r   r   r   r   r_   r,   s         r   parse_compile_time_envr   	  s    & ! 3zz|d?:TABB*.**S!*<=Qqwwy=e+E2t3 M >s   B)F)FFNr   ),
__future__r   objectr   
docstringsembed_pos_in_docstringrB   
pre_importgenerate_cleanup_codeclear_to_noneannotateannotate_coverage_xml	fast_failwarning_errorserror_on_unknown_nameserror_on_uninitializedconvert_rangecache_builtinsgcc_branch_hintslookup_module_cpdefembedr#   cimport_from_pyxbuffer_max_dimsclosure_freelist_sizer-   r(   extra_warningsrb   rm   r{   r   dictr   r   r   itemskeyvaldirective_scopesr   r   r   r   r"   r   r   <module>r      s"  
 '4F 42 
  
   
       	            	 **=>   
   $JDJ%J J u	J
 %J 4J J %J 4J DJ UJ $J UJ $TJ 4J  !J" #J$ e%J& u'J( )J* $+J, -J. 4/J0 51J2 D3J4 5J6 7J8 d9J: E;J< %=J> %e?J@ %AJB WCJD EJF GJH TIJJ KJL %MJN OJT UJX DYJZ u[J\ ]J^ _J` 5aJb ucJd %eJf  gJl $TmJn #DoJp -eqJr     "&+ !#!# SJ \ !%Fc4 d d	
 d  D  d d t T t D d  !" #$ G[%C0-2 $))+ )HC
/!#Cy)$'$ $$ ,	$
 }$ ,$ ,$ $ -$ }$ ]$ K$ k$ $ 4$  [!$" #$$ +%$& % ?!@%$ $,! %0G$ N9x @E*.6r!Hr   