Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/site-packages/Cython/Build/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/site-packages/Cython/Build/__pycache__/Inline.cpython-35.pyc



Z��Z 0�@s�ddlmZddlZddlZddlZddlZddlZyddlZWnek
r|ddl	ZYnXddl
mZmZddl
mZddlZddlmZmZmZddlmZmZmZmZddlmZdd	lmZd
dlmZmZm Z ddl!m"Z"m#Z#dd
l$m%Z%ddl&Z'ej(d3kZ)ej(ddkr�dd�Z*ndd�Z*Gdd�dee�Z+e ddd��Z,ddd�Z-ddd�Z.dd�Z/e dd��Z0iZ1e0d4�Z2ddd d!�Z3e-ej4j5e%�d"�dd#d#ddd$d%�Z6de6_7ej8d&�j9Z:d'd(�Z;ej8d)�Z<d*d+�Z=ydd,lm>Z>Wnek
r�d-d.�Z>YnXd/d0�Z?Gd1d2�d2e@�ZAdS)5�)�absolute_importN)�Distribution�	Extension)�	build_ext�)�Context�CompilationOptions�default_options)�CythonTransform�SkipDeclarations�AnalyseDeclarationsTransform�EnvTransform)�parse_from_strings)�_unicode�)�strip_string_literals�	cythonize�cached_function)�Pipeline�Nodes)�get_cython_cache_dir�cCs$t|t�r|jd�S|SdS)N�ascii)�
isinstance�bytes�decode)�s�r�F/opt/alt/python35/lib64/python3.5/site-packages/Cython/Build/Inline.py�
to_unicodes
rcCs|S)Nr)�xrrr�<lambda>$sr!cs:eZdZdd�Zdd�Z�fdd�Z�S)�UnboundSymbolscCs tj|d�t�|_dS)N)r
�__init__�set�unbound)�selfrrrr#(szUnboundSymbols.__init__cCs/|j�j|j�s+|jj|j�|S)N)Zcurrent_env�lookup�namer%�add)r&�noderrr�visit_NameNode+szUnboundSymbols.visit_NameNodecstt|�j|�|jS)N)�superr"�__call__r%)r&r*)�	__class__rrr-/szUnboundSymbols.__call__)�__name__�
__module__�__qualname__r#r+r-rr)r.rr"'sr"c
Cs�t|�}|dkr'tgt�}ddlm}td|�}xEtj|d�D]1}|dkrnqY||�}t||�rYPqYWyddl	}Wnt
k
r�ddl}YnXtt
�|�tt|���S)Nr)rz(tree fragment)Zpyxr)rrr	�Compiler.ParseTreeTransformsrrrZcreate_pipeliner�builtins�ImportError�__builtin__�tupler"r$�dir)�code�contextrZtreeZphaser3rrr�unbound_symbols4s 
r:cCs-t|�}|tkrdSt||�SdS)N�long)�type�int�	safe_type)�argr9�py_typerrr�unsafe_typeHsrAcCst|�}|ttttfkr+|jS|tkr;dS|tkrKdS|tkr[dSdt	j
kr�t|t	j
dj�r�d|j
j|jfSxt|j�D]f}|jdkr�dS|j|jd	d
�}|r�|j|j�}|jr�d|j|jfSq�WdSdS)
Nzdouble complex�double�bint�numpyz"numpy.ndarray[numpy.%s_t, ndim=%s]r5r3�objectZneed_pxdFz%s.%s)r5r3)r<�listr6�dict�strr/�complex�float�bool�sys�modulesrZndarray�dtyper(�ndim�mror0�find_moduler'Zis_type)r?r9r@�	base_type�module�entryrrrr>Ps((	r>cCs<t�}|j�}|j|�t|�}|j�|S)N)r�find_config_files�parse_config_filesr�finalize_options)�distZconfig_files�build_extensionrrr�_get_build_extensionhs	

rZcCstt|�t�S)N)rrFr	)�cython_include_dirsrrr�_create_contextssr\�.cCs�x�|D]�}||kr|dks1|dkrptj�jjj}|dkr[|j}|dkrp|j}||kr�||||<q||kr�||||<qtd|�qWdS)NzCouldn't find %r)�inspect�currentframe�f_back�f_locals�	f_globals�print)�kwdsr:�locals�globals�symbolZ
calling_framerrr�_populate_unbound{s
		rh�inlineFc(s8�dkrdd��|r0tt|��nt�tj|�}	|	dk	r�t�|	||�t�j��}
