Your IP : 3.145.105.199


Current Path : /opt/imunify360/venv/lib64/python3.11/site-packages/cffi/__pycache__/
Upload File :
Current File : //opt/imunify360/venv/lib64/python3.11/site-packages/cffi/__pycache__/verifier.cpython-311.pyc

�

S�Dg�+���ddlZddlZddlZddlZddlZddlmZddlmZddlm	Z	ej
dkrddlZd�Z
nddlZd�Z
ej
d	krejZnGd
�dej��ZGd�d
e��ZdZd�Zdad�Zd�Zdd�Zd�Zd�ZdS)�N�)�__version_verifier_modules__)�ffiplatform)�VerificationError)�rc�4�tjjdd�S�N)�	importlib�	machinery�EXTENSION_SUFFIXES���o/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib64/python3.11/site-packages/cffi/verifier.py�_extension_suffixesrs���"�5�a�a�a�8�8rc�<�d�tj��D��S)Nc�:�g|]\}}}|tjk�|��Sr
)�imp�C_EXTENSION)�.0�suffix�_�types    r�
<listcomp>z'_extension_suffixes.<locals>.<listcomp>s4��,�,�,�?�6�1�d��3�?�*�*��*�*�*r)r�get_suffixesr
rrrrs+��,�,�c�.>�.@�.@�,�,�,�	,r�rc���eZdZ�fd�Z�xZS)�NativeIOc���t|t��r|�d��}tt|���|��dS)N�ascii)�
isinstance�unicode�encode�superr�write)�self�s�	__class__s  �rr$zNativeIO.writesJ����!�W�%�%�
&��H�H�W�%�%���(�D�!�!�'�'��*�*�*�*�*r)�__name__�
__module__�__qualname__r$�
__classcell__)r's@rrrs8�������	+�	+�	+�	+�	+�	+�	+�	+�	+rrc�h�eZdZ			dd�Zdd�Zd�Zd�Zd	�Zd
�Zd�Z	d�Z
d
�Zd�Zdd�Z
d�Zd�ZdS)�VerifierN�F�.cc���|jjrtd|jj�����||_||_|stj|��}t||��}
|
|��|_|j�	|��|	|_
|�||
��|_|r|rtd����n d�dtjdd�zt"||g|jz��}tjdkr|�d��}t)t+j|ddd���d	z��}|�d
���d��}t)t+j|ddd���d	z��}|�d
���d��}d|�d|jj�|�|��}t5��d}|p
t7��|_t:j�|j||z��|_t:j�|j||z��|_ ||_!d|_"d|_#dS)NzIfeature not supported with ffi.verify(), but only with ffi.set_source(): z)can't specify both 'modulename' and 'tag'�z%d.%d�rzutf-8rl���0x�Lr�0�_cffi_rF)$�_parser�_uses_new_featurer�ffi�preambler�flatten�_locate_engine_class�_vengine�patch_extension_kwds�flags�make_relative_to�kwds�	TypeError�join�sys�version_infor�_cdefsourcesr"�hex�binascii�crc32�lstrip�rstrip�
_class_key�_get_so_suffixes�_caller_dir_pycache�tmpdir�os�path�sourcefilename�modulefilename�ext_package�_has_source�_has_module)r%r9r:rO�
modulenamerT�tag�force_generic_engine�source_extensionr?�relative_torA�flattened_kwds�
vengine_class�key�k1�k2rs                  r�__init__zVerifier.__init__ sj���;�(�	P�#�#�/2�{�/L�/L�O�P�P�
P���� ��
��	7�(�0��6�6�N�,�S�2F�G�G�
�%�
�d�+�+��
��
�*�*�4�0�0�0���
��)�)�$��<�<��	��	6��
M�� K�L�L�L�
M��+�+�w��)9�"�1�"�)=�=�;�'��9�"�.�/�0�0�C���4�'�'��j�j��)�)���X�^�C���1��I�.�.��;�<�<�B����4���'�'��,�,�B��X�^�C���1��I�.�.��;�<�<�B����3���&�&�s�+�+�B�B�.1�c�c�4�=�3K�3K�.0�b�"�"�6�J�!�#�#�A�&���5� 3� 5� 5��� �g�l�l�4�;�
�EU�8U�V�V��� �g�l�l�4�;�
�V�8K�L�L���&��� ��� ����rc��|jj5|jr|�td���|�|��ddd��dS#1swxYwYdS)zkWrite the C source code.  It is produced in 'self.sourcefilename',
        which can be tweaked beforehand.Nzsource code already written)r9�_lockrUr�
_write_source�r%�files  r�write_sourcezVerifier.write_sourceIs����X�^�	%�	%���
3�D�L�'�1�3�3�3����t�$�$�$�		%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%����	%�	%�	%�	%�	%�	%s�.A�A�Ac���|jj5|jrtd���|js|���|���ddd��dS#1swxYwYdS)z�Write the C source code (if not done already) and compile it.
        This produces a dynamic link library in 'self.modulefilename'.zmodule already compiledN)r9rcrVrrUrd�_compile_module�r%s r�compile_modulezVerifier.compile_moduleRs����X�^�	#�	#���
C�'�(A�B�B�B��#�
%��"�"�$�$�$�� � �"�"�"�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#�	#����	#�	#�	#�	#�	#�	#s�AA � A$�'A$c��|jj5|jsJ|���|js/|js|���|���|���cddd��S#1swxYwYdS)a"Get a C module from this Verifier instance.
        Returns an instance of a FFILibrary class that behaves like the
        objects returned by ffi.dlopen(), but that delegates all
        operations to the C module.  If necessary, the C code is written
        and compiled first.
        N)r9rcrV�_locate_modulerUrdri�
_load_libraryrjs r�load_libraryzVerifier.load_library\s����X�^�	(�	(��#�
+��#�#�%�%�%��'�+��+�-��*�*�,�,�,��(�(�*�*�*��%�%�'�'�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(����	(�	(�	(�	(�	(�	(s�A%A?�?B�Bc���tj�|j��}|�dd��d}|�d��rt
td��r
|dd�}|S)N�.rr�_d�gettotalrefcount���)rPrQ�basenamerS�split�endswith�hasattrrD)r%rus  r�get_module_namezVerifier.get_module_namelsp���7�#�#�D�$7�8�8���>�>�#�q�)�)�!�,�����T�"�"�	%�w�s�4F�'G�'G�	%�����}�H��rc�>�tj��|js?|jj5|js|���ddd��n#1swxYwYtj|j��}|���}tj	||fi|j
��Sr	)r�_hack_at_distutilsrUr9rcrd�maybe_relative_pathrRry�
get_extensionrA)r%�
sourcename�modnames   rr}zVerifier.get_extensionws����&�(�(�(���	)����
)�
)��'�)��&�&�(�(�(�
)�
)�
)�
)�
)�
)�
)�
)�
)�
)�
)����
)�
)�
)�
)�!�4�T�5H�I�I�
��&�&�(�(���(��W�J�J��	�J�J�Js�A�A�Ac��|jjSr	)r=�_gen_python_modulerjs r�generates_python_modulez Verifier.generates_python_module�s
���}�/�/rc�j��|r�tj�|��r�tj�|���|���}tjD]P}||vrJ||}t
|ttf��std|�d�����fd�|D��}|||<�Q|S)Nz	keyword 'z' should be a list or tuplec�P��g|]"}tj��|����#Sr
)rPrQrC)r�fn�dirnames  �rrz-Verifier.make_relative_to.<locals>.<listcomp>�s)���C�C�C��2�7�<�<���4�4�C�C�Cr)
rPrQr��copyr�LIST_OF_FILE_NAMESr �list�tuplerB)r%rAr[r^�lstr�s     @rr@zVerifier.make_relative_to�s�����
	$�2�7�?�?�;�7�7�
	$��g�o�o�k�2�2�G��9�9�;�;�D�"�5�
$�
$���$�;�;��s�)�C�%�c�D�%�=�9�9�2�'�i�+.�3�3�)1�2�2�2�C�C�C�C�s�C�C�C�C� #�D��I���rc��tj�|j��s�|jr3	t|jdddg��}n#t$rYdSwxYw|j}nd}|j�	|�
��|t����}|�dS||_|j���d|_
dS)N�__doc__T)rPrQ�isfilerSrT�
__import__�ImportError�__path__r=�find_moduleryrM�
collect_typesrV)r%�pkgrQ�filenames    rrmzVerifier._locate_module�s����w�~�~�d�1�2�2�	+���
��$�T�%5�t�T�I�;�O�O�C�C��"�����F�F������|������}�0�0��1E�1E�1G�1G��1A�1C�1C�E�E�H�����"*�D���
�#�#�%�%�%�����s�A�
A�Ac�x�||j_	|j���|j`dS#|j`wxYwr	)r=�_f�write_source_to_fres  r�_write_source_tozVerifier._write_source_to�sG����
��	!��M�+�+�-�-�-��
� � � ���
� � � � � s�0�	9c�>�|�|�|��dSt��}|�|��|���}tj�|j��rGt|jd��5}|���|k}ddd��n#1swxYwYnd}|rVt|j��t|jd��5}|�
|��ddd��n#1swxYwYd|_dS)N�rT�w)r�r�getvaluerPrQ�existsrR�open�read�_ensure_dirr$rU)r%rf�f�source_data�fp�
needs_writtens      rrdzVerifier._write_source�s������!�!�$�'�'�'�'�'��
�
�A��!�!�!�$�$�$��*�*�,�,�K��w�~�~�d�1�2�2�
%��$�-�s�3�3�C�r�)+�����k�)A�$B�M�C�C�C�C�C�C�C�C�C�C�C����C�C�C�C��!%�
��
*��D�/�0�0�0��$�-�s�3�3�*�r��H�H�[�)�)�)�*�*�*�*�*�*�*�*�*�*�*����*�*�*�*� $�D���s$�
B0�0B4�7B4�)D�D�Dc�f�tj�|j��}t	j||�����}	t	j||j��}n#t$rd}YnwxYw|s.t|j��tj||j��d|_
dS)NFT)rPrQr�rRr�compiler}�samefilerS�OSErrorr��shutil�moverV)r%rO�outputfilename�sames    rrizVerifier._compile_module�s��������!4�5�5��$�,�V�T�5G�5G�5I�5I�J�J��	��'���8K�L�L�D�D���	�	�	��D�D�D�	�����	=���+�,�,�,��K���(;�<�<�<�����s�
A(�(A7�6A7c��|jsJ�|j�|j�|j��S|j���Sr	)rVr?r=rorjs rrnzVerifier._load_library�sE��������:�!��=�-�-�d�j�9�9�9��=�-�-�/�/�/r)NNNr.Fr/NNr	)r(r)r*rargrkroryr}r�r@rmr�rdrirnr
rrr-r-s�������>B�@E�@D�'!�'!�'!�'!�R%�%�%�%�#�#�#�(�(�(� 	�	�	�K�K�K�0�0�0����  � � �&!�!�!�$�$�$�$�2 � � �0�0�0�0�0rr-Fc��trd}|s4dtjvrd}n#	ddl}n#t$rd}YnwxYw|j|urd}|r
ddlm}|jSddlm	}|j
S)NT�__pypy__r�?r)�vengine_gen)�vengine_cpy)�_FORCE_GENERIC_ENGINErD�builtin_module_names�
_cffi_backendr��_backendr.r��VGenericEnginer��VCPythonEngine)r9rYr�r�r�s     rr<r<�s����$�#���	,���1�1�1�#'� � �
$�$�$�$�$�$���
$�
$�
$� #�
�
�
�
$�����|�=�0�0�'+�$��*�!�!�!�!�!�!��)�)�!�!�!�!�!�!��)�)s�#�2�2c�T�trtStj�d��}|r|St	jd��jj}tj�	tj�
tj�|��d����S)N�CFFI_TMPDIRr2�__pycache__)�_TMPDIRrP�environ�getrD�	_getframe�f_code�co_filenamerQ�abspathrCr�)�resultr�s  rrNrN�s�������
�Z�^�^�M�
*�
*�F�
���
��}�Q���&�2�H�
�7�?�?�2�7�<�<������(A�(A�(�*�*�+�+�+rc�
�|adS)z:Set the temporary directory to use instead of __pycache__.N)r�)r�s r�
set_tmpdirr�s
���G�G�Grc��|p
t��}	tj|��}n#t$rYdSwxYw|rd}n&t	��d���}|D]�}|����d��r�|����|��s'|����d��rD	tjtj	�
||������#t$rY��wxYw��tj	�
|d��g}|D]�}	tj|��D]k}tj	�
||��}tj	�|��r|�|���Wtj|���l��#t$rY��wxYwdS)z}Clean up the temporary directory by removing all files in it
    called `_cffi_*.{c,so}` as well as the `build` subdirectory.Nr/rr6�build)
