HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/self/root/lib/python3.11/test/support/__pycache__/
Upload File :
Current File : //proc/self/root/lib/python3.11/test/support/__pycache__/warnings_helper.cpython-311.pyc
�

*�Kg����ddlZddlZddlZddlZddlZddlZd�Zdddd�d�Zd�ZGd�d	e	��Z
ejd
���Zejde
dfd���Zejd
���Zdd�Zejd���Zd�ZdS)�Nc��tj��5tjdt���t	j|��cddd��S#1swxYwYdS)z3Import *name* while suppressing DeprecationWarning.�ignore��categoryN)�warnings�catch_warnings�simplefilter�DeprecationWarning�	importlib�
import_module)�names �3/usr/lib/python3.11/test/support/warnings_helper.py�import_deprecatedr	s���	�	 �	"�	"�-�-���h�1C�D�D�D�D��&�t�,�,�-�-�-�-�-�-�-�-�-�-�-�-����-�-�-�-�-�-s�/A�A�A����lineno�offsetc�J�ddlm}tjd���5}tjdt
��t
|dd��ddd��n#1swxYwY|�t|��d|��|\}|�	t|jt
��|j��|r(|�t|j��|��|�|jd��|�|j��|�|�|j|��tjd���5}tjd	t
��||||||�
��ddd��n#1swxYwY|�|g��dS)Nr)�check_syntax_errorT��record�alwaysz
<testcase>�execr�errorr)�test.supportrrrr	�
SyntaxWarning�compile�assertEqual�len�
assertTrue�
issubclassr�assertRegex�str�message�filename�assertIsNotNoner)�testcase�	statement�errtextrrr�warns�warns        r�check_syntax_warningr-s%��0�/�/�/�/�/�	�	 ��	-�	-�	-�1����h�
�6�6�6��	�<��0�0�0�1�1�1�1�1�1�1�1�1�1�1����1�1�1�1�
����U���Q��.�.�.��E�D����
�4�=�-�@�@��
�'�'�'��9����S���.�.��8�8�8�������5�5�5����T�[�)�)�)�
�����T�[�&�1�1�1�

�	 ��	-�	-�	-�9����g�}�5�5�5���8�Y��"(��	9�	9�	9�	9�9�9�9�9�9�9�9�9�9�9�9����9�9�9�9�

�����#�#�#�#�#s#�,A�A�A�+F�F�	Fc����fd�}|S)z�Decorator to suppress deprecation warnings.

    Use of context managers to hide warnings make diffs
    more noisy and tools like 'git blame' less useful.
    c�J���tj�����fd���}|S)Nc���tj��5tjd�����|g|�Ri|��cddd��S#1swxYwYdS)Nrr)rrr	)�self�args�kwargsr�tests   ��r�wrapperz3ignore_warnings.<locals>.decorator.<locals>.wrapper5s�����(�*�*�
3�
3��%�h��B�B�B�B��t�D�2�4�2�2�2�6�2�2�
3�
3�
3�
3�
3�
3�
3�
3�
3�
3�
3�
3����
3�
3�
3�
3�
3�
3s�"A�A�A)�	functools�wraps)r4r5rs` �r�	decoratorz"ignore_warnings.<locals>.decorator4s>����	���	�	�	3�	3�	3�	3�	3�
�	�	3����)rr8s` r�ignore_warningsr;.s$���������r9c�:�eZdZdZd�Zd�Zed���Zd�ZdS)�WarningsRecorderzyConvenience wrapper for the warnings list returned on
       entry to the warnings.catch_warnings() context manager.
    c�"�||_d|_dS)Nr��	_warnings�_last)r1�
warnings_lists  r�__init__zWarningsRecorder.__init__Bs��&�����
�
�
r9c���t|j��|jkrt|jd|��S|tjjvrdSt|�d|�����)N���z has no attribute )r r@rA�getattrr�WarningMessage�_WARNING_DETAILS�AttributeError)r1�attrs  r�__getattr__zWarningsRecorder.__getattr__Fs_���t�~�����+�+��4�>�"�-�t�4�4�4�
�X�,�=�
=�
=��4�����t�t�D�E�E�Er9c�*�|j|jd�S�Nr?�r1s rrzWarningsRecorder.warningsMs���~�d�j�k�k�*�*r9c�8�t|j��|_dSrM)r r@rArNs r�resetzWarningsRecorder.resetQs�����(�(��
�
�
r9N)	�__name__�
__module__�__qualname__�__doc__rCrK�propertyrrPr:r9rr=r=>si�����������F�F�F��+�+��X�+�)�)�)�)�)r9r=c�l�|�d��}|sdtff}|�d}t||��S)a�Context manager to silence warnings.

    Accept 2-tuples as positional arguments:
        ("message regexp", WarningCategory)

    Optional argument:
     - if 'quiet' is True, it does not fail if a filter catches nothing
        (default True without argument,
         default False if some filters are defined)

    Without argument, it defaults to:
        check_warnings(("", Warning), quiet=True)
    �quietrNT)�get�Warning�_filterwarnings)�filtersr3rWs   r�check_warningsr\UsC��
�J�J�w���E�����=�"���=��E��7�E�*�*�*r9Fc#��K�ddlm}tjd���5}tjd||���dV�|r
|��ddd��n#1swxYwY|�|g��dS)a�Context manager to check that no warnings are emitted.

    This context manager enables a given warning within its scope
    and checks that no warnings are emitted even with that warning
    enabled.

    If force_gc is True, a garbage collection is attempted before checking
    for warnings. This may help to catch warnings emitted when objects
    are deleted, such as ResourceWarning.

    Other keyword arguments are passed to warnings.filterwarnings().
    r)�
gc_collectTrr)r%rN)rr^rr�filterwarningsr)r(r%r�force_gcr^r+s      r�check_no_warningsrams�����(�'�'�'�'�'�	�	 ��	-�	-�	-������(/�)1�	3�	3�	3�	3�	�����	��J�L�L�L�
������������������
�����#�#�#�#�#s�(A�A�Ac#�rK�t|td���5dV�ddd��dS#1swxYwYdS)a"Context manager to check that no ResourceWarning is emitted.

    Usage:

        with check_no_resource_warning(self):
            f = open(...)
            ...
            del f

    You must remove the object which may emit ResourceWarning before
    the end of the context manager.
    T)rr`N)ra�ResourceWarning)r(s r�check_no_resource_warningrd�s�����
�8�o��	M�	M�	M���
������������������������s�,�0�0c#�K�tjd��}|j�d��}|r|���tjd���5}tjd�d��t|��V�ddd��n#1swxYwYt|��}g}|D]�\}}d}	|dd�D]b}|j}
tj
|t|
��tj��r,t!|
j|��rd}	|�|���c|	s|s|�||jf����|rt+d	|d
z���|rt+d|d
z���dS)z�Catch the warnings, then check if all the expected
    warnings have been raised and re-raise unexpected warnings.
    If 'quiet' is True, only re-raise the unexpected warnings.
    ��__warningregistry__TrrrNFzunhandled warning %srz)filter (%r, %s) did not catch any warning)�sys�	_getframe�	f_globalsrX�clearrr�modulesr	r=�listr%�re�matchr$�Ir"�	__class__�remove�appendrQ�AssertionError)r[rW�frame�registry�w�reraise�missing�msg�cat�seen�warnings           rrZrZ�s�����
�M�!���E���"�"�#8�9�9�H���������	�	 ��	-�	-�	-�"��	��J��,�,�X�6�6�6��q�!�!�!�!�!�"�"�"�"�"�"�"�"�"�"�"����"�"�"�"��1�g�g�G��G��0�0���S��������	"�	"�A��i�G����c�'�l�l�B�D�1�1�
"��7�,�c�2�2�
"������q�!�!�!���	0�E�	0��N�N�C���.�/�/�/���B��3�g�a�j�@�A�A�A��)��H�$�Q�Z�(�)�)�	)�)�)s�7B�B#�&B#c#�K�tjdd�}	dV�|tjdd�<dS#|tjdd�<wxYwrM)rr[)�old_filterss r�save_restore_warnings_filtersr��sY�����"�1�1�1�%�K�*�
����)����������k�������)�)�)�)s	�/�Ac�>�tjdtd���dS)Nz�This is used in test_support test to ensure support.ignore_deprecations_from() works as expected. You should not be seeing this.r)�
stacklevel)rr,r
r:r9r�_warn_about_deprecationr��s2���M�	*�	�������r9)r)F)�
contextlibr6rrnrhrrr-r;�objectr=�contextmanagerr\rYrardrZr�r�r:r9r�<module>r�se��������������	�	�	�	�
�
�
�
�����-�-�-�$�#$�T�$�$�$�$�$�<
�
�
� )�)�)�)�)�v�)�)�)�.��+�+���+�.��(*�W�u�$�$�$���$�0�������"$)�$)�$)�$)�N��*�*���*�����r9