ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib64/python3.11/site-packages/dill/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/dill/__pycache__/detect.cpython-311.pyc

�

�܋fS+����dZddlZddlmZmZmZmZmZddlm	Z	m
Z
mZmZm
Z
ddlmZgd�Zdd	�Zd
�Zdd�Zd
�Zdd�Zd�Zdd�Zdd�Zdd�Zd�Zdd�Zdd�Zdd�Zdd�ZdS)z=
Methods for detecting objects leading to pickling failures.
�N)�ismethod�
isfunction�istraceback�isframe�iscode�)�parent�	reference�at�parents�children)�trace)�baditems�
badobjects�badtypes�code�errors�freevars�	getmodule�
globalvars�
nestedcode�
nestedglobals�	outermost�referredglobals�referrednestedr�varnamesFc��ddlm}|||��}|s|s|Sddl}ddlm}||d���}|t|�����vr|ndS)zget the module of the objectr)rNr)�getnameT)�force)�inspectr�builtins�sourcer�vars�keys)�object�	_filenamer�getmod�moduler!r�names        �\/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/dill/detect.pyrrs���+�+�+�+�+�+�
�V�F�I�
&�
&�F�
�)�U�)�6�M��O�O�O��������7�6��&�&�&�D��t�H�~�~�2�2�4�4�4�4�8�8�$�>�c���t|��r|jjpi}nt|��r
|jpi}ndS|���}ddlm}||d���\}}n#t$rgd}}YnwxYwd�|����fd�|D��}|D]+\}}	||��||fkr|cS�#t$rY�(wxYwdS)z�get outermost enclosing object (i.e. the outer function in a closure)

    NOTE: this is the object-equivalent of getsource(func, enclosing=True)
    Nr)�getsourcelinesT)�	enclosing�c3�.�K�|]\}}|�v�	||fV��dS�N�)�.0r)�objrs   �r*�	<genexpr>zoutermost.<locals>.<genexpr>3s/�����E�E�j�t�C������S�z�����E�Er+)	r�__func__�__globals__r�itemsr"r-�	Exception�join)	�func�_globalsr-�lines�lnum�_localsr)r4rs	        @r*rr s4���
��~�~���=�,�2����	�D�	�	���#�)�r������~�~���H�&�&�&�&�&�&�$�n�T�T�:�:�:���t�t��������d��������
�7�7�5�>�>�D�E�E�E�E�H�E�E�E�G������S�	��~�c�"�"�u�T�l�2�2�3�J�J�J�2���	�	�	��D�	����
�Fs$�A&�&A7�6A7�%B;�;
C�CTc�(�t|��}t|��sgSt��}|jD]N}|��t|��}|r8|�|��|r!|tt|d�����z}�Ot
|��S)zAget the code objects for any nested functions (e.g. in a closure)NT��recurse)rr�set�	co_consts�addr�list)r;rB�nested�cos    r*rr<s�����:�:�D��$�<�<�"���
�U�U�F��n�D�D��
�:�x�
�"�X�X��
�	D��J�J�r�N�N�N��C��#�j��T�&B�&B�&B�"C�"C�C�����<�<�r+c���t|��r|j}t|��r|j}t	|��r|j}t
|��r|j}t|��r|SdS)z~get the code object for the given function or method

    NOTE: use dill.source.getsource(CODEOBJ) to get the source code
    N)	rr6r�__code__r�tb_framer�f_coder�r;s r*rrIse��
��~�~�+�d�m�t��$���-��
���4���.���$��t�}�}�(�T�[�d�
�d�|�|� �D�[�
�Fr+c��ddl}t��}t||��D]�}|�|��D]�}t	|dd��}t	|dd��|ur|�|���<t	|dd��|ur|�|���et	|dd��|ur|�|����t
|d��r||ur|�|������t|��S)aJget functions defined inside of func (e.g. inner functions in a closure)

    NOTE: results may differ if the function has been executed or not.
    If len(nestedcode(func)) > len(referrednested(func)), try calling func().
    If possible, python builds code objects, but delays building functions
    until func() is called.
    rNr6rJrL�co_code)�gcrCr�
get_referrers�getattrrE�hasattrrF)r;rBrP�funcsrHr4�_s       r*rrVs���I�I�I��E�E�E���w�'�'�G�G���#�#�B�'�'�		G�		G�C���Z��.�.�A��q�*�d�+�+�r�1�1�5�9�9�S�>�>�>�>���j�$�/�/�2�5�5�u�y�y��~�~�~�~���h��-�-��3�3�U�Y�Y�s�^�^�^�^���i�(�(�F�S�B�Y�Y��	�	�#�����		G���;�;�r+c����t���r�j�t���r�jpd��jj�niS��fd�}t
|����S)zgget objects defined in enclosing code that are referred to by func

    returns a dict of {name:object}r2c3��K�t����D])\}}	|j}n#t$rY�wxYw||jfV��*dSr1)�zip�
cell_contents�
ValueError)r)�crY�closuresr;s   ��r*�get_cell_contentsz#freevars.<locals>.get_cell_contents�sr������4��*�*�	(�	(�G�D�!�
� !��
�
���
�
�
���
�������'�'�'�'�'�	(�	(s�"�
/�/)rr6r�__closure__rJ�co_freevars�dict)r;r]r\s` @r*rrus~������~�~�+�d�m�t��$�����#�)�r���}�(����	�(�(�(�(�(�(��!�!�#�#�$�$�$r+c��t|��}|�t��Sddl}ddlm}|jdk}t
��}|d��5}tj|��ddd��n#1swxYwY|����	��D]{}d|vru|�
d��d	�
d
��d}|r*|�|�dd�����f|�|���|t|d
t����D]9}	|	r5|r3t|	��r$|�t#|	d������:t|��S)z.get the names of any globals found within funcNrr)�capturei��stdout�_GLOBAL�(����)zNULL + r/rDTrA)rrF�sys�temprb�
hexversionrC�dis�getvalue�
splitlines�splitrE�replacerR�tupler�updater)
r;rBrhrb�CAN_NULL�names�out�liner)rHs
          r*rr�s�����:�:�D��|�D�F�F�]��J�J�J��������~��*�H��E�E�E�	���	�	��c����
�
�
������������������������)�)�+�+� � �������:�:�c�?�?�2�&�,�,�S�1�1�!�4�D��
 ��	�	�$�,�,�y�"�5�5�6�6�6�6��	�	�$������d�K����1�1�:�:��
�	:�'�	:�f�R�j�j�	:��L�L��r�4�8�8�8�9�9�9����;�;�s�A/�/A3�6A3c�H�t|||�����S)z@get the names of objects in the global scope referred to by func)rr$)r;rB�builtins   r*rr�s ���d�G�W�-�-�2�2�4�4�4r+c���	�t|��r|j}t|���rd|r3tt	t
�������ni�	|t��}}|jpiD]W}	|j	}t|||��pi}|�|���	�|���H#t$rY�TwxYw�	�|j
pi��|s!|�|jj���nH|�t!|j����|���D]@}�	�|��}||ur�|�t|d|�����An�t%|��r�|r3tt	t
�������ni�	|s|j}n{|j}tt!|����}|���D]@}||ur��	�|��}|�t|d|�����AniSt)�	fd�|D����S)zdget objects defined in global scope that are referred to by func

    return a dict of {name:object}Tc3�4�K�|]}|�v�|�|fV��dSr1r2)r3r)�globss  �r*r5zglobalvars.<locals>.<genexpr>�s0�����E�E�t�t�u�}�}��e�D�k�"�}�}�}�}�E�Er+)rr6rr#r�sum�copyrCr^rYrrqrZr7rJ�co_namesr�getr�co_namer`)
r;rBrw�	orig_funcr4rY�_vars�key�nested_funcrzs
         @r*rr�s������~�~�+�d�m�t��$���+�/6�>��Y�s�^�^�$�$�)�)�+�+�+�B������4�	��(�.�B�	$�	$�C�
$� #� 1�
�#�=�'�7�C�C�I�r�����E�"�"�"����U�#�#�#�#���
�
�
���
����	���Y�*�0�b�1�1�1��
	D��K�K�	�*�3�4�4�4�4��K�K�
�i�&8�9�9�:�:�:��y�y�{�{�
D�
D��#�i�i��n�n���)�+�+�����J�{�D�'�B�B�C�C�C�C�
D�
�����/6�>��Y�s�^�^�$�$�)�)�+�+�+�B���	D��=�D�D���I��}�T�*�*�+�+�D��y�y�{�{�
D�
D���)�#�#��#�i�i��n�n�����J�{�D�'�B�B�C�C�C�C�
D��	��E�E�E�E�t�E�E�E�E�E�Es�;C�
C
�C
c�^�t|��}t|��sdS|j|jfS)ztget names of variables defined by func

    returns a tuple (local vars, local vars referrenced by nested functions)r2)rr�co_varnames�co_cellvarsrMs r*rr�s3����:�:�D��$�<�<���r���T�-�-�-r+c������t|d��sd�t|d����fD��St|dd��r|���n|}g����fd�|D��d��D��S)z'get items in object that fail to pickle�__iter__c��g|]}|�|��Sr1r2�r3�js  r*�
