Ë
    ÿ[;j¼1  ã                   óp  — d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl	m
Z
 dd	lmZ g d
¢Zdai Zi Zi Zg d¢dgdgdœZed„ «       Zd„ Z e«       5   e«        ddd«       d„ Zd„ Z e
ddd¬«      d„ «       Zd„ Zd„ Z e«       5   e«        ddd«        e
ddd¬«      d d„«       Z e«       5   e«       Zddd«        e
ddd¬«      d„ «       Z e
ddd¬«      d!d„«       Zd„ Z e«       d„ «       Z e
ddd¬«      d„ «       Z  e
ddd¬«      d„ «       Z!y# 1 sw Y   Œ¼xY w# 1 sw Y   Œ”xY w# 1 sw Y   ŒwxY w)"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               #   ó    K  — t        j                  «       5  t        j                  ddt        d¬«       d–— ddd«       y# 1 sw Y   yxY w­w)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© ó    úbG:\00. PROJECTS\API\Inventory\templateJSON\kerjaOCR\Lib\site-packages\skimage/io/manage_plugins.pyÚ!_hide_plugin_deprecation_warningsr%   9   s>   è ø€ ô 
×	 Ñ	 Õ	"Ü×ÑØØFÜ"Øõ		
ó 	÷ 
#×	"Ñ	"üs   ‚A—"A¹	AÁAÁAc                  ó   — g g g g g g dœa y)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                  óª   — g d¢} | D ]  }t        |t        d   «       Œ d„ t        j                  «       D «       }|D ]  }t        |t        |   «       Œ y )N)r(   r   r)   r   r'   r   c              3   ó,   K  — | ]  }|d k7  sŒ	|–— Œ y­w)r   Nr"   )Ú.0Úps     r$   Ú	<genexpr>z*_load_preferred_plugins.<locals>.<genexpr>]   s   è ø€ ÐFÑ7˜!¸1À»:”AÑ7ùs   ‚
�)Ú_set_pluginÚpreferred_pluginsÚkeys)Úio_typesÚp_typeÚplugin_typess      r$   Ú_load_preferred_pluginsr9   W   sR   € âW€HÛˆÜ�FÔ-¨eÑ4Õ5ð ñ GÔ0×5Ñ5Ô7ÓF€LÛˆÜ�FÔ-¨fÑ5Õ6ñ r#   c                 óv   — |D ]  }|t         vrŒ	 t        || ¬«        y  y # t        t        t        f$ r Y Œ4w xY w)N)Úkind)r   r
   ÚImportErrorÚRuntimeErrorÚOSError)Úplugin_typeÚplugin_listÚplugins      r$   r3   r3   b   sE   € ÛˆØÔ+Ñ+Øð	Ü�v KÕ0Ùñ øô œ\¬7Ð3ò 	Ùð	ús   �!¡8·8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                  ój   — t        «       5  t        «        t        «        d d d «       y # 1 sw Y   y xY w©N)r%   r-   r9   r"   r#   r$   r   r   m   s"   € ô 
+Õ	,ÜÔÜÔ!÷ 
-×	,Ñ	,ús   ‹)©2c                 óÀ   — t        «       }|j                  | «       |j                  «       d   }i }|j                  |«      D ]  }|j	                  ||«      ||<   Œ ||fS )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_filerQ   y   s^   € ä‹^€FØ
‡K�K�ÔØ�?‰?Ó˜QÑ€Dà€IØ�~‰~˜dÖ#ˆØŸ™ D¨#Ó.ˆ	�#Šð $ð �ˆ?Ðr#   c            	      óš  — t         j                  j                  t        «      } t	        t         j                  j                  | dd«      «      }|D ]ï  }t        |«      \  }}d|vrt        j                  d|› d�«       Œ/|t        |<   |d   j                  d«      D �cg c]  }|j                  «       ‘Œ }}|D �cg c]  }|t        v sŒ|‘Œ }}|D ]  }|t        vsŒt        d|› d|› d	�«       Œ d
|vxr d|v }	|	r|j                  d
«       |t        |<   t         j                  j!                  |«      dd t"        |<   Œñ yc c}w c c}w )z]Scan 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   ÚjoinrQ   r   ÚwarnÚplugin_meta_dataÚsplitÚstripr,   ÚprintÚappendÚplugin_providesÚbasenameÚplugin_module_name)
ÚpdÚconfig_filesrL   rN   rO   ÚsrT   r1   Úvalid_providesÚneed_to_add_collections
             r$   Ú_scan_pluginsrj   †   sL  € ô 
