HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/test/support/__pycache__/warnings_helper.cpython-310.opt-1.pyc
o

�i��@s�ddlZddlZddlZddlZddlZdddd�dd�Zdd�ZGd	d
�d
e�Zej	dd��Z
ej	ded
fdd��Zej	dd��Z
ddd�Zej	dd��Zdd�ZdS)�N����lineno�offsetcCsddlm}tjdd��}t�dt�t|dd�Wd�n1s#wY|�t|�d|�|\}|�	t
|jt�|j�|rJ|�t
|j�|�|�|jd�|�|j�|durb|�|j|�tjdd��}t�d	t�||||||d
�Wd�n1s�wY|�|g�dS)Nr)�check_syntax_errorT��record�alwaysz
<testcase>�execr�errorr)�test.supportr�warnings�catch_warnings�simplefilter�
SyntaxWarning�compile�assertEqual�lenZ
assertTrue�
issubclass�categoryZassertRegex�str�message�filenameZassertIsNotNoner)�testcaseZ	statementZerrtextrrr�warns�warn�r�9/usr/local/lib/python3.10/test/support/warnings_helper.py�check_syntax_warnings.����rcs�fdd�}|S)z�Decorator to suppress warnings.

    Use of context managers to hide warnings make diffs
    more noisy and tools like 'git blame' less useful.
    cst�����fdd��}|S)NcsPt���tjd�d��|g|�Ri|��Wd�S1s!wYdS)N�ignore�r)rrr)�self�args�kwargs)r�testrr�wrapper-s
$�z3ignore_warnings.<locals>.decorator.<locals>.wrapper)�	functools�wraps)r%r&r!)r%r�	decorator,sz"ignore_warnings.<locals>.decoratorr)rr)rr!r�ignore_warnings&sr*c@s4eZdZdZdd�Zdd�Zedd��Zdd	�Zd
S)�WarningsRecorderzyConvenience wrapper for the warnings list returned on
       entry to the warnings.catch_warnings() context manager.
    cCs||_d|_dS)Nr��	_warnings�_last)r"Z
warnings_listrrr�__init__:s
zWarningsRecorder.__init__cCs@t|j�|jkrt|jd|�S|tjjvrdStd||f��)N���z%r has no attribute %r)rr-r.�getattrr�WarningMessage�_WARNING_DETAILS�AttributeError)r"�attrrrr�__getattr__>s
zWarningsRecorder.__getattr__cCs|j|jd�S�Nr,�r"rrrrEszWarningsRecorder.warningscCst|j�|_dSr7)rr-r.r8rrr�resetIszWarningsRecorder.resetN)	�__name__�
__module__�__qualname__�__doc__r/r6�propertyrr9rrrrr+6s
r+cOs.|�d�}|sdtff}|durd}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)�filtersr$r?rrr�check_warningsMs


rDFccsj�ddlm}tjdd��}tjd||d�dV|r|�Wd�n1s(wY|�|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
)rrN)r
rErr�filterwarningsr)rrr�force_gcrErrrr�check_no_warningses����rHccs<�t|tdd��dVWd�dS1swYdS)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)rrGN)rH�ResourceWarning)rrrr�check_no_resource_warning~s�"�rJccs�t�d�}|j�d�}|r|��tjdd��}tjd�d�t	|�VWd�n1s0wYt
|�}g}|D]5\}}d}	|dd�D]}|j}
t�
|t|
�tj�ret|
j|�red}	|�|�qI|	sr|sr|�||jf�q=|r}td	|d
��|r�td|d
��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.
    �Z__warningregistry__Trrr
NFzunhandled warning %srz)filter (%r, %s) did not catch any warning)�sys�	_getframe�	f_globalsr@�clearrr�modulesrr+�listr�re�matchr�Ir�	__class__�remove�appendr:�AssertionError)rCr?�frame�registry�wZreraise�missing�msg�cat�seen�warningrrrrB�s>�
�
�
����rBc
cs<�tjdd�}z
dVW|tjdd�<dS|tjdd�<wr7)rrC)Zold_filtersrrr�save_restore_warnings_filters�s
�"racCstjdtdd�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�DeprecationWarningrrrr�_warn_about_deprecation�s

�rd)r)F)�
contextlibr'rRrLrrr*�objectr+�contextmanagerrDrArHrJrBrardrrrr�<module>s(�


'