3
hw              D   @   s  d dl mZ d dlZ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ed	ZdZd
Zd
Zd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dddddddddg g g g ddCZddddZdd Zdd Z G dd dZ!e! Z!e"e#e$e#ede!e!de#e#e#ddde#ddde#e#e%e%e"e&edddde e#de!e!edddd Z'x,ej( D ] \Z)Z*e)e'kre%e*e'e)< qW dFdGdHdId$dJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmd&)Z+d'd(d"d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9hZ,dnd:d;Z-dod<d=Z.d>d? Z/dpd@dAZ0G dBdC dCeZ1e$d d dDd ddddd d ddd d i i dddddddddddddddddE Z2dS )q    )absolute_importN   )Utilsc               @   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   i/var/www/html/CrowdFlow/Picklecon/ble_analysis_env/lib/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   TF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)Z
old_optionvaluer   r   r   get_directive_defaults   s    
r!   c             K   s0   t | }xdD ]}|j|d  qW |j| |S )Ntest_assert_path_existstest_fail_if_path_existstest_assert_c_code_hastest_fail_if_c_code_has)r"   r#   r$   r%   )dictpopupdate)Zouter_directivesZnew_directivesZnew_directives_outnamer   r   r   copy_inherited_directives   s
    

r*   c bytes)CbindingZboundscheckZ	nonecheckZinitializedcheckZembedsignaturezembedsignature.formatZ
auto_cpdefauto_pickleZ	cdivisionZcdivision_warningscpowZc_api_binop_methodsZoverflowcheckzoverflowcheck.foldZalways_allow_keywordsZallow_none_for_extension_argsZ
wraparoundZccomplexZcallspecnogilgilwith_gilZprofileZ	linetraceemit_code_commentsZannotation_typinginfer_typeszinfer_types.verboseautotestdictzautotestdict.cdefzautotestdict.alllanguage_levelZfast_getattrZ
py2_importZpreliminary_late_includes_cy28iterable_coroutinec_string_typec_string_encodingtype_version_tagZunraisable_tracebacksr   
np_pythranfast_gil
cpp_localslegacy_implicit_noexceptset_initial_pathwarnzwarn.undeclaredzwarn.unreachablezwarn.maybe_uninitializedzwarn.unusedzwarn.unused_argzwarn.unused_resultzwarn.multiple_declaratorsZshow_performance_hintszoptimize.inline_defnode_callszoptimize.unpack_method_callsz&optimize.unpack_method_calls_in_pyinitzoptimize.use_switchZremove_unreachablezcontrol_flow.dot_outputzcontrol_flow.dot_annotate_defsr"   r#   r$   r%   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)r)   r    )argsr   r   validate  s    zone_of.<locals>.validater   )rD   rE   r   )rD   r   one_of  s    rF   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)rG   rH   rI   )rH   rI   )lowercodecs
getdecoderLookupError)r   encodingrK   decoderr)   r   r   r   normalise_encoding_name  s    
rP   c               @   s   e Zd ZdS )DEFER_ANALYSIS_OF_ARGUMENTSN)r   r   r   r   r   r   r   rQ   =  s   rQ   sequence	bytearraystrunicodeZclinicpython)r7   r/   localsfinalcollection_typer1   r2   r3   internalr5   r.   cfuncccallufuncr0   inlinestaticmethodcclassno_gc_clearno_gcreturns	exceptvalr@   freelistr9   r:   trashcantotal_orderingzdataclasses.dataclasszdataclasses.fieldzembedsignature.formatmoduler`   functionwith statementclass))r/   rX   rY   r1   r2   r3   r^   r[   r\   rc   rd   rW   r_   ra   rb   rZ   r`   r6   zautotestdict.allzautotestdict.cdefr@   r"   r#   r$   r%   re   r4   r9   r:   r;   r7   r   r<   r=   r8   rf   rg   zdataclasses.dataclassr>   r]   r?   r[   r\   zdataclasses.dataclassr]   r^   rd   rc   r3   re   rb   ra   r;   rX   r/   rZ   rY   rg   r#   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')rn   ro   )rp   rq   )	directive_typesr   boolrT   rJ   rC   intcallabler   )r)   r    relaxed_booltypeZ
orig_valuer   r   r   parse_directive_value  s:    

rx   c             C   s(  |dkri }n|}x| j dD  ]}|j }|s4q d|krHt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j|t	kr
||k r|| j
| n
|g||< 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)rv   zUnknown option: "%s")splitr{   rC   r   endswith
startswithrx   rr   r   listr
   )r}   rv   Zignore_unknowncurrent_settingsresultitemr)   r    foundprefix	directiveZparsed_valuer   r   r   parse_directive_list  s8    



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

    rl   Trm   FNoneN)isdigitrt   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
    Nry   rz   zExpected "=" in option "%s"c             S   s   g | ]}|j  qS r   )r{   )r|   r}   r   r   r   r~   b  s    z*parse_compile_time_env.<locals>.<listcomp>r   )r   r{   rC   r   )r}   r   r   r   r)   r    r   r   r   parse_compile_time_envE  s    r   c               @   s*   e Zd ZdZd	ddZdd Zdd ZdS )
