Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib64/python3.7/site-packages/Cython/Compiler/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/site-packages/Cython/Compiler/__pycache__/Main.cpython-37.pyc

B

Z��Z�x�@s$ddlmZddlZddlZddlZddlZejdd�dks`dejdd�kr\dkr�nn(ej�de	ejdd���e�
d�ydd	lmZWne
k
r�eZYnXdd
lmZddlmZddlmZmZdd
lmZmZmZmZddlmZddlmZddlmZddlmZejZe� d�Z!dZ"Gdd�de#�Z$Gdd�de#�Z%dd�Z&dd�Z'd3dd�Z(Gdd�de#�Z)Gdd �d e#�Z*Gd!d"�d"e#�Z+Gd#d$�d$e,�Z-d4d%d&�Z.d'd(�Z/d5d)d*�Z d+d,�Z0d6d-d.�Z1e,dddddddddd/dddiid0d0d1d1dd0d0ddddddd0d2�Z2dS)7�)�absolute_importN�)r�)�r)rrz8Sorry, Cython requires Python 2.6+ or 3.3+, found %d.%d
�)�
basestring)�Errors)�
EncodedString)�PyrexScanner�FileSourceDescriptor)�
PyrexError�CompileError�error�warning)�ModuleScope)�Utils)�Options)�Versionz2[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$c@seZdZdS)�CompilationDataN)�__name__�
__module__�__qualname__�rr�G/opt/alt/python37/lib64/python3.7/site-packages/Cython/Compiler/Main.pyr*src@s�eZdZdZd6dd�Zdd�Zd7d	d
�Zdd�Zd
d�Zdd�Z	d8dd�Z
d9dd�Zdd�Zdd�Z
d:dd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdS);�ContextNFrTc
	Cs�ddlm}m}d|ji|_|�|�|_|j|jd<||_t�|_	||_
||_||_i|_
i|_tj�tj�tj�tj�t�tjjd���}	||	g|_|�|�d|_dS)Nr)�Builtin�CythonScope�__builtin__�cython�Includes)�rrZ
builtin_scope�modulesZcreate_cython_scope�cython_scope�include_directories�set�future_directives�compiler_directives�cpp�options�pxds�	_interned�os�path�abspath�normpath�join�dirname�__file__�pardir�set_language_levelZgdb_debug_outputwriter)
�selfr#r&r'�language_levelr(Zcreate_testscoperr�standard_include_pathrrr�__init__Gs  
zContext.__init__cCsN||_|dkrJddlm}m}m}m}|j�||||g�|jd|jd<dS)Nrr)�print_function�unicode_literalsr�divisionr�builtins)	r5�Futurer8r9rr:r%�updater!)r4�levelr8r9rr:rrrr3bs
zContext.set_language_levelcCsJt||f}y
|j|Stk
r(YnXt|�}|r<||_||j|<|S)N)r	r*�KeyError�encoding)r4�valuer@�keyrrr�intern_ustringis


zContext.intern_ustringcGs>t|�|f|}y
|j|Stk
r.YnX||j|<|S)N)�typer*r?)r4rArBrrr�intern_valueus

zContext.intern_valuec	Cstddlm}t|t�rV|jdkrVt||t���}t||j	�}|�
||�}|�||�}n|�|||�}|�||�}|S)Nr)�PipelineZpyx)
r rF�
isinstancerZ
_file_type�CompilationSourcer+�getcwd�create_default_resultobjr(Zcreate_pyx_as_pxd_pipeline�run_pipelineZcreate_pxd_pipeline)	r4�source_desc�scope�module_namerF�sourceZresult_sink�pipeline�resultrrr�process_pxd�szContext.process_pxdcCs
t�|�S)N)rZreport_error)r4�excrrr�nonfatal_error�szContext.nonfatal_errorrcCs0d}|rtd||||f�d}d}|rH|r8|�|�}	qL|j}	|}d}n|}	t�|	�snt|pd|ddfd|��|r�|r~td�|�|�}|s�|�|	|�}|r�|�|�}|s�|r�td�|r�|}	|}x|	�	d�D]}
|�|
�}q�W|r�td|�|j
�s,|�rtd�|�s�|�rtd	�|j|	||d
�}|�r<td|�|�s�|�r�d|_
|�|	d
|�}|�rp|�d��rpnt
|d|	�dtj��|�r,d|_
y�|�r�td|�|�dtj�tj�|�d}|�|��s�|}t||�}
|�|
||	�\}}|�r�|�|\}}||f|j|<Wntk
�r*YnX|S)NrzPContext.find_module: module_name = %s, relative_to = %s, pos = %s, need_pxd = %sz'%s' is not a valid module namez...trying relative importz...trying absolute import�.z
...scope = %sz...pxd not loadedz...looking for pxd file)�sys_pathz......found %sTz.pyz__init__.pyz'%s.pxd' not foundzContext.find_module: Parsing %sr)�printZqualify_name�qualified_name�module_name_pattern�matchr
�lookup_submodule�
find_pxd_file�find_submodule�splitZpxd_file_loaded�search_include_directories�endswithr�replacer+�sepr,�splitextrrRr))r4rNZrelative_to�posZneed_pxdZabsolute_fallbackZdebug_find_modulerMZpxd_pathnamerX�nameZpackage_pathname�rel_pathrL�errrQZ
pxd_codenodesZ	pxd_scoperrr�find_module�s�	




zContext.find_modulec	Cs|j|d||d�}|dkr�|�d�s,|dkr�tj�tj�tj�tj�t�tjj	d���}tj�|d�}|j
�|�z|�|d|�}Wd|j
��X|r�|}|�d�r�t
|d|d�n6|d	kr�t
|d
||fd�n|dkr�t
|d|d�|dk�r
tj�r
|�||�S|S)
Nz.pxd)rV�python)�stdlib�stdio�stlr�
Deprecatedz!'%s' is deprecated, use 'cpython'r)rjrkz!'%s' is deprecated, use 'libc.%s'rlz$'%s' is deprecated, use 'libcpp.*.*')r_�
startswithr+r,r-r.r/r0r1r2r#�append�poprrZcimport_from_pyx�
find_pyx_file)r4rXrdrV�pxdr6Zdeprecated_include_pathrerrrr\�s,	
 
zContext.find_pxd_filecCs|�|d|�S)Nz.pyx)r_)r4rXrdrrrrq	szContext.find_pyx_filecCs(|j|d|dd�}|s$t|d|�|S)Nr T)�includez'%s' not found)r_r)r4�filenamerdr,rrr�find_include_files

zContext.find_include_filecCst�t|j�|||||�S)N)rr_�tupler#)r4rX�suffixrdrsrVrrrr_sz"Context.search_include_directoriescCs
t�|�S)N)r�find_root_package_dir)r4�	file_pathrrrrxszContext.find_root_package_dircCst�|t|��S)N)r�check_package_dirrv)r4�dirZ
package_namesrrrrzszContext.check_package_dirc	Cs�tj�|�sdSt�|�}t�||�r*dS|g}t�|d�}tj�|�rXt�||�rXdSxX|�|�D]J\}}|dkr�|�||�}n|dkrd|�	||�}nqd|rdt�||�rddSqdWdS)Nrz.pxd�cimportrsr)
r+r,�existsrZmodification_timeZfile_newer_than�replace_suffix�read_dependency_filer\r_)	r4�source_pathZoutput_pathZc_timerdZpxd_path�kindre�dep_pathrrr�c_file_out_of_date"s$
zContext.c_file_out_of_datecCsdd�|�|�D�S)NcSsg|]\}}|dkr|�qS)r|r)�.0r�rerrr�
<listcomp>8sz7Context.find_cimported_module_names.<locals>.<listcomp>)r)r4r�rrr�find_cimported_module_names7sz#Context.find_cimported_module_namescCs
t�|�S)N)r�is_package_dir)r4Zdir_pathrrrr�;szContext.is_package_dircCsHt�|d�}tj�|�r@t|d�}dd�|��D�}|��|SdSdS)Nz.depZrUcSs(g|] }d|��kr|���dd��qS)� r)�stripr^)r��linerrrr�Bsz0Context.read_dependency_file.<locals>.<listcomp>r)rr~r+r,r}�open�	readlines�close)r4r�r��f�chunksrrrr>s
zContext.read_dependency_filecCs|j�|d�S)N)r!�get)r4rerrrr[JszContext.lookup_submodulecCs*|�|�}|s&t|d|d�}||j|<|S)N)�
parent_module�context)r[rr!)r4rerMrrrr]Ns


zContext.find_submodulec

Cs�t|t�std��|j}|j|_tj}y�t�|��t}ddl	m
}t|||j||d�}	|�
|	||�}
|jjr�yddlm}Wntk
r�td��YnX|�
|�WdQRXWn.tk
r�}z|�||��Wdd}~XYnXtj|kr�t��|
S)Nz$Only file sources for code supportedr)�Parsing)Zsource_encodingrMr�r)�ConcreteSyntaxTreezLFormal grammar can only be used with compiled Cython with an available pgen.)rGr�RuntimeErrorrtr'r�
num_errorsrZopen_source_filer r�r
r@Zp_moduler(�formal_grammar�Parserr��ImportError�UnicodeDecodeError�_report_decode_errorr
)
r4rLrMrr�full_module_name�source_filenamer�r�r��s�treer��errr�parseWs.



z
Context.parsec	Cs�|jd}|jd}|jd}d}d}}tj|jdddd��H}	x@t|	d�D]2\}}
|t|
�7}||krL||t|
�d}PqLWWdQRXt|||fd	||f�S)
N���rrr�rz	iso8859-1r )r@�newlinezqDecoding error, missing or incorrect coding=<encoding-name> at top of source (cannot decode with encoding %r: %s))�args�ior�rt�	enumerate�lenr)r4rLrS�msg�positionr@r��column�idxr��datarrrr�ts



zContext._report_decode_errorc
Cs|tj�|�\}}tj�|�\}}d|kr,|S|g}x6|�|�rhtj�|�\}}	||krXP|�|	�|}q4W|��d�|�S)NrU)r+r,r^rcr�ro�reverser/)
r4r,r(r{rtrN�_�names�parent�package_namerrr�extract_module_name�s
zContext.extract_module_namecCs<t��|jr$t�|jd�}|_nd}tj||jd�dS)Nz.lis)r,Zecho_to_stderr)	r�reset�use_listing_filerr~�main_source_file�listing_fileZopen_listing_file�errors_to_stderr)r4r(rQr,rrr�setup_errors�szContext.setup_errorscCs||jj}t|t�std��t��tj|_|jdkr8d}|rx|jrxyt	�
|jt�|j
��Wntk
rpYnXd|_dS)Nz$Only file sources for code supportedrT)�compilation_sourcerLrGrr�rZclose_listing_filer��c_filerZ
castrate_filer+�statrt�EnvironmentError)r4rgr(rQrLrrr�teardown_errors�s


zContext.teardown_errors)FrNT)N)NNrT)T)FF)rrrr"r7r3rCrErRrTrhr\rqrur_rxrzr�r�r�rr[r]r�r�r�r�r�rrrrr9s6


X
!

		rcCsb|jrd}nd}t�||�}|jrZtj�||j�}tj�|�rTtj�|tj�|��S|Sn|SdS)Nz.cppz.c)	�cplusrr~�output_filer+r,r/�isdir�basename)r��cwdr(Zc_suffixZsuggested_file_nameZout_pathrrr�get_output_filename�sr�cCs:t�}|jj|_||_|j}t|j|j|�|_|j|_|S)N)	�CompilationResultrLrtr�r�r�r�r��embedded_metadata)r�r(rQrLrrrrJ�s
rJc	Cspddlm}tj�|�d}|�|dd��|dkr>|��}t��}tj�|�}|p`|�	||�}|j
r�|�dtj�|}|�
|�s�|}n|}t||�}	t|	||�}t||�}
|jdk�rtj�|
j�dd}tj�|��rtj|ddd��}d	|�d
�k�rd|_WdQRX|��dk�s$|�s4|�|||
�}
n|�|||
�}
|�||
�|�|
|�\}}|�|||
�|
S)
Nr)rFrUrz.htmlr�zUTF-8)r@z<!-- Generated by Cython�dTz.py)r rFr+r,rc�configure_language_defaults�create_contextrIr-r��'relative_path_in_code_position_commentsrarbr`rrHrJ�annotater�r}r�r��read�lowerZcreate_py_pipelineZcreate_pyx_pipeliner�rKr�)rOr(r�r�rFZ
source_extr�Zabs_pathrfrLrQZ
html_filenameZ	html_filerPrgZenddatarrrrK�s:


