
    9i0                     n   S r SSKrSSKrSSKJr  SSKJr  SSKJr  SSK	J
r
  SS	KJr  / S
QrSq0 r0 r0 r/ SQS/S/S.r\S 5       rS r\" 5          \" 5         SSS5        S rS r\
" SSSS9S 5       rS rS r\" 5          \" 5         SSS5        \
" SSSS9S S j5       r\" 5          \" 5       rSSS5        \
" SSSS9S 5       r\
" SSSS9S!S j5       rS r\" 5       S 5       r\
" SSSS9S 5       r \
" SSSS9S 5       r!g! , (       d  f       N= f! , (       d  f       N= f! , (       d  f       N{= f)"aK  Handle image reading, writing and plotting plugins.

To improve performance, plugins are only loaded as needed. As a result, there
can be multiple states for a given plugin:

    available: Defined in an *ini file located in ``skimage.io._plugins``.
        See also :func:`skimage.io.available_plugins`.
    partial definition: Specified in an *ini file, but not defined in the
        corresponding plugin module. This will raise an error when loaded.
    available but not on this system: Defined in ``skimage.io._plugins``, but
        a dependent library (e.g. Qt, PIL) is not available on your system.
        This will raise an error when loaded.
    loaded: The real availability is determined when it's explicitly loaded,
        either because it's one of the default plugins, or because it's
        loaded explicitly by the user.

    N)ConfigParser)glob)contextmanager   )deprecate_func   )imread_collection_wrapper)
use_plugincall_pluginplugin_infoplugin_orderreset_pluginsfind_available_plugins_available_plugins)imageiopil
matplotlibr   )allimshowimshow_collectionc               #      #    [         R                  " 5          [         R                  " SS[        SS9  Sv   SSS5        g! , (       d  f       g= f7f)z=Ignore warnings related to plugin infrastructure deprecation.ignorez0.*use `imageio` or other I/O packages directly.*skimage)actionmessagecategorymoduleN)warningscatch_warningsfilterwarningsFutureWarning     Y/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/skimage/io/manage_plugins.py!_hide_plugin_deprecation_warningsr%   9   s=      
	 	 	"F"		
 	 
#	"	"s   A A	A
AAc                      / / / / / / S.q g)zHClear the plugin state to the default, i.e., where no plugins are loaded)imreadimsaver   imread_collectionr   	_app_showNplugin_storer"   r#   r$   _clear_pluginsr-   F   s     Lr#   c                      / SQn U  H  n[        U[        S   5        M     S [        R                  5        5       nU H  n[        U[        U   5        M     g )N)r(   r   r)   r   r'   r   c              3   4   #    U  H  oS :w  d  M
  Uv   M     g7f)r   Nr"   ).0ps     r$   	<genexpr>*_load_preferred_plugins.<locals>.<genexpr>]   s     F7!:AA7s   		)_set_pluginpreferred_pluginskeys)io_typesp_typeplugin_typess      r$   _load_preferred_pluginsr:   W   sR    WHF-e45  G0557FLF-f56 r#   c                 z    U H  nU[         ;  a  M   [        X S9    g    g ! [        [        [        4 a     M6  f = f)N)kind)r   r
   ImportErrorRuntimeErrorOSError)plugin_typeplugin_listplugins      r$   r4   r4   b   sC    ++	v0  \73 		s   	!::z0.25z0.27zoThe plugin infrastructure of `skimage.io` is deprecated. Instead, use `imageio` or other I/O packages directly.)deprecated_versionremoved_versionhintc                  t    [        5          [        5         [        5         S S S 5        g ! , (       d  f       g = fN)r%   r-   r:   r"   r#   r$   r   r   m   s"     
+	,! 
-	,	,s   )
7c                     [        5       nUR                  U 5        UR                  5       S   n0 nUR                  U5       H  nUR	                  X$5      X4'   M     X#4$ )z>Return plugin name and meta-data dict from plugin config file.r   )r   readsectionsoptionsget)filenameparsername	meta_dataopts        r$   _parse_config_filerR   y   sX    ^F
KK??QDI~~d#D.	 $ ?r#   c            	         [         R                  R                  [        5      n [	        [         R                  R                  U SS5      5      nU GH  n[        U5      u  p4SU;  a  [        R                  " SU S35        M3  U[        U'   US   R                  S5       Vs/ s H  oUR                  5       PM     nnU Vs/ s H  ow[        ;   d  M  UPM     nnU H!  nU[        ;  d  M  [        SU SU S	35        M#     S
U;  =(       a    SU;   n	U	(       a  UR                  S
5        U[        U'   [         R                  R!                  U5      SS ["        U'   GM     gs  snf s  snf )zUScan the plugins directory for .ini files and parse them
to gather plugin meta-data.
_pluginsz*.iniprovideszfile z6 not recognized as a scikit-image io plugin, skipping.,zPlugin `z!` wants to provide non-existent `z`. Ignoring.r)   r'   N)ospathdirname__file__r   joinrR   r   warnplugin_meta_datasplitstripr,   printappendplugin_providesbasenameplugin_module_name)
pdconfig_filesrM   rO   rP   srU   r1   valid_providesneed_to_add_collections
             r$   _scan_pluginsrk      sF    
	"BRW=>L ,X6Y&MMz!WX !*'0'<'B'B3'GH'G!GGI'GH%-CXl1B!XCA$&Gs,WX   ~5T(n:T 	 "!!"56 .#%77#3#3H#=cr#B4 1 ! ICs   "E"E'E'c                 2   [        5       n[        R                  5        H  nU H  u  p4UR                  U5        M     M!     0 n[         HD  nU (       a  X1;   d  M  [        U    Vs/ s H  ofR                  S5      (       a  M  UPM     snXS'   MF     U$ s  snf )a  List available plugins.

Parameters
----------
loaded : bool
    If True, show only those plugins currently loaded.  By default,
    all plugins are shown.

Returns
-------
p : dict
    Dictionary with plugin names as keys and exposed functions as
    values.

_)setr,   valuesaddrc   
startswith)loadedactive_pluginsplugin_funcrB   funcdfs          r$   r   r      s    , UN#**,'LFv& ( - 	A!1$3F$;U$;q<<PSCT$;UAI " H Vs   &BBc                 v   U [         ;  a  [        SU  S35      e[         U    n[        U5      S:X  a  SU  S3n[        U5      eUR	                  SS5      nUc  US   u  pgO-[        U5         U VV	s/ s H  u  pX:X  d  M  U	PM     sn	nS   nU" U0 UD6$ s  sn	nf ! [         a    [        SU S	U  S
35      ef = f)aj  Find the appropriate plugin of 'kind' and execute it.

Parameters
----------
kind : {'imshow', 'imsave', 'imread', 'imread_collection'}
    Function to look up.
plugin : str, optional
    Plugin to load.  Defaults to None, in which case the first
    matching plugin is used.
*args, **kwargs : arguments and keyword arguments
    Passed to the plugin function.

zInvalid function (z) requested.r   z"No suitable plugin registered for z.

You may load I/O plugins with the `skimage.io.use_plugin` command.  A list of all available plugins are shown in the `skimage.io` docstring.rB   NzCould not find the plugin "z" for .)r,   
ValueErrorlenr>   pop_load
IndexError)
r<   argskwargsplugin_funcsmsgrB   rm   ru   r1   rw   s
             r$   r   r      s    ( <-dV<@AA%L
<A0 7& & 	 3ZZ$'F~q/4f	T$0@L&1AKAL@CD    	 A 	T!<VHF4&PQRSS	Ts$   ,B 1B BB B B8c                    Uc  [         R                  5       nO-U[        U    ;  a  [        SU  SU S35      eUS:X  a  US/nOU/n[	        U 5        U Hm  nU[         ;  a  [        SU S35      e[         U   nU VVs/ s H  u  pEX@:X  d  M  XE4PM     snnU VVs/ s H  u  pEX@:w  d  M  XE4PM     snn-   nU[         U'   Mo     gs  snnf s  snnf )	a  Set the default plugin for a specified operation.  The plugin
will be loaded if it hasn't been already.