CompilationOptionsz
    See default_options at the end of this module for a list of all possible
    options and CmdLine.usage and CmdLine.parse_command_line() for their
    meaning.
    Nc       
      K   s  g | _ |rt|tr |j}nt}t|}|j| t|tt }|jdg |r|dt	|dkrddnddj
|f }t|t }t|d }t|t| }|rdt	|dkrdnddj
|f }t|||d< |jd	d
o|d  rdd l}	|	jd d|d< d|kr*|jdr*|d |d< n|jdsD|jd|d< d|krdd|krd|d |d< |d dkrtjj
tj d|d< | jj| d S )Ninclude_pathz3got unknown compilation option%s, please remove: %sr   r}   r,   z, compiler_directivesz$got unknown compiler directive%s: %sr<   Fcplusr   z%C++ mode forced when in Pythran mode!Tr7   rB   cachecompiler)r   r   r   __dict__default_optionsr&   r(   setdifference_updatelenjoinrC   r!   r   warningsrA   ospathr   Zget_cython_cache_dir)
r   defaultskwoptionsZunknown_optionsmessageZdirective_defaultsZ
directivesZunknown_directivesr   r   r   r   r   q  sH    


zCompilationOptions.__init__c             C   s&   |dkr"| j jdd kr"d| j d< d S )Npyr.   T)r   r   )r   Zsource_extensionr   r   r   configure_language_defaults  s    z.CompilationOptions.configure_language_defaultsc                s<  i }x | j j D ]\}}|d$kr(qq|d%kr4qq|d&kr@qq|d'krLqq|d(krXqq|d)krdqq|d*krpqq|d+kr|qq|d,krqq|d-krqq|d.kr|||< q|d/kr|||< q|d0k r|||< q|d1k r|||< q|dgk r| jr$tdq|d gkr| jr$td!q|||< qW  fd"d#  |S )2zi
        Return a string that contains all the options that are relevant for cache invalidation.
        show_versionerrors_to_stderrverbosequietoutput_file
output_dirdepfile
timestampsr   r   r   working_pathcreate_extension	build_diruse_listing_filegenerate_pxiannotateannotate_coverage_xmlrB   evaluate_tree_assertionsembedded_metadataemit_linenumsc_line_in_traceback	gdb_debug'relative_path_in_code_position_commentsr   r7   compile_time_envr<   capi_reexport_cincludesz=capi_reexport_cincludes is not compatible with Cython cachingcommon_utility_include_dirzDcommon_utility_include_dir is not compatible with Cython caching yetc                s,   t | tr$t fdd| j D } t| S )z
            Recursively turn item into a string, turning dicts into lists with
            deterministic ordering.
            c                s    g | ]\}}t | |fqS r   )r   )r|   keyr    )to_fingerprintr   r   r~     s    zNCompilationOptions.get_fingerprint.<locals>.to_fingerprint.<locals>.<listcomp>)r   r&   sorteditemsr   )r   )r   r   r   r     s    
z:CompilationOptions.get_fingerprint.<locals>.to_fingerprint)r   r   r   r   )r   r   )r   )r   )r   )r   )r   )r   )r   )r   )r   r   r   r   )rB   r   )r   r   r   r   r   )r   r7   r   r<   )r   r   r   NotImplementedErrorr   )r   datar   r    r   )r   r   get_fingerprint  sR    

 




	z"CompilationOptions.get_fingerprint)N)r   r   r   __doc__r   r   r   r   r   r   r   r   k  s   
/r   r   ) r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r7   rB   r   r   module_namer   r   r   r   r   r<   r?   )rh   r`   )r`   ri   )r`   )ri   rj   )ri   )ri   )ri   rj   )ri   rj   )ri   )ri   )ri   )ri   )r`   )r`   )r`   )rk   r`   rj   )rh   )rh   )rh   )rh   )ri   rk   r`   )ri   rk   r`   )rh   )rh   )r`   )rh   )rh   )rh   )rh   r`   )rh   )rh   )rh   )rh   )rh   ri   )r`   )rk   r`   )rk   r`   )rh   ri   r`   )ri   )rh   )F)FFN)N)3
__future__r   r   r,   r   objectr   Z
docstringsZembed_pos_in_docstringZ
pre_importZgenerate_cleanup_codeZclear_to_noner   r   Z	fast_failZwarning_errorsZerror_on_unknown_namesZerror_on_uninitializedZconvert_rangeZcache_builtinsZgcc_branch_hintsZlookup_module_cpdefembedr   Zcimport_from_pyxZbuffer_max_dimsZclosure_freelist_sizer!   r*   r   Zextra_warningsrF   rP   rQ   rT   rs   r&   rw   rt   rr   r   r   valZdirective_scopesZimmediate_decorator_directivesrx   r   r   r   r   r   r   r   r   r   <module>   s  %
	

$



< 
=$
& 