<listcomp>zbaditems.<locals>.<listcomp>�s��L�L�L�a�a�m��m�m�mr+r�valuesNc
�b��g|]+}|�v���t|d��������,S)r)�appendr)r3�i�_obj�exact�safes  ���r*r�zbaditems.<locals>.<listcomp>�s8���K�K�K��Q�d�]�]�T�[�[��A�a��d�+�+�,�,�]�]�]r+c��g|]}|�|��Sr1r2r�s  r*r�zbaditems.<locals>.<listcomp>�s��-�-�-�!�q�}�A�}�}�}r+)rSrrRr�)r4r�r�r�s ``@r*rr�s�������3�z�"�"�M�L�L�J�s�1�U�4�8�8�:�L�L�L�L�!�#�h�t�4�4�
=�#�*�*�,�,�,�#�C�
�D�K�K�K�K�K�K�c�K�K�K�K�-�-�t�-�-�-�-r+c�������ddlm��s������rdS�St�����fd�t���D����S)zget objects that fail to pickler��picklesNc3��K�|]D}�t�|�������|tt�|���dz
����fV��EdS�rN)rRr�r3�attr�depthr�r4r�r�s  �����r*r5zbadobjects.<locals>.<genexpr>�s}�����N�N��w�w�w�s�4�/@�/@��t�'L�'L�N�$�
�7�3�t�#4�#4�U�1�W�U�4�H�H�I�N�N�N�N�N�Nr+)�dillr�r`�dir�r4r�r�r�r�s````@r*rr�s�����������������7�3�u�T�"�"�/�4�4��
��N�N�N�N�N�N�N�N��3�x�x�N�N�N�O�O�Or+c�������ddlm��s������rdSt���St�����fd�t	���D����S)z)get types for objects that fail to picklerr�Nc3��K�|]D}�t�|�������|tt�|���dz
����fV��EdSr�)rRrr�s  �����r*r5zbadtypes.<locals>.<genexpr>�s}�����N�N��w�w�w�s�4�/@�/@��t�'L�'L�N�$����T�!2�!2�5��7�5��F�F�G�N�N�N�N�N�Nr+)r�r��typer`r�r�s````@r*rr�s�����������������7�3�u�T�"�"�/�4�4��C�y�y���N�N�N�N�N�N�N�N��3�x�x�N�N�N�O�O�Or+c�N�ddlm}m}|s�	||��}|r||ksJd|�d|�����t|��t|��ks*Jdt|���dt|�������dS#t$r!ddl}|���dcYSwxYwi}t|��D]j}		t||	��}
n1#t$r$ddl}|���d||	<Y�AwxYw||
||��st|
|dz
||��||	<�k|S)z*get errors for objects that fail to pickler)r�r|zUnpickling produces z instead of Nr)
r�r�r|r�r9rh�exc_infor�rRr)r4r�r�r�r�r|�pikrh�_dictr��_attrs           r*rrs���"�"�"�"�"�"�"�"��%�
	%��$�s�)�)�C��
G��c�z�z�z�z�>A�c�c�#�#�F�"�z�z���9�9��S�	�	�)�)�)�)�:>�s�)�)�)�)�D��I�I�I�N�*�)�)��4���	%�	%�	%��J�J�J��<�<�>�>�!�$�$�$�$�	%����
�E��C���;�;��	��C��%�%�E�E���	�	�	��J�J�J��,�,�.�.��+�E�$�K��H�	�����w�u�U�4�(�(�	;� ��u�Q�w�u�T�:�:�E�$�K���Ls$�A-A;�;(B&�%B&�=C�+C<�;C<)NF)T)TF)FF)rFF)�__doc__rkr rrrrr�pointersr	r
rrr
�loggerr�__all__rrrrrrrrrrrrrrr2r+r*�<module>r�s������
�
�
�F�F�F�F�F�F�F�F�F�F�F�F�F�F�>�>�>�>�>�>�>�>�>�>�>�>�>�>�������B�B�B��?�?�?�?����8����
�
�
�����>%�%�%�,����,5�5�5�5�2F�2F�2F�2F�j.�.�.�.�.�.�.�O�O�O�O�O�O�O�O������r+

Zerion Mini Shell 1.0