3
:]L              :   @   s  d dl mZ G d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	d
 Z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dddddddddddddddddddg g ddd9ZddddZdd Zdd Zeee eeeeedddddeee!e!ee"eddddedZ#x,ej$ D ] \Z%Z&e%e#krTe!e&e#e%< qTW d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdZ'dDddZ(dEdd Z)d!d" Z*dFd#d$Z+dS )G    )absolute_importc               @   s:   e Zd Zg ZdddZdd Zdd Zd	d
 Zdd ZdS )ShouldBeFromDirectiveNFc             C   s&   || _ |p|| _|| _| jj|  d S )N)options_namedirective_namedisallowknown_directivesappend)selfr   r   r    r
   g/home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python3.6/site-packages/Cython/Compiler/Options.py__init__   s    
zShouldBeFromDirective.__init__c             C   s   | j   d S )N)_bad_access)r	   r
   r
   r   __nonzero__   s    z!ShouldBeFromDirective.__nonzero__c             C   s   | j   d S )N)r   )r	   r
   r
   r   __int__   s    zShouldBeFromDirective.__int__c             C   s   t t| d S )N)RuntimeErrorrepr)r	   r
   r
   r   r      s    z!ShouldBeFromDirective._bad_accessc             C   s   d| j | jf S )NzEIllegal access of '%s' from Options module rather than directive '%s')r   r   )r	   r
   r
   r   __repr__   s    zShouldBeFromDirective.__repr__)NF)	__name__
__module____qualname__r   r   r   r   r   r   r
   r
   r
   r   r      s   
r   TFNold_style_globals   c              C   s`   xZt jD ]P} t j| j}| jtks(tt|t s| j	rNt
d| j| jf q|t| j< qW tS )Nz+Option '%s' must be set from directive '%s')r   r   globalsgetr   r   _directive_defaultsAssertionError
isinstancer   r   option_name)
old_optionvaluer
   r
   r   get_directive_defaults   s    
r     bytes)9boundscheck	nonecheckinitializedcheckembedsignature
auto_cpdefauto_pickle	cdivisioncdivision_warnings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c_string_encodingtype_version_tagunraisable_tracebacksr   
np_pythranfast_gilset_initial_pathwarnzwarn.undeclaredzwarn.unreachablezwarn.maybe_uninitializedzwarn.unusedzwarn.unused_argzwarn.unused_resultzwarn.multiple_declaratorszoptimize.inline_defnode_callszoptimize.unpack_method_callsz&optimize.unpack_method_calls_in_pyinitz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)zwarn.maybe_uninitializedzwarn.unreachablezwarn.unusedc                 s    fdd}|S )Nc                s$   | krt d|  |f n|S d S )Nz(%s directive must be one of %s, got '%s')
ValueError)namer   )argsr
   r   validate   s    zone_of.<locals>.validater
   )rL   rM   r
   )rL   r   one_of   s    rN   c             C   sl   |sdS |j  dkr|j  S ddl}y|j|}W n tk
rF   |S X xdD ]}|j||krN|S qNW |S )	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)rO   rP   rQ   )rP   rQ   )lowercodecs
getdecoderLookupError)r   encodingrS   decoderrK   r
   r
   r   normalise_encoding_name  s    
rX   	bytearraystrunicode)r8   r(   localsfinalr1   internalr6   rH   cfuncccallinlinestaticmethodcclassno_gc_clearno_gcreturns	exceptvalrC   freelistr=   r>   modulerc   functionwith statementclass)r(   r]   r1   ra   r_   r`   rf   rg   r\   rb   rd   re   r^   rc   r7   zautotestdict.allzautotestdict.cdefrC   rF   rG   rh   r4   r5   r=   r>   r?   r8   r   rA   rB   r<   c             C   s   t j| }|sdS |}|tkrtt|}|dkr2dS |dkr>dS |rb|j }|dkrVdS |dkrbdS td
| |f nb|tkryt|S  tk
r   td| |f Y qX n*|tkrt|S t|r|| |S dstdS )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noz3%s directive must be set to True or False, got '%s'z0%s directive must be set to an integer, got '%s')ro   rp   )rq   rr   )	directive_typesr   boolrZ   rR   rJ   intcallabler   )rK   r   relaxed_booltype
orig_valuer
   r
   r   parse_directive_valuem  s:    

rz   c             C   s   |dkri }n|}x| j dD ]}|j }|s0qd|krDtd| dd |j j ddD \}}|tkrd}|jd	r|dd }	x0tD ](}
|
j|	rd}t|
||d}|||
< qW | r| rtd| qt|||d}|||< qW |S )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,=zExpected "=" in option "%s"c             S   s   g | ]}|j  qS r
   )strip).0sr
   r
   r   
<listcomp>  s    z(parse_directive_list.<locals>.<listcomp>   Fz.all   T)rw   zUnknown option: "%s")splitr}   rJ   r   endswith
startswithrz   )r   rw   ignore_unknowncurrent_settingsresultitemrK   r   foundprefix	directiveparsed_valuer
   r
   r   parse_directive_list  s0    


r   c             C   s^   | dkrdS | dkrdS | dkr$dS | j  r4t| S yt| } W n tk
rT   Y nX | S dS )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

    rm   Trn   FNoneN)isdigitru   float	Exception)r   r
   r
   r   parse_variable_value  s    r   c             C   sr   |dkri }n|}xZ| j dD ]L}|j }|s0qd|krDtd| dd |j ddD \}}t|||< qW |S )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
    Nr{   r|   zExpected "=" in option "%s"c             S   s   g | ]}|j  qS r
   )r}   )r~   r   r
   r
   r   r   #  s    z*parse_compile_time_env.<locals>.<listcomp>r   )r   r}   rJ   r   )r   r   r   r   rK   r   r
   r
   r   parse_compile_time_env  s    r   )ri   rc   )rc   rj   )rj   rk   )rj   )rj   rk   )rj   rk   )rj   )rj   )rj   )rj   )rc   )rc   )rc   )rl   rc   rk   )ri   )ri   )ri   )ri   )rj   rl   rc   )rj   rl   rc   )rc   )ri   )ri   )ri   )ri   )ri   rc   )ri   )ri   )ri   )ri   )ri   rj   )F)FFN)N),
__future__r   objectr   
docstringsembed_pos_in_docstringr4   
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_warningsrN   rX   rZ   rt   dictrx   ru   rs   itemskeyvaldirective_scopesrz   r   r   r   r
   r
   r
   r   <module>   s"  &
	

$

< 
8$