Ë
    îì�if  ã                   óœ   — d dl mZ d dlZd dlZd dlZd dlZd dlZg d¢Z ej                  ej                  d¬«      Z	ed„ «       Z
ed„ «       Zy)é    )ÚcontextmanagerN)Úall_warningsÚexpected_warningsÚwarné   )Ú
stacklevelc               #   óÄ  K  — ddl } | j                  «       }|r(| j                  |«      D ]  }i |d   j                  d<   Œ ~t	        t
        j                  j                  «       «      D ]   \  }}	 |j                  j                  «        Œ" t        j                  d¬«      5 }t        j                  d«       |–— ddd«       y# t        $ r Y Œgw xY w# 1 sw Y   yxY w­w)a&  
    Context for use in testing to ensure that all warnings are raised.

    Examples
    --------
    >>> import warnings
    >>> def foo():
    ...     warnings.warn(RuntimeWarning("bar"), stacklevel=2)

    We raise the warning once, while the warning filter is set to "once".
    Hereafter, the warning is invisible, even with custom filters:

    >>> with warnings.catch_warnings():
    ...     warnings.simplefilter('once')
    ...     foo()                         # doctest: +SKIP

    We can now run ``foo()`` without a warning being raised:

    >>> from numpy.testing import assert_warns
    >>> foo()                             # doctest: +SKIP

    To catch the warning, we call in the help of ``all_warnings``:

    >>> with all_warnings():
    ...     assert_warns(RuntimeWarning, foo)
    r   NÚ__warningregistry__T)ÚrecordÚalways)ÚinspectÚcurrentframeÚgetouterframesÚf_localsÚlistÚsysÚmodulesÚitemsr
   ÚclearÚAttributeErrorÚwarningsÚcatch_warningsÚsimplefilter)r   ÚframeÚfÚmod_nameÚmodÚws         ú~/var/www/ITT-ServiceAPI-Services/ITT-Document-Scan/mrzscanner/mrzenv/lib/python3.12/site-packages/skimage/_shared/_warnings.pyr   r      sÜ   è ø€ ó< ð × Ñ Ó"€EÙØ×'Ñ'¨Ó.ò 	6ˆAØ35ˆAˆa‰D�M‰MÐ/Ò0ð	6àäœcŸk™k×/Ñ/Ó1Ó2ò ‰ˆ�#ð	Ø×#Ñ#×)Ñ)Õ+ðô 
×	 Ñ	 ¨Ô	-ð °Ü×Ñ˜hÔ'ØŠ÷ð øô ò 	Ùð	ú÷ð üsB   ‚A-C Á0CÂ
C Â"CÂ<	C Ã	CÃC ÃCÃC ÃCÃC c           	   #   ó0  K  — t        | t        «      rt        d«      ‚| €d–— yt        j                  j                  dd«      }|j                  «       dk(  rd}n*|j                  «       dk(  rd}nt        t        |«      «      }t        «       5 }|–— d| v r| j                  d«       d| v rŒ| D �cg c]  }d	|j                  d
«      vsŒ|‘Œ }}|D ]s  }d}| D ]D  }t        j                  |t        |j                  «      «      €Œ-d}||v sŒ4|j                  |«       ŒF |sŒQ|rŒTt        dt        |j                  «      › �«      ‚ |r1t        |«      dkD  r#d}d|› |j!                  |«      › �}	t        |	«      ‚ddd«       yc c}w # 1 sw Y   yxY w­w)a‹  Context for use in testing to catch known warnings matching regexes

    Parameters
    ----------
    matching : None or a list of strings or compiled regexes
        Regexes for the desired warning to catch
        If matching is None, this behaves as a no-op.

    Examples
    --------
    >>> import numpy as np
    >>> rng = np.random.default_rng()
    >>> image = rng.integers(0, 2**16, size=(100, 100), dtype=np.uint16)
    >>> # rank filters are slow when bit-depth exceeds 10 bits
    >>> from skimage import filters
    >>> with expected_warnings(['Bad rank filter performance']):
    ...     median_filtered = filters.rank.median(image)

    Notes
    -----
    Uses `all_warnings` to ensure all warnings are raised.
    Upon exiting, it checks the recorded warnings for the desired matching
    pattern(s).
    Raises a ValueError if any match was not found or an unexpected
    warning was raised.
    Allows for three types of behaviors: `and`, `or`, and `optional` matches.
    This is done to accommodate different build environments or loop conditions
    that may produce different warnings.  The behaviors can be combined.
    If you pass multiple patterns, you get an orderless `and`, where all of the
    warnings must be raised.
    If you use the `|` operator in a pattern, you can catch one of several
    warnings.
    Finally, you can use `|\A\Z` in a pattern to signify it as optional.

    zA``matching`` should be a list of strings and not a string itself.NÚSKIMAGE_TEST_STRICT_WARNINGSÚ1ÚtrueTÚfalseFz\A\Zú|zUnexpected warning: r   ú
zNo warning raised matching:)Ú
isinstanceÚstrÚ
ValueErrorÚosÚenvironÚgetÚlowerÚboolÚintr   ÚremoveÚsplitÚreÚsearchÚmessageÚlenÚjoin)
ÚmatchingÚstrict_warningsr   ÚmÚ	remainingr   ÚfoundÚmatchÚnewlineÚmsgs
             r   r   r   J   s§  è ø€ ôJ �(œCÔ ÜØOó
ð 	
ð
 ÐØŠ
Øä—j‘j—n‘nÐ%CÀSÓI€OØ×ÑÓ &Ò(Ø‰Ø	×	Ñ	Ó	  GÒ	+Ø‰äœs ?Ó3Ó4ˆä	‹ð "˜1àŠð �hÑØ�O‰O˜DÔ!ð �hÒà (ÖH˜1¨G¸1¿7¹7À3»<Ò,G’QÐHˆ	ÐHØò 	MˆDØˆEØ!ò 0�Ü—9‘9˜U¤C¨¯©Ó$5Ó6ÑBØ �EØ 	Ò)Ø!×(Ñ(¨Õ/ð	0ò
 ¢uÜ Ð#7¼¸D¿L¹LÓ8IÐ7JÐ!KÓLÐLð	Mñ ¤ I£°Ò 2ØˆGØ/°¨y¸¿¹ÀiÓ9PÐ8QÐRˆCÜ˜S“/Ð!÷)"ð "ùò I÷"ð "üsU   ‚BFÂF
Â.F
Â2FÃFÃ7F
ÄF
ÄF
Ä$F
Ä'AF
Å<	FÆF
Æ
FÆF)Ú
contextlibr   r   r   r2   Ú	functoolsr*   Ú__all__Úpartialr   r   r   © ó    r   ú<module>rE      sa   ðÝ %Û 
Û Û 	Û Û 	â
7€ð
 €y×Ñ˜Ÿ™°1Ô5€ð ñ6ó ð6ðr ñJ"ó ñJ"rD   