CasperSecurity

Current Path : /usr/lib/python3.10/test/support/__pycache__/
Upload File :
Current File : //usr/lib/python3.10/test/support/__pycache__/warnings_helper.cpython-310.pyc

o

`�wi��@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�len�
assertTrue�
issubclass�category�assertRegex�str�message�filename�assertIsNotNoner)�testcase�	statement�errtextrrr�warns�warn�r"�3/usr/lib/python3.10/test/support/warnings_helper.py�check_syntax_warnings.����r$cs�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�testr"r#�wrapper-s
$�z3ignore_warnings.<locals>.decorator.<locals>.wrapper)�	functools�wraps)r*r+r&)r*r#�	decorator,sz"ignore_warnings.<locals>.decoratorr")rr.r"r&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'�
warnings_listr"r"r#�__init__:s
zWarningsRecorder.__init__cCs@t|j�|jkrt|jd|�S|tjjvrdStd||f��)N���z%r has no attribute %r)rr2r3�getattrr�WarningMessage�_WARNING_DETAILS�AttributeError)r'�attrr"r"r#�__getattr__>s
zWarningsRecorder.__getattr__cCs|j|jd�S�Nr1�r'r"r"r#rEszWarningsRecorder.warningscCst|j�|_dSr=)rr2r3r>r"r"r#�resetIszWarningsRecorder.resetN)	�__name__�
__module__�__qualname__�__doc__r5r<�propertyrr?r"r"r"r#r06s
r0cOs.|�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)rEr"r"r#�check_warningsMs


rJFccsj�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
rKrr�filterwarningsr)rrr�force_gcrKr r"r"r#�check_no_warningses����rNccs<�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)rrMN)rN�ResourceWarning)rr"r"r#�check_no_resource_warning~s�"�rPccs�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.
    ��__warningregistry__Trrr
NFzunhandled warning %srz)filter (%r, %s) did not catch any warning)�sys�	_getframe�	f_globalsrF�clearrr�modulesrr0�listr�re�matchr�Ir�	__class__�remove�appendr@�AssertionError)rIrE�frame�registry�w�reraise�missing�msg�cat�seen�warningr"r"r#rH�s>�
�
�
����rHc
cs<�tjdd�}z
dVW|tjdd�<dS|tjdd�<wr=)rrI)�old_filtersr"r"r#�save_restore_warnings_filters�s
�"rjcCstjdtdd�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!�DeprecationWarningr"r"r"r#�_warn_about_deprecation�s

�rm)r)F)�
contextlibr,rYrSrr$r/�objectr0�contextmanagerrJrGrNrPrHrjrmr"r"r"r#�<module>s(�


'

Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY