403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.156
Web Server : Apache/2.4.62 (Ubuntu)
System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64
User : www-data ( 33)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/pythran/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/pythran/__pycache__/toolchain.cpython-310.pyc
o

�@�a�E�@sdZddlmZmZddlmZddlmZmZm	Z	m
Z
ddlmZmZm
Z
mZddlmZddlmZmZddlmZmZdd	lmZdd
lmZddlmZddlmZdd
lmZddl m!Z!m"Z"ddl m#Z#ddl$m%Z%m&Z&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl.m.Z.ddl/m0Z0ddl1m2Z2ddl3m4Z4ddl5m6Z6m7Z7ddl8Z9ddl:Z:ddl;Z<ddl=Z=ddl>Z>ddl?Z?ddl@mAZAddlBZBe:�Cd�ZDdd�ZEdd�ZFdd �ZGd!d"�ZH		d4d#d$�ZId5d%d&�ZJ		d4d'd(�ZKd6d)d*�ZLd7d,d-�ZM		+	d8d.d/�ZN		+d9d0d1�ZOd2d3�ZPdS):z�
This module contains all the stuff to make your way from python code to
a dynamic library, see __init__.py for exported interfaces.
�)�Cxx�Python)�cfg)�PythonModule�Include�Line�	Statement)�FunctionBody�FunctionDeclaration�Value�Block)�ReturnStatement)�PythranExtension�PythranBuildExt)�refine�mark_unexported_functions)�PassManager)�pythran_ward)�tog)�pytype_to_deps��pytype_to_ctype)�
load_specfile�Spec)�spec_to_string)�check_specs�
check_exports�PythranSyntaxError)�__version__)�cxxidN)�datetime)�CompileError)�	sysconfig)�setup)�mkdtemp�NamedTemporaryFile)�reduce�pythrancCspt�}|j��D]}|D]}|D]	}|�t|��qqq|j��D]}|D]	}|�t|��q%q!t|dd�d�S)zD Extract types dependencies from specs for each exported signature. cSsd|vS)N�include�)�xr)r)�3/usr/lib/python3/dist-packages/pythran/toolchain.py�<lambda>;sz-_extract_specs_dependencies.<locals>.<lambda>)�key)�set�	functions�values�updater�capsules�sorted)�specs�deps�
signatures�	signature�tr)r)r+�_extract_specs_dependencies+s���r9cCs>|�d�}t|�dkrddg|}tt|dd�t|d��S)zqTurns an optimization of the form
        my_optim
        my_package.my_optim
        into the associated symbol�.�r'�
optimizationsNr)�split�lenr&�getattr�
__import__)�optimization�splittedr)r)r+�_parse_optimization>s
rCcCsBtd|dd��}|�|�|jWd�S1swYdS)z�write `content` to a temporary XXX`suffix` file and return the filename.
       It is user's responsibility to delete when done.�wF)�mode�suffix�deleteN)r%�write�name)�contentrF�outr)r)r+�_write_tempIs
$�rLcCs<|jD]}t|tj�r|j|krdd�|jjD�SqgS)z(Checks if a given function has argumentscSsg|]}t|j��qSr))r�id)�.0�argr)r)r+�
<listcomp>Usz has_argument.<locals>.<listcomp>)�body�
isinstance�ast�FunctionDefrI�args)�module�fname�nr)r)r+�has_argumentQs

�rYcCsht||�}t�||�\}}|durt||�}|dur"t�dd���}dd�|D�}t|||�|||fS)z*Front-end and middle-end compilation stepsNr'r<cS�g|]}t|��qSr))rC)rN�optr)r)r+rPh�z$front_middle_end.<locals>.<listcomp>)r�frontend�parserr�getr=r)�module_name�coder<�
module_dir�entry_points�pm�ir�
docstringsr)r)r+�front_middle_endYs