t��fdd�|
D��}tj||f�}|dk	r�dd�|
D�}
||
�S|}t|�}t	|�\}}t
|�}|dkr'tj�j
j
j}|dkrHtj�j
j
j}y+t|�t|<}	t�|	||�Wn"tk
r�|s�td�YnXg}xDt�j��D]0\}}|tkr�|jd|��|=q�Wt��}t���fdd�|D��}||tjtjtjf}d	tjt|�jd
��j�}|tj kr{tj |}n�d}t!j"dkr�t#�}|j$d�t!_"t%j&j'||t!j"�}t%j&j(|�s�t%j)|�|s�t%j&j*|�r�g}g}t+j,d�}xy|D]q\}}|j-|�}|r!|jd
|j.�d�|j.�ddkr!ddl/}|j|j0��q!Wt1|�\} }!dj'dd�|D��}"dddj'|�d| d|"d|!i}#x,|j�D]\}}$|#j2||$�}#q�Wt%j&j'||d�}%t3|%d�}&z|&j4|#�Wd|&j5�Xt6d|d|%gd|d|�}'|dkr�t#�}t7|'gd|p�dgd |�|_8t%j&j9|%�|_:||_;|j<�t=j>||�}|j?t||f<�fd!d�|D�}
|j?|
�S)"NcSsdS)NrEr)r rrrr!�szcython_inline.<locals>.<lambda>cs+g|]!\}}�|��|f�qSrr)�.0r?�value)�ctx�get_typerr�
<listcomp>�s	z!cython_inline.<locals>.<listcomp>cSsg|]}|d�qS)rr)rjr?rrrrn�s	z>Could not parse code as a string (to extract unbound symbols).z
cimport cython as %scs)g|]}��|��|f�qSrr)rjr?)rlrmrdrrrn�s	Z_cython_inline_zutf-8�z([.\w]+)[.]z
cimport %srrDz, cSsg|]}d|�qS)z%s %sr)rj�arrrrn�s	zf
%(module_body)s
%(cimports)s
def __invoke(%(params)s):
%(func_body)s
    return locals()
            �cimports�
�module_body�params�	func_bodyz.pyx�wr(�sources�include_dirs�extra_compile_args�include_pathr]�quietcsg|]}�|�qSrr)rjr?)rdrrrn�s	)@r\r6�_cython_inline_default_context�_cython_inline_cache�getrh�sorted�itemsrr�strip_common_indentr^r_r`rarbr:�AssertionErrorrcrF�
cython_module�appendrL�version_info�
executable�Cython�__version__�hashlib�md5r�encode�	hexdigestrM�
cython_inline�so_extrZ�get_ext_filename�os�path�join�exists�makedirs�isfile�re�compile�match�groupsrDZget_include�extract_func_code�replace�open�write�closerr�
extensions�dirname�
build_temp�	build_lib�run�imp�load_dynamicZ__invoke)(r8rm�lib_dirr[�forcer{rerfrdZ_unbound_symbols�argsZarg_sigsZinvoke�arg_listZ	orig_code�literalsrqr(r?�	arg_names�key�module_namerSrY�module_path�cflagsZc_include_dirsZ	qualifiedr<�_�mrDrsrurtZmodule_coderkZpyx_fileZfh�	extensionr)rlrmrdrr��s�"

%(	

			'	
r�z[^ ]cCs�d}|j�}x`|D]X}t|�}|s4q|j�}||dkrSq|dksk||kr|}qWxet|�D]W\}}t|�}|s�|s�|||d�dkr�q�||d�||<q�Wdj|�S)N�#rrr)�
splitlines�_find_non_space�start�	enumerater�)r8Z
min_indent�lines�liner��indent�ixrrrr��s"

(r�zI^((cdef +(extern|class))|cimport|(from .+ cimport)|(from .+ import +[*]))cCs�g}g}|}|jdd�}|jd�}xH|D]@}|jd�smtj|�rg|}n|}|j|�q:Wdj|�ddj|�fS)N�	� rrz    z
    )r��split�
startswith�module_statementr�r�r�)r8rS�function�currentr�r�rrrr�s
	r�)�getcallargscOs�i}tj|�\}}}}|dk	rG|t|�d�||<x't||�D]\}}	|	||<qWWx[t|j��D]G\}}	||kr�||kr�td|��|j|�||<q�W|dk	r�|||<n|rtdt|���|dkrf}t|�t|�}
xWt|�D]I\}}||kr9||
krr|||
||<q9td|��q9W|S)NzDuplicate argument %sz Unexpected keyword arguments: %szMissing argument: %s)	r^�
getargspec�len�ziprFr��	TypeError�popr�)�funcZ
arg_valuesZ
kwd_values�allr��varargsrd�defaultsr(rkZ
first_defaultr�rrrr�&s0
r�cCsQ|jd�}|dd�dkr;d||dd�S||dd�SdS)N�:��lambdaz	return %sr)�index)�sourcer�rrr�get_bodyBsr�c@s(eZdZdd�Zdd�ZdS)�RuntimeCompiledFunctioncCs%||_ttj|��|_dS)N)�_fr�r^�	getsource�_body)r&�frrrr#Ns	z RuntimeCompiledFunction.__init__cOsot|j||�}trCt|jd|jjd|jj|�St|jd|jjd|jj|�SdS)Nrerf)r�r��IS_PY3r�r��__globals__Zfunc_globals)r&r�rdr�rrrr-Rs(z RuntimeCompiledFunction.__call__N)r/r0r1r#r-rrrrr�Lsr�)rr)r])B�
__future__rrLr�r�r^r�r�r4r��distutils.corerr�distutils.command.build_extrr�Z
Compiler.Mainrrr	r2r
rrr
ZCompiler.TreeFragmentrZCompiler.StringEncodingrZDependenciesrrrZCompilerrrZUtilsr�cythonr�r�r�rr"r:rAr>rZr\r}r|rhr�r�r�r�r��searchr�r�r�r�r�r�rEr�rrrr�<module>sX0
"
m