Parameters
----------
name : str
    Name of plugin. See ``skimage.io.available_plugins`` for a list of available
    plugins.
kind : {'imsave', 'imread', 'imshow', 'imread_collection', 'imshow_collection'}, optional
    Set the plugin for this function.  By default,
    the plugin is set for all functions.

Examples
--------
To use Matplotlib as the default image reader, you would write:

>>> from skimage import io
>>> io.use_plugin('matplotlib', 'imread')

To see a list of available plugins run ``skimage.io.available_plugins``. Note
that this lists plugins that are defined, but the full list may not be usable
if your system does not have the required libraries installed.

NPlugin z does not support `z`.r   r*   'z!' is not a known plugin function.)r,   r6   rc   r>   r}   )rO   r<   kfuncsnrw   s         r$   r
   r
     s    > |  "t,,.A$rJKK8+&D6D	$KL 1#%FGHHQ ',9eFQqy!e9!&=
!&v!)FQF=
 
  Q  : =
s   =CCC
*C
c                     [        U S5      (       d7  [        U S5      (       a%  [        U S5      n[        U5      n[        U SU5        ggg)z9Add `imread_collection` to module if not already present.r)   r'   N)hasattrgetattrr	   setattr)r   r'   ru   s      r$   #_inject_imread_collection_if_neededr   <  sH    6.//GFH4M4M*(0+T2 5N/r#   c                 n   U [        SS9;   a  gU [        ;  a  [        SU  S35      e[        U    n[        SU-   U/S9n[        U    nU Hh  nUS:X  a  [        U5        O$[        X$5      (       d  [        SU  S	U S
35        M9  [        U   n[        X$5      nX4U;  d  MV  UR                  X45        Mj     g)zLoad the given plugin.

Parameters
----------
plugin : str
    Name of plugin to load.

See Also
--------
plugins : List of available plugins

T)rr   Nr   z not found.zskimage.io._plugins.)fromlistr)   z does not provide z as advertised.  Ignoring.)r   re   rz   
__import__rc   r   r   ra   r,   r   rb   )rB   modnameplugin_modulerU   r1   storeru   s          r$   r}   r}   D  s     't44''76(+677$V,"#9G#CwiXv&H##/>**GF8#5aS8RSTQ}(>&LL&( r#   c                 P     [         U    $ ! [         a    [        SU  S35      ef = f)zReturn plugin meta-data.

Parameters
----------
plugin : str
    Name of plugin.

Returns
-------
m : dict
    Meta data as specified in plugin ``.ini``.

zNo information on plugin "")r^   KeyErrorrz   )rB   s    r$   r   r   h  s9    (A'' A5fXQ?@@As    %c                  p    0 n [          H#  n[         U    VVs/ s H  u  p#UPM	     snnX'   M%     U $ s  snnf )zReturn the currently preferred plugin order.

Returns
-------
p : dict
    Dictionary of preferred plugin order, with function name as key and
    plugins (in order of preference) as value.

r+   )r1   ru   plugin_namerw   s       r$   r   r     s>      	A7CD7IJ7I#3K;7IJ H Ks   2)FrG   )"__doc__os.pathrX   r   configparserr   r   
contextlibr   _shared.utilsr   
collectionr	   __all__r,   rc   re   r^   r5   r%   r-   r:   r4   r   rR   rk   r   r   r   r
   r   r}   r   r   r"   r#   r$   <module>r      s  $   %  % * 1   
 ,n&	  	 	
 '( )7 
=""
CD '(O ) 
=: '(/1 ) 
=%!%!P 
=2 2 j3 #$ ) % )F 
=AA( 
=k	 )(j )(N )(s$   DD)D&
D
D#&
D4