�‰�‰œÓ	"€BÜœŸ™Ÿ™ R¨°WÓ=Ó>€Lã ˆÜ,¨XÓ6‰ˆˆiØ˜YÑ&Ü�M‰MØ˜�zÐ!WÐXôð Ø!*Ô˜ÑØ'0°Ñ'<×'BÑ'BÀ3Ô'GÓHÑ'G !�A—G‘G•IÐ'GˆÐHÙ%-ÓC¡X °´lÒ1Bš! XˆÐCãˆAØœÒ$Ü˜  Ð&GÈÀsÈ,ÐWÕXð ð   ~Ð5ÒT¸(ÀnÐ:Tð 	ñ "Ø×!Ñ!Ð"5Ô6à .Œ˜Ñä#%§7¡7×#3Ñ#3°HÓ#=¸c¸rÐ#BÔ˜4Ò ñ1 !ùò IùÚCs   ÂEÂ;EÃ	Ec                 ó  — t        «       }t        j                  «       D ]  }|D ]  \  }}|j                  |«       Œ Œ i }t        D ]5  }| r||v sŒ
t        |   D �cg c]  }|j                  d«      rŒ|‘Œ c}||<   Œ7 |S c c}w )a1  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Úaddrb   Ú
startswith)ÚloadedÚactive_pluginsÚplugin_funcrA   ÚfuncÚdÚfs          r$   r   r   ¬   s�   € ô, “U€NÜ#×*Ñ*Ö,ˆÛ'‰LˆF�DØ×Ñ˜vÕ&ñ (ð -ð 	€Aß!ˆÙ˜ >Ò1Ü$3°FÒ$;ÓUÑ$;˜qÀ1Ç<Á<ÐPSÕCTšÐ$;ÑUˆAˆfŠIð "ð €Hùò Vs   ÁBÁ3Bc                 óh  — | t         vrt        d| › d�«      ‚t         |    }t        |«      dk(  rd| › d�}t        |«      ‚|j	                  dd«      }|€	|d   \  }}n*t        |«       	 |D ��	cg c]  \  }}	||k(  sŒ|	‘Œ c}	}d   } ||i |¤ŽS c c}	}w # t        $ r t        d|› d	| › d
�«      ‚w xY w)a’  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.rA   NzCould not find the plugin "z" for Ú.)r,   Ú
ValueErrorÚlenr=   ÚpopÚ_loadÚ
IndexError)
r;   ÚargsÚkwargsÚplugin_funcsÚmsgrA   rl   rt   r1   rv   s
             r$   r   r   Ó   sò   € ð( ”<ÑÜÐ-¨d¨V°<Ð@ÓAÐAä Ñ%€LÜ
ˆ<Ó˜AÒà0°°ð 7&ð &ð 	ô ˜3ÓÐà�Z‰Z˜ $Ó'€FØ€~Ø˜q‘/‰ˆ‰4äˆfŒð	TÙ$0Ô@¡L™&˜1˜a°A¸³K’A LÒ@ÀÑCˆDñ �Ð ˜Ñ Ð ùó	 AøÜò 	TÜÐ!<¸V¸HÀFÈ4È&ÐPQÐRÓSÐSð	Tús$   Á)B Á.BÁ<BÂ B ÂB ÂB1c                 óŠ  — |€t         j                  «       }n*|t        |    vrt        d| › d|› d�«      ‚|dk(  r|dg}n|g}t	        | «       |D ]f  }|t         vrt        d|› d�«      ‚t         |   }|D ��cg c]  \  }}|| k(  sŒ||f‘Œ c}}|D ��cg c]  \  }}|| k7  sŒ||f‘Œ c}}z   }|t         |<   Œh yc c}}w c c}}w )	an  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')  # doctest: +SKIP

    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,   r5   rb   r=   r|   )rN   r;   ÚkÚfuncsÚnrv   s         r$   r
   r
     sò   € ð> €|Ü× Ñ Ó"‰à” tÑ,Ñ,Ü ¨¨Ð.AÀ$ÀÀrÐJÓKÐKà�8ÒØ˜+Ð&‰Dà�6ˆDä	ˆ$„KãˆØ”LÑ Ü  1 #Ð%FÐGÓHÐHä˜Q‘ˆñ ',Ô9¡e™F˜Q ¨q°D«y�!�Q’ eÒ9Ù!&ô=
Ù!&‘v˜˜1¨!¨t«)ˆQ�ŠF ò=
ñ 
ˆð  Œ�QŠñ ùó :ùó =
s   Á7B9ÂB9ÂB?
Â!B?
c                 ó€   — t        | d«      s2t        | d«      r%t        | d«      }t        |«      }t        | d|«       yyy)z9Add `imread_collection` to module if not already present.r)   r'   N)ÚhasattrÚgetattrr	   Úsetattr)r   r'   rt   s      r$   Ú#_inject_imread_collection_if_neededrŒ   <  sB   € ä�6Ð.Ô/´G¸FÀHÔ4MÜ˜ Ó*ˆÜ(¨Ó0ˆÜ�Ð+¨TÕ2ð 5NÐ/r#   c                 ób  — | t        d¬«      v ry| t        vrt        d| › d�«      ‚t        |    }t        d|z   |g¬«      }t        |    }|D ]a  }|dk(  rt        |«       nt        ||«      st        d| › d	|› d
�«       Œ3t        |   }t        ||«      }| |f|vsŒO|j                  | |f«       Œc y)z¯Load the given plugin.

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

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

    T)rq   Nrƒ   z not found.zskimage.io._plugins.)Úfromlistr)   z does not provide z as advertised.  Ignoring.)r   rd   ry   Ú
__import__rb   rŒ   r‰   r`   r,   rŠ   ra   )rA   ÚmodnameÚplugin_modulerT   r1   Ústorert   s          r$   r|   r|   D  sÌ   € ð Ô'¨tÔ4Ñ4ØØÔ'Ñ'Ü˜7 6 (¨+Ð6Ó7Ð7ä$ VÑ,ˆÜ"Ð#9¸GÑ#CÈwÈiÔXˆä˜vÑ&€HÛˆØÐ#Ò#Ü/°Õ>Ü˜¨Ô*Ü�G˜F˜8Ð#5°a°SÐ8RÐSÔTØä˜Q‘ˆÜ�} aÓ(ˆØ�Dˆ> Ò&Ø�L‰L˜& $˜Õ(ñ r#   c                 óN   — 	 t         |    S # t        $ r t        d| › d�«      ‚w xY w)z¿Return 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]   ÚKeyErrorry   )rA   s    r$   r   r   h  s9   € ð(AÜ Ñ'Ð'øÜò AÜÐ5°f°X¸QÐ?Ó@Ð@ðAús   ‚ ‹$c                  ój   — i } t         D ]!  }t         |   D ��cg c]  \  }}|‘Œ	 c}}| |<   Œ# | S c c}}w )z×Return 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   rt   Úplugin_namerv   s       r$   r   r   ‚  sB   € ð  	€AßˆÜ7CÀDÒ7IÔJÑ7IÑ#3 K°’;Ð7IÒJˆˆ$Šð à€Hùó Ks   ˜/)FrF   )"Ú__doc__Úos.pathrW   r   Úconfigparserr   r   Ú
contextlibr   Ú_shared.utilsr   Ú
collectionr	   Ú__all__r,   rb   rd   r]   r4   r%   r-   r9   r3   r   rQ   rj   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)Ä,D5