rgcCs t||||�\}}}|�t|�S)zYpython + pythran spec -> py code

    Prints and returns the optimized python code.

    )rg�dumpr)r`rar<rbrdre�_r)r)r+�generate_pyqsrjcs2�r	t����}nd}t|||||d�\}�}|�t��}�dur7Gdd�dt�}	|	|�}
�fdd�}|
|fSt�t�rAt�i����fdd�}��	|�t
|���t|t�r[|}n|�dd	�}t
�|���tt��d
�}
t|||
�}
|
�td�td�td
�td�td��|
jdd�t��D��|
j|j�|
�td��dd�}�j��D]~\}}t|�}|s�|
�|d�|||���t|�D]c\}}d�||�}dd�|D�}t�|�}dd�t ||�D�}t!d}d�"|�}|�|||r�d�|�nd�}d|}|
�#t$t%t&||�dd�t ||�D��t't(d�|||�d�"|���g��|||�q�q��j)��D]g\}}t|�}d d�|D�}t�|�}d!d�t ||�D�}t!d}d�"|�}|�|||�r`d�|�nd�}d|}t*||�}|
�+t$t%t&||�d"d�t ||�D��t't,d#�|||�d�"|���g��||��q-|
|fS)$z�python + pythran spec -> c++ code
    returns a PythonModule object and an error checker

    the error checker can be used to print more detailed info on the origin of
    a compile error (e.g. due to bad typing)

    N)rcc@s eZdZdd�Zdd�ZeZdS)zgenerate_cxx.<locals>.GenerablecSs
||_dS�N)rJ)�selfrJr)r)r+�__init__��
z(generate_cxx.<locals>.Generable.__init__cSs
t|j�Srk)�strrJ)rlr)r)r+�__str__�rnz'generate_cxx.<locals>.Generable.__str__N)�__name__�
__module__�__qualname__rmrp�generater)r)r)r+�	Generable�srucst���dSrk)r�	typecheckr))rer)r+�
error_checker�sz#generate_cxx.<locals>.error_checkercst���}t�|�dSrk)rrvr)�types�rer4r)r+rw�s
�ascii�ignore)�hash�version�datezpythonic/core.hppzpythonic/python/core.hppzpythonic/types/bool.hppzpythonic/types/int.hppz&#ifdef _OPENMP
#include <omp.h>
#endifcSrZr))r)rN�incr)r)r+rP�r\z generate_cxx.<locals>.<listcomp>z%pythonic/python/exception_handler.hppcSstd�||�S)Nz{0}::{1})r�format)r`�
internal_namer)r)r+�warded�szgenerate_cxx.<locals>.wardedz{}()()z{0}{1}cSrZr)r�rNr8r)r)r+rP�r\cS�g|]\}}|�qSr)r)�rNrXrir)r)r+rP�r\z{0}::{1}::type{2}z, z<{0}>�ztypename %s::result_typecSsg|]\}}t|d|��qS)z&&�r�rNr8�ar)r)r+rP�s�a�
                            PyThreadState *_save = PyEval_SaveThread();
                            try {{
                                auto res = {0}()({1});
                                PyEval_RestoreThread(_save);
                                return res;
                            }}
                            catch(...) {{
                                PyEval_RestoreThread(_save);
                                throw;
                            }}
                            cSrZr)rr�r)r)r+rP�r\cSr�r)r)r�r)r)r+rPr\cSsg|]	\}}t||��qSr)r�r�r)r)r+rPs�z
{0}()({1}))-r.�keysrgrhr�objectrR�dictr�
to_docstringsr�bytes�encode�hashlib�sha256�	hexdigestrr �nowr�add_to_includesrrr9rQr/�itemsr�add_global_varr��	enumeraterY�zipr�join�add_pyfunctionr	r
rrrr2r�add_capsuler
)r`rar4r<rbrcrdrfrJru�modrw�
code_bytes�metainfor��
function_namer6�internal_func_name�sigidr7�numbered_function_name�arguments_types�arguments_names�	arguments�name_fmt�	args_list�specialized_fname�result_type�	docstringr)ryr+�generate_cxx|s�	�	z
�


��
�����
�
�����������*
�
��
����	�r�cKsbt�}t�}t||gfi|��}zt||gdtidt�tj�r!dnddd|d|gd�Wnty>}zt	t
|���d}~wwd	d
�}t�d�}	t
�
tj�||d��D]B}
|
�|	�ru|rd|�d
|	�}ntj�t��||	�}||
|�qT|r�|�d
d�}tj�|�}nt��}||
tj�|tj�|
���qTt�|�t�|�t�d|�t�d|�|S)zyc++ file -> native module
    Return the filename of the produced shared library
    Raises CompileError on failure

    �	build_extzsetup.pyz	--verbosez--quietz--build-libz--build-temp)rI�ext_modules�cmdclass�script_name�script_argsNc	Ssxt|d��-}t|d��}|�|���Wd�n1swYWd�dSWd�dS1s5wYdS)N�rb�wb)�openrH�read)�src_file�	dest_file�src�destr)r)r+�copy:s��"�zcompile_cxxfile.<locals>.copy�
EXT_SUFFIX�*�%{ext}r�zGenerated module: zOutput: )r$rr#r�logger�isEnabledFor�logging�INFO�
SystemExitr!ror"�get_config_var�glob�os�pathr��endswith�replace�getcwd�dirname�basename�shutil�rmtree�info)r`�cxxfile�
output_binary�kwargs�builddir�buildtmp�	extension�er��ext�f�output_directoryr)r)r+�compile_cxxfilesT��
��
���



r�FcKsBt|d�}t|||fi|��}|st�|�|St�d|�|S)zZc++ code (string) -> temporary file -> native module.
    Returns the generated .so.

    �.cppz!Keeping temporary generated file:)rLr�r��remover��warning)r`�cxxcoder��	keep_tempr��fdpathr)r)r+�compile_cxxcodeYs
��
�r�cKsX|r*t||||�}	|durt|	�dSt|	d�}
|�d�}t�|
|�t�d|�ddlm	}|dur8||�}t
|||||�\}}
d|�dg�vra|j�
dtd��|j�
dtd	�tjj���|r�tt|�d
�}
|rs|�dd
�}n|d
}t�|
|�t�d|�|Szt|t|�fd
|i|��}W|Sty�t�d�|
�t�d��w)a Pythran code (string) -> c++ code -> native module

    if `cpponly` is set to true, return the generated C++ filename
    if `pyonly` is set to true, prints the generated Python filename,
       unless `output_file` is set
    otherwise, return the generated native library filename
    Nz.pyzGenerated Python source file: r)�spec_parser�ENABLE_PYTHON_MODULE�undef_macrosz#undef ENABLE_PYTHON_MODULEz#define PY_MAJOR_VERSION {}r�r�zGenerated C++ source file: r�z4Compilation error, trying hard to find its origin...z,Nop, I'm going to flood you with C++ errors!)rj�printrLr�r��mover�r��pythran.specr�r�r_�preamble�insertr�sys�version_info�majorror�r�r!r�)r`�pythrancoder4�opts�cpponly�pyonly�output_filerbr�rJ�tmp_filer�rVrwr)r)r+�compile_pythrancodemsV


�
������

�r�c

Ks|stj�|�\}}|ptj�|�d}ntj�|�dd��\}}|p*|�dd�d}tj�|�}tj�|�dd}	tj�|	�rKt|	�}
|�d|
�z)t	|��}t
||��f||||d�|��}Wd	�W|S1smwYW|Sty�}z	|j
d	ur�||_
�d	}~ww)
a�
    Pythran file -> c++ file -> native module.

    Returns the generated .so (or .cpp if `cpponly` is set to true).

    Usage without an existing spec file

    >>> with open('pythran_test.py', 'w') as fd:
    ...    _ = fd.write('def foo(i): return i ** 2')
    >>> cpp_path = compile_pythranfile('pythran_test.py', cpponly=True)

    Usage with an existing spec file:

    >>> with open('pythran_test.pythran', 'w') as fd:
    ...    _ = fd.write('export foo(int)')
    >>> so_path = compile_pythranfile('pythran_test.py')

    Specify the output file:

    >>> import sysconfig
    >>> ext = sysconfig.get_config_vars()["SO"]
    >>> so_path = compile_pythranfile('pythran_test.py', output_file='foo'+ext)
    rr�r�r:r;z.pythranr4)r�r�r�rbN)r�r�r=�splitextr�r��isfiler�
setdefaultr�r�r�r�filename)
�	file_pathr�r`r�r�r�rir�rb�	spec_filer4�fdr�r)r)r+�compile_pythranfile�s:
�����
��r�cCs&d}td|�}|ot�|�dSdS)zMSimple passthrough compile test.
    May raises CompileError Exception.

    z*
        #include <pythonic/core.hpp>
    �testN)r�r�r�)rar�r)r)r+�test_compile�s
r�)NNN)NNrk)NF)NNFFNN)NNFF)Q�__doc__�pythran.backendrr�pythran.configr�pythran.cxxgenrrrrr	r
rrr
�pythran.distrr�pythran.middlendrr�pythran.passmanagerr�pythran.tablesr�
pythran.typesr�pythran.types.type_dependenciesr�pythran.types.conversionrr�rrr�pythran.syntaxrrr�pythran.versionr�
pythran.utilsr�pythran.frontendr]r �distutils.errorsr!�	distutilsr"�numpy.distutils.corer#�tempfiler$r%�gastrSr��os.pathr�r�r�r��	functoolsr&r��	getLoggerr�r9rCrLrYrgrjr�r�r�r�r�r�r)r)r)r+�<module>sn

�

�
!
=
�?
�:

Youez - 2016 - github.com/yon3zu
LinuXploit