rNrP�listdirr�rM�lower�
startswithrw�unlinkrQrC�isdir�append)rO�keep_so�filelistrr��	clean_dir�dirs       r�cleanup_tmpdirr�s����
,�*�,�,�F���:�f�%�%����������������/����!�#�#�A�&�,�,�.�.������
�8�8�:�:� � ��*�*�	����
�
�#�#�F�+�+�	�/1�x�x�z�z�/B�/B�4�/H�/H�	�
��	�"�'�,�,�v�r�2�2�3�3�3�3���
�
�
���
���������f�g�.�.�/�I��	�	��	��j��o�o�
"�
"���W�\�\�#�r�*�*���7�=�=��$�$�"��$�$�R�(�(�(�(��I�b�M�M�M�M�
"���	�	�	��D�	����	�	s1�'�
5�5�2D�
D�D�BG�
G�Gc�T�t��}|stjdkrdg}ndg}|S)N�win32z.pydz.so)rrD�platform)�suffixess rrMrM%s7��"�$�$�H����<�7�"�"��x�H�H��w�H��Orc��tj�|��}|r5tj�|��stj|��dSdSdSr	)rPrQr�r��makedirs)r�r�s  rr�r�0s\���g�o�o�h�'�'�G���r�w�}�}�W�-�-��
��G���������r)NF)rDrPrHr��ior.rr�errorrrE�importlib.machineryr
rr�StringIOr�BytesIO�objectr-r�r<r�rNr�r�rMr�r
rr�<module>r�s���%�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$�*�*�*�*�*�*�������$�$�$�$�$�$���v�������9�9�9�9��J�J�J�,�,�,�
��t����{�H�H�+�+�+�+�+�2�:�+�+�+�{0�{0�{0�{0�{0�v�{0�{0�{0�~��*�*�*�,��+�+�+����
����>	�	�	�����r

?>