ó
    Eñif  ã                   ó–   • S SK Jr  S SKrS SKrS SKrS SKrS SKr/ SQr\R                  " \R                  SS9r	\S 5       r
\S 5       rg)é    )ÚcontextmanagerN)Úall_warningsÚexpected_warningsÚwarné   )Ú
stacklevelc               #   óà  #   • SSK n U R                  5       nU(       a*  U R                  U5       H  n0 US   R                  S'   M     A[	        [
        R                  R                  5       5       H   u  p4 UR                  R                  5         M"     [        R                  " SS9 n[        R                  " S5        Uv •  SSS5        g! [         a     Mi  f = f! , (       d  f       g= f7f)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         ÚV/home/mande/repo/quber/.venv/lib/python3.13/site-packages/skimage/_shared/_warnings.pyr   r      sÆ   é € ó< ð × Ñ Ó"€EÞØ×'Ñ'¨Ö.ˆAØ35ˆAˆa‰D�M‰MÐ/Ó0ñ /àäœcŸk™k×/Ñ/Ó1Ö2‰ˆð	Ø×#Ñ#×)Ñ)Ö+ñ 3ô 
×	 Ò	 ¨Ò	-°Ü×Ò˜hÔ'ØŠ÷ 
.Ð	-øô ó 	Úð	ú÷ 
.Õ	-üsB   ‚A3C.Á6CÂC.Â(CÃ	C.Ã
CÃC.ÃCÃC.Ã
C+Ã'C.c           	   #   ó”  #   • [        U [        5      (       a  [        S5      eU c  Sv •  g[        R                  R                  SS5      nUR                  5       S:X  a  SnO+UR                  5       S:X  a  SnO[        [        U5      5      n[        5        nUv •  SU ;   a  U R                  S5        SU ;   a  M  U  Vs/ s H  nS	UR                  S
5      ;  d  M  UPM     nnU H†  nSnU  HJ  n[        R                  " U[        UR                  5      5      c  M0  SnXt;   d  M9  UR                  U5        ML     U(       d  M^  U(       a  Mg  [        S[        UR                  5       35      e   U(       a2  [        U5      S:”  a#  SnSU UR!                  U5       3n	[        U	5      eSSS5        gs  snf ! , (       d  f       g= f7f)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ÛˆDØˆEÛ!�Ü—9’9˜U¤C¨¯©Ó$5Ó6ÓBØ �EØÕ)Ø!×(Ñ(¨Ö/ñ	 "÷
 ˆ§u uÜ Ð#7¼¸D¿L¹LÓ8IÐ7JÐ!KÓLÐLñ ö ¤ I£°Ó 2ØˆGØ/°¨y¸¿¹ÀiÓ9PÐ8QÐRˆCÜ˜S“/Ð!÷) 
ˆùò I÷ 
�üsU   ‚BGÂ"F7Â;F7Â?F2ÃF2Ã"7F7ÄF7Ä&F7ÅF7ÅAF7Æ)	GÆ2F7Æ7
GÇG)Ú
contextlibr   r   r   r2   Ú	functoolsr*   Ú__all__Úpartialr   r   r   © ó    r   Ú<module>rE      s_   ðÝ %Û 
Û Û 	Û Û 	â
7€ð
 ×Ò˜Ÿ™°1Ñ5€ð ñ6ó ð6ðr ñJ"ó ñJ"rD   