/usr/lib/python3.10/test/support/__pycache__
NameSizeModeActions
bytecode_helper.cpython-310.pyc17020644editdlrm
hashlib_helper.cpython-310.pyc18980644editdlrm
import_helper.cpython-310.pyc73180644editdlrm
interpreters.cpython-310.pyc71040644editdlrm
logging_helper.cpython-310.pyc11640644editdlrm
os_helper.cpython-310.pyc141540644editdlrm
script_helper.cpython-310.pyc78040644editdlrm
socket_helper.cpython-310.pyc96280644editdlrm
testresult.cpython-310.pyc67820644editdlrm
threading_helper.cpython-310.pyc63230644editdlrm
warnings_helper.cpython-310.pyc63520644editdlrm
__init__.cpython-310.pyc590400644editdlrm
Edit: /usr/lib/python3.10/test/support/__pycache__/warnings_helper.cpython-310.pyc (6352B)
o 9j@sddlZddlZddlZddlZddlZddddddZddZGd d d eZej d d Z ej de d fddZ ej ddZ dddZej ddZddZdS)NlinenooffsetcCsddlm}tjdd}tdtt|ddWdn1s#wY|t|d||\}| t |j t|j |rJ| t |j|||jd||j|durb||j|tjdd}td t||||||d Wdn1swY||gdS) Nr)check_syntax_errorTrecordalwaysz execrerrorr) test.supportrwarningscatch_warnings simplefilter SyntaxWarningcompile assertEquallen assertTrue issubclasscategory assertRegexstrmessagefilenameassertIsNotNoner)testcase statementerrtextrrrwarnswarnr"3/usr/lib/python3.10/test/support/warnings_helper.pycheck_syntax_warnings.    r$csfdd}|S)zDecorator to suppress warnings. Use of context managers to hide warnings make diffs more noisy and tools like 'git blame' less useful. cstfdd}|S)NcsPttjdd|g|Ri|WdS1s!wYdS)Nignorer)rrr)selfargskwargs)rtestr"r#wrapper-s $z3ignore_warnings..decorator..wrapper) functoolswraps)r*r+r&)r*r# decorator,sz"ignore_warnings..decoratorr")rr.r"r&r#ignore_warnings&s r/c@s4eZdZdZddZddZeddZdd 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)Nz%r has no attribute %r)rr2r3getattrrWarningMessage_WARNING_DETAILSAttributeError)r'attrr"r"r# __getattr__>s  zWarningsRecorder.__getattr__cCs|j|jdSNr1r'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)aContext 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)getWarning_filterwarnings)filtersr)rEr"r"r#check_warningsMs   rJFccsjddlm}tjdd}tjd||ddV|r|Wdn1s(wY||gdS)aContext 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 rKrrfilterwarningsr)rrrforce_gcrKr r"r"r#check_no_warningses rNccs<t|tdd dVWddS1swYdS)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)rNResourceWarning)rr"r"r#check_no_resource_warning~s"rPc cstd}|jd}|r|tjdd}tjddt |VWdn1s0wYt |}g}|D]5\}}d} |ddD]}|j } t |t| t jret| j|red} ||qI| sr|sr|||jfq=|r}td |d |rtd |d dS) 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__Trrr NFzunhandled warning %srz)filter (%r, %s) did not catch any warning)sys _getframe f_globalsrFclearrrmodulesrr0listrrematchrIr __class__removeappendr@AssertionError) rIrEframeregistrywreraisemissingmsgcatseenwarningr"r"r#rHs>      rHc cs<tjdd}z dVW|tjdd<dS|tjdd<wr=)rrI) old_filtersr"r"r#save_restore_warnings_filterss "rjcCstjdtdddS)NzThis 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_deprecations  rm)r)F) contextlibr,rYrSrr$r/objectr0contextmanagerrJrGrNrPrHrjrmr"r"r"r#s(    '