Ë
    òT•jÅ  ã                   ó  — d dl Z d dlZd dlZd dlZd dlZd dlZd„ Zddddœd„Zd„ Z G d„ d	e	«      Z
e j                  d
„ «       Ze j                  dedfd„«       Ze j                  d„ «       Zdd„Ze j                  d„ «       Zd„ Zy)é    Nc                 ó¶   — t        j                  «       5  t        j                  dt        ¬«       t	        j
                  | «      cddd«       S # 1 sw Y   yxY w)z3Import *name* while suppressing DeprecationWarning.Úignore©ÚcategoryN)ÚwarningsÚcatch_warningsÚsimplefilterÚDeprecationWarningÚ	importlibÚimport_module)Únames    ú3/usr/lib/python3.12/test/support/warnings_helper.pyÚimport_deprecatedr   	   sB   € ä	×	 Ñ	 Ó	"ñ -Ü×Ñ˜hÔ1CÕDÜ×&Ñ& tÓ,÷-÷ -ò -ús   •0AÁAÚ é   ©ÚlinenoÚoffsetc                ó  — ddl m} t        j                  d¬«      5 }t        j                  dt
        «       t        |dd«       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 sw Y   �Œ3xY w# 1 sw Y   Œ)xY w)Nr   )Úcheck_syntax_errorT©ÚrecordÚalwaysz
<testcase>Úexecr   Úerrorr   )Útest.supportr   r   r   r	   ÚSyntaxWarningÚcompileÚassertEqualÚlenÚ
assertTrueÚ
issubclassr   ÚassertRegexÚstrÚmessageÚfilenameÚassertIsNotNoner   )ÚtestcaseÚ	statementÚerrtextr   r   r   ÚwarnsÚwarns           r   Úcheck_syntax_warningr-      sA  € õ 0Ü	×	 Ñ	 ¨Ô	-ð 1°Ü×Ñ˜h¬Ô6Ü�	˜<¨Ô0÷1ð ×Ñœ˜U› Q¨Ô.à�E€DØ×Ñœ
 4§=¡=´-Ó@ØŸ™ô'áØ×ÑœS §¡Ó.°Ô8Ø×Ñ˜Ÿ™¨Ô5Ø×Ñ˜TŸ[™[Ô)ØÐØ×Ñ˜TŸ[™[¨&Ô1ô
 
×	 Ñ	 ¨Ô	-ð 9°Ü×Ñ˜g¤}Ô5Ù˜8 Y°Ø"(°õ	9÷9ð
 ×Ñ˜ Õ#÷/1ñ 1ú÷$9ð 9ús   �(E6Ä3(FÅ6F ÆFc                 ó   ‡ — ˆ fd„}|S )z”Decorator 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                  ‰ «      ˆˆ fd„«       }|S )Nc                 óž   •— t        j                  «       5  t        j                  d‰¬«        ‰| g|¢­i |¤Žcd d d «       S # 1 sw Y   y xY w)Nr   r   )r   r   r	   )ÚselfÚargsÚkwargsr   Útests      €€r   Úwrapperz3ignore_warnings.<locals>.decorator.<locals>.wrapper5   sF   ø€ ä×(Ñ(Ó*ñ 3Ü×%Ñ% h¸ÕBÙ˜DÐ2 4Ò2¨6Ñ2÷3÷ 3ò 3ús   –#AÁA)Ú	functoolsÚwraps)r4   r5   r   s   ` €r   Ú	decoratorz"ignore_warnings.<locals>.decorator4   s%   ù€ Ü	�‰˜Ó	ô	3ó 
ð	3ð ˆó    © )r   r8   s   ` r   Úignore_warningsr;   .   s   ø€ ôð Ðr9   c                   ó2   — e Zd ZdZd„ Zd„ Zed„ «       Zd„ Zy)Ú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__zWarningsRecorder.__init__B   s   € Ø&ˆŒØˆ�
r9   c                 óÒ   — t        | j                  «      | j                  kD  rt        | j                  d   |«      S |t        j
                  j                  v ry t        | ›d|›�«      ‚)Néÿÿÿÿz has no attribute )r    r@   rA   Úgetattrr   ÚWarningMessageÚ_WARNING_DETAILSÚAttributeError)r1   Úattrs     r   Ú__getattr__zWarningsRecorder.__getattr__F   sT   € Üˆt�~‰~Ó §¡Ò+Ü˜4Ÿ>™>¨"Ñ-¨tÓ4Ð4Ø”X×,Ñ,×=Ñ=Ñ=ØÜº¹tÐDÓEÐEr9   c                 ó4   — | j                   | j                  d  S ©Nr?   ©r1   s    r   r   zWarningsRecorder.warningsM   s   € à�~‰~˜dŸj™j˜kÐ*Ð*r9   c                 ó8   — t        | j                  «      | _        y rM   )r    r@   rA   rN   s    r   ÚresetzWarningsRecorder.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dt        ff} |€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)ÚgetÚWarningÚ_filterwarnings)Úfiltersr3   rW   s      r   Úcheck_warningsr\   U   s8   € ð �J‰J�wÓ€EÙØœ�=Ð"ˆàˆ=ØˆEÜ˜7 EÓ*Ð*r9   Fc              #   óÜ   K  — ddl m} t        j                  d¬«      5 }t        j                  d||¬«       d–— |r |«        ddd«       | j                  g «       y# 1 sw Y   ŒxY w­w)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   sd   è ø€ õ (Ü	×	 Ñ	 ¨Ô	-ð °Ü×Ñ Ø(/Ø)1õ	3ó 	ÙÙŒL÷ð ×Ñ˜ Õ#÷ð üs   ‚A,Ÿ&A ÁA,Á A)Á%A,c              #   ób   K  — t        | t        d¬«      5  d–— ddd«       y# 1 sw Y   yxY w­w)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+   è ø€ ô 
˜8¬oÈÔ	Mñ Û÷÷ ñ üs   ‚/•#š	/£,¨/c              #   óæ  K  — t        j                  d«      }|j                  j                  d«      }|r|j	                  «        t        j                  d¬«      5 }t         j                  d   j                  d«       t        |«      –— ddd«       t        «      }g }| D ]™  \  }}d}	|dd D ]g  }|j                  }
t        j                  |t        |
«      t        j                  «      sŒ>t!        |
j"                  |«      sŒUd}	|j%                  |«       Œi |	rŒz|rŒ}|j'                  ||j(                  f«       Œ› |rt+        d	|d
   z  «      ‚|rt+        d|d
   z  «      ‚y# 1 sw Y   ŒÛxY w­w)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__Tr   r   r   NFzunhandled warning %sr   z)filter (%r, %s) did not catch any warning)ÚsysÚ	_getframeÚ	f_globalsrX   Úclearr   r   Úmodulesr	   r=   Úlistr%   ÚreÚmatchr$   ÚIr"   Ú	__class__ÚremoveÚappendrQ   ÚAssertionError)r[   rW   ÚframeÚregistryÚwÚreraiseÚmissingÚmsgÚcatÚseenÚwarnings              r   rZ   rZ   ˜   sW  è ø€ ô �M‰M˜!Ó€EØ�‰×"Ñ"Ð#8Ó9€HÙØ�‰ÔÜ	×	 Ñ	 ¨Ô	-ð "°ô 	�‰�JÑ×,Ñ,¨XÔ6Ü˜qÓ!Ò!÷"ô �1‹g€GØ€GØò 0‰ˆˆSØˆØ™�ò 	"ˆAØ—i‘iˆGä—‘˜œc '›l¬B¯D©DÕ1Ü˜7×,Ñ,¨cÕ2Ø�Ø—‘˜qÕ!ð	"ò šEà�N‰N˜C §¡Ð.Õ/ð0ñ ÜÐ3°g¸a±jÑ@ÓAÐAÙÜÐHØ$ Q™Zñ(ó )ð 	)ð ÷/"ð "üs8   ‚AE1Á0E%ÂA!E1Ã-E1ÄE1ÄE1ÄAE1Å%E.Å*E1c               #   ó’   K  — t         j                  d d  } 	 d –— | t         j                  d d  y # | t         j                  d d  w xY w­wrM   )r   r[   )Úold_filterss    r   Úsave_restore_warnings_filtersr€   ¿   s>   è ø€ ä×"Ñ"¡1Ð%€Kð*Ûà)Œ×Ñ™Ñø˜kŒ×Ñ™Ñüs   ‚A—/ ›A¯AÁAc                  ó<   — t        j                  dt        d¬«       y )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)r   r,   r
   r:   r9   r   Ú_warn_about_deprecationrƒ   È   s   € Ü‡M�Mð	*ô 	Øör9   )r   )F)Ú
contextlibr6   r   rn   rh   r   r   r-   r;   Úobjectr=   Úcontextmanagerr\   rY   ra   rd   rZ   r€   rƒ   r:   r9   r   ú<module>r‡      s¶   ðÛ Û Û Û 	Û 
Û ò-ð$Ø#$¨Tô$ò<ô )�vô )ð. ×Ññ+ó ð+ð. ×ÑØ(*°WÀuò $ó ð$ð0 ×Ññó ðó"$)ðN ×Ññ*ó ð*ór9   