Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.9/test/support/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.9/test/support/__pycache__/warnings_helper.cpython-39.opt-1.pyc

a

��g��@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�offsetcCs ddlm}tjdd��(}t�dt�t|dd�Wd�n1sF0Y|�t|�d|�|\}|�	t
|jt�|j�|r�|�t
|j�|�|�|jd�|�|j�|dur�|�|j|�tjdd��.}t�d	t�||||||d
�Wd�n1�s0Y|�|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�8/usr/local/lib/python3.9/test/support/warnings_helper.py�check_syntax_warnings**��&rcs�fdd�}|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.
    cst�����fdd��}|S)NcsPt���4tjd�d��|g|�Ri|��Wd�S1sB0YdS)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__:szWarningsRecorder.__init__cCsDt|j�|jkr t|jd|�S|tjjvr0dStd||f��dS)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�}|s$dtff}|dur$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)�filtersr$r?rrr�check_warningsMs

rDFccshddlm}tjdd��0}tjd||d�dV|r:|�Wd�n1sN0Y|�|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�$rHccs8t|tdd��dVWd�n1s*0YdS)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~srJccst�d�}|j�d�}|r"|��tjdd��*}tjd�d�t	|�VWd�n1s^0Yt
|�}g}|D]j\}}d}	|dd�D]8}|j}
t�
|t|
�tj�r�t|
j|�r�d}	|�|�q�|	sx|sx|�||jf�qx|r�td	|d
��|�rtd|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�s4
(
��rBc
cs<tjdd�}zdVW|tjdd�<n|tjdd�<0dSr7)rrC)Zold_filtersrrr�save_restore_warnings_filters�sracCstjdtdd�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&�


'


Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists