a  ze@sddlZddlZddlZddlZddlZddddddZddZGd d d eZej d d Z ej de d fddZ ej ddZ dddZej ddZddZdS)NlinenooffsetcCs ddlm}tjdd(}tdtt|ddWdn1sF0Y|t|d||\}| t |j t|j |r| t |j|||jd||j|dur||j|tjdd.}td t||||||d Wdn1s0Y||gdS) Nr)check_syntax_errorTrecordalwaysz execrerrorr) test.supportrwarningscatch_warnings simplefilter SyntaxWarningcompile assertEquallenZ assertTrue issubclasscategoryZ assertRegexstrmessagefilenameZassertIsNotNoner)testcaseZ statementZerrtextrrrwarnswarnrP/opt/bitninja-python-dojo/embedded/lib/python3.9/test/support/warnings_helper.pycheck_syntax_warnings*  *  &rcsfdd}|S)Ncstfdd}|S)NcsPt4tjdd|g|Ri|WdS1sB0YdS)Nignorer)rrr)selfargskwargs)rtestrrwrapper-s z3ignore_warnings..decorator..wrapper) functoolswraps)r%r&r!)r%r decorator,sz"ignore_warnings..decoratorr)rr)rr!rignore_warnings&s r*c@s0eZdZddZddZeddZddZd S) WarningsRecordercCs||_d|_dS)Nr _warnings_last)r"Z warnings_listrrr__init__:szWarningsRecorder.__init__cCsDt|j|jkr t|jd|S|tjjvr0dStd||fdS)Nz%r has no attribute %r)rr-r.getattrrWarningMessage_WARNING_DETAILSAttributeError)r"attrrrr __getattr__>s  zWarningsRecorder.__getattr__cCs|j|jdSNr,r"rrrrEszWarningsRecorder.warningscCst|j|_dSr7)rr-r.r8rrrresetIszWarningsRecorder.resetN)__name__ __module__ __qualname__r/r6propertyrr9rrrrr+6s  r+cOs.|d}|s$dtff}|dur$d}t||S)NquietrT)getWarning_filterwarnings)filtersr$r>rrrcheck_warningsMs   rCFccshddlm}tjdd0}tjd||ddV|r:|Wdn1sN0Y||gdS)Nr) gc_collectTrr )rr)r rDrrfilterwarningsr)rrrforce_gcrDrrrrcheck_no_warningses $rGccs8t|tdddVWdn1s*0YdS)NT)rrF)rGResourceWarning)rrrrcheck_no_resource_warning~srIc cstd}|jd}|r"|tjdd*}tjddt |VWdn1s^0Yt |}g}|D]j\}}d} |ddD]8}|j } t |t| t jrt| j|rd} ||q| sx|sx|||jfqx|rtd|d |rtd |d dS) NZ__warningregistry__Trrr Fzunhandled warning %srz)filter (%r, %s) did not catch any warning)sys _getframe f_globalsr?clearrrmodulesrr+listrrematchrIr __class__removeappendr:AssertionError) rBr>frameregistrywZreraisemissingmsgcatseenwarningrrrrAs4  (   rAc cs<tjdd}zdVW|tjdd<n|tjdd<0dSr7)rrB)Z old_filtersrrrsave_restore_warnings_filterssr`cCstjdtdddS)NzThis is used in test_support test to ensure support.ignore_deprecations_from() works as expected. You should not be seeing this.r) stacklevel)rrDeprecationWarningrrrr_warn_about_deprecations rc)r)F) contextlibr'rQrKrrr*objectr+contextmanagerrCr@rGrIrAr`rcrrrrs&    '