⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.144
Server IP:
157.245.143.252
Server:
Linux www 6.11.0-9-generic #9-Ubuntu SMP PREEMPT_DYNAMIC Mon Oct 14 13:19:59 UTC 2024 x86_64
Server Software:
nginx/1.26.0
PHP Version:
8.3.11
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
lib
/
python3.12
/
test
/
support
/
__pycache__
/
View File Name :
warnings_helper.cpython-312.pyc
CRh d dl Z d dlZd dlZd dlZd dlZd dlZd ZdddddZd Z G d d e Z e j d Ze j de dfd Ze j d ZddZe j d Zd Zy) Nc t j 5 t j dt t j | cddd S # 1 sw Y yxY w)z3Import *name* while suppressing DeprecationWarning.ignorecategoryN)warningscatch_warningssimplefilterDeprecationWarning importlib import_module)names 3/usr/lib/python3.12/test/support/warnings_helper.pyimport_deprecatedr s9 "h1CD&&t, # " "s 0AA linenooffsetc ddl m} t j d 5 }t j dt t |dd d d d | j t d| |\ }| j t |j t |j |r%| j t |j | | j |j d | j! |j" || j |j" | t j d 5 }t j d t || |||| d d d | j |g y # 1 sw Y 3xY w# 1 sw Y )xY w)Nr )check_syntax_errorTrecordalwaysz
execr errorr )test.supportr r r r SyntaxWarningcompileassertEquallen assertTrue issubclassr assertRegexstrmessagefilenameassertIsNotNoner )testcase statementerrtextr r r warnswarns r check_syntax_warningr- s3 0 -h 6 <0 . UQ.ED 4==-@ 'S.85T[[) T[[&1 -g}58Y"( 9 . #/ . -$ . -s (E63(F6F Fc fd}|S )zDecorator to suppress warnings. Use of context managers to hide warnings make diffs more noisy and tools like 'git blame' less useful. c F t j fd }|S )Nc t j 5 t j d | g|i |cd d d S # 1 sw Y y xY w)Nr r )r r r )selfargskwargsr tests r wrapperz3ignore_warnings.
.decorator.
.wrapper5 s= ((*%%hBD24262 +**s #AA) functoolswraps)r4 r5 r s ` r decoratorz"ignore_warnings.
.decorator4 s% 3 3 )r r8 s ` r ignore_warningsr; . s r9 c 2 e Zd ZdZd Zd Zed Zd Zy)WarningsRecorderzyConvenience wrapper for the warnings list returned on entry to the warnings.catch_warnings() context manager. c || _ d| _ y )Nr _warnings_last)r1 warnings_lists r __init__zWarningsRecorder.__init__B s & r9 c t | j | j kD rt | j d | S |t j j v ry t | d| )Nz has no attribute )r r@ rA getattrr WarningMessage_WARNING_DETAILSAttributeError)r1 attrs r __getattr__zWarningsRecorder.__getattr__F sT t~~+4>>"-t44 X,,== =tDEEr9 c 4 | j | j d S Nr? r1 s r r zWarningsRecorder.warningsM s ~~djjk**r9 c 8 t | j | _ y rM )r r@ rA rN s r resetzWarningsRecorder.resetQ s ( r9 N) __name__ __module____qualname____doc__rC rK propertyr rP r: r9 r r= r= > s+ F + +)r9 r= c Z |j d }| s dt ff} |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) quietr T)getWarning_filterwarnings)filtersr3 rW s r check_warningsr\ U s8 JJwE="=E7E**r9 Fc # K ddl m} t j d 5 }t j d|| d |r | ddd | j g y# 1 sw Y xY ww)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_collectTr r )r% r N)r r^ r r filterwarningsr )r( r% r force_gcr^ r+ s r check_no_warningsra m s] ( -(/)1 3 L . # . -s A,&A A, A)%A,c # b K t | t d 5 d ddd y# 1 sw Y yxY ww)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)r r` N)ra ResourceWarning)r( s r check_no_resource_warningrd s# 8o M N M Ms /# /,/c # K t j d }|j j d }|r|j t j d 5 }t j d j d t | ddd t }g }| D ] \ }}d} |dd D ]g }|j } t j |t | t j s>t! | j" | sUd} |j% | i | rz|r}|j' ||j( f |rt+ d |d z |rt+ d|d z y# 1 sw Y xY ww)zCatch 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__Tr r r NFzunhandled warning %sr z)filter (%r, %s) did not catch any warning)sys _getframe f_globalsrX clearr r modulesr r= listr% rematchr$ Ir" __class__removeappendrQ AssertionError)r[ rW frameregistrywreraisemissingmsgcatseenwarnings r rZ rZ sF MM!E""#89H - J,,X6q!! . 1gGGSAiiGc'lBDD17,,c2q! ENNC./ 3gaj@AAH$QZ( ) ) / . -s8 AE10E%A!E1-E1E1E1AE1%E.*E1c # K t j d d } d | t j d d y # | t j d d w xY wwrM )r r[ )old_filterss r save_restore_warnings_filtersr s> ""1%K* )ks A/ AAAc <