rKc@seZdZdZdd�ZdS)rHzk
    Contains the data necessary to start up a compilation pipeline for
    a single compilation unit.
    cCs||_||_||_dS)N)rLr�r�)r4rLr�r�rrrr7szCompilationSource.__init__N)rrr�__doc__r7rrrrrH�srHc@s*eZdZdZd	dd�Zdd�Zdd�ZdS)
�CompilationOptionsar
    Options to the Cython compiler:

    show_version      boolean   Display version number
    use_listing_file  boolean   Generate a .lis file
    errors_to_stderr  boolean   Echo errors to stderr when using .lis
    include_path      [string]  Directories to search for include files
    output_file       string    Name of generated .c file
    generate_pxi      boolean   Generate .pxi file for public declarations
    capi_reexport_cincludes
                      boolean   Add cincluded headers to any auto-generated
                                header files.
    timestamps        boolean   Only compile changed source files.
    verbose           boolean   Always print source names being compiled
    compiler_directives  dict   Overrides for pragma options (see Options.py)
    embedded_metadata    dict   Metadata to embed in the C file as json.
    evaluate_tree_assertions boolean  Test support: evaluate parse tree assertions
    language_level    integer   The Python language level: 2 or 3
    formal_grammar    boolean  Parse the file with the formal grammar

    cplus             boolean   Compile as c++ code
    Nc	Ksvg|_|rt|t�r |j}nt}t|�}|�|�t|�tt�}|�dg�|r|dt	|�dkrddndd�
|�f}t|��t|d�}t|�tt�
��}|r�dt	|�dkr�dndd�
|�f}t|��||d<|�d	d
��r|d�sddl}|�d
�d|d<d|k�r(d|k�r(t|d�|d<d|k�rHd|k�rH|d|d<|ddk�rftj�d�|d<|j�|�dS)N�include_pathz3got unknown compilation option%s, please remove: %srr�r z, r&z$got unknown compiler directive%s: %s�
np_pythranFr�rz%C++ mode forced when in Pythran mode!Tr5r��cachez
~/.cycache)r�rGr��__dict__�default_options�dictr=r$�difference_updater�r/�
ValueErrorr�get_directive_defaultsr��warnings�warn�intr+r,�
expanduser)	r4�defaults�kwr(Zunknown_options�message�
directivesZunknown_directivesr�rrrr7!sB


zCompilationOptions.__init__cCs&|dkr"|j�d�dkr"d|jd<dS)N�pyZbindingT)r&r�)r4Zsource_extensionrrrr�Msz.CompilationOptions.configure_language_defaultscCst|j|j|j|j|d�S)N)r()rr�r&r�r5)r4rrrr�Rs
z!CompilationOptions.create_context)N)rrrr�r7r�r�rrrrr�	s
,r�c@seZdZdZdd�ZdS)r�af
    Results from the Cython compiler:

    c_file           string or None   The generated C source file
    h_file           string or None   The generated C header file
    i_file           string or None   The generated .pxi file
    api_file         string or None   The generated C API .h file
    listing_file     string or None   File of error messages
    object_file      string or None   Result of compiling the C file
    extension_file   string or None   Result of linking the object file
    num_errors       integer          Number of compilation errors
    compilation_source CompilationSource
    cCs4d|_d|_d|_d|_d|_d|_d|_d|_dS)N)r�Zh_fileZi_fileZapi_filer�Zobject_fileZextension_filer�)r4rrrr7fszCompilationResult.__init__N)rrrr�r7rrrrr�Ws
r�c@seZdZdZdZdd�ZdS)�CompilationResultSetz�
    Results from compiling multiple Pyrex source files. A mapping
    from source file paths to CompilationResult instances. Also
    has the following attributes:

    num_errors   integer   Total number of compilation errors
    rcCs|||<|j|j7_dS)N)r�)r4rOrQrrr�add|szCompilationResultSet.addN)rrrr�r�r�rrrrr�qsr�cCst|||�S)z�
    compile_single(source, options, full_module_name)

    Compile the given Pyrex implementation file and return a CompilationResult.
    Always compiles a single file; does not perform timestamp checking or
    recursion.
    )rK)rOr(r�rrr�compile_single�sr�cCs�dd�|D�}t�}t�}|j}|j}d}t��}x�|D]x}||kr8|dkrT|��}t|||�}	|�||	�}
|rt|
r�|r�t	j
�d|�t|||d�}|�
||�d}|�
|�q8W|S)z�
    compile_multiple(sources, options)

    Compiles the given sequence of Pyrex implementation files and returns
    a CompilationResultSet. Performs timestamp checking and/or recursion
    if these are specified in the options.
    cSsg|]}tj�|��qSr)r+r,r-)r�rOrrrr��sz$compile_multiple.<locals>.<listcomp>Nz
Compiling %s
)r�)r$r��
timestamps�verboser+rIr�r�r��sys�stderr�writerKr�)�sourcesr(�	processed�resultsr�r�r�r�rO�output_filenameZout_of_daterQrrr�compile_multiple�s*

r�cKs<tfd|i|��}t|t�r.|js.t|||�St||�SdS)a�
    compile(source [, options], [, <option> = <value>]...)

    Compile one or more Pyrex implementation files, with optional timestamp
    checking and recursing on dependencies.  The source argument may be a string
    or a sequence of strings.  If it is a string and no recursion or timestamp
    checking is requested, a CompilationResult is returned, otherwise a
    CompilationResultSet is returned.
    r�N)r�rGrr�r�r�)rOr(r��kwdsrrr�compile�s
r�cCs
tdd�S)Nr)�command_line)�mainrrrr�setuptools_main�sr�c
Cs�tjdd�}d}|r0ddlm}||�\}}ntt�}|}|jrRtj�dt	�|j
dkrht�|j
�yt
||�}|jdkr�d}Wn>ttfk
r�}ztj�t|�d�d}Wdd}~XYnX|r�t�d�dS)Nrr)�parse_command_linezCython version %s
r �
)r��argvZCmdLiner�r�r��show_versionr�r��version�working_pathr+�chdirr�r�r�r�str�exit)r�r�Zany_failuresr�r(r�rQr�rrrr��s(


r�r FT)r�r�r�r�r�r�Zannotate_coverage_xml�generate_pxiZcapi_reexport_cincludesr�r�r��quietr&r�Zevaluate_tree_assertions�
emit_linenumsr��c_line_in_tracebackr5r��	gdb_debug�compile_time_envZcommon_utility_include_dir�
output_dir�	build_dirr�Zcreate_extensionr�)NN)N)NN)r)3�
__future__rr+�rer�r��version_infor�r�rvr�rrr�r�r rZStringEncodingr	ZScanningr
rrr
rrZSymtabrrrrr�r�rYr��objectrrr�rJrKrHr�r�r�r�r�r�r�r�r�rrrr�<module>s�4


y
3N
$