
    8jK                         d dl Z d dlmZ d dl mZ d dlZd dlZd Zd Zed             Zd Z	 G d d	          Z
 G d
 de          ZdS )    N)entry_points)cachec                  V    t           j                            dd          } | dk    rdS dS )z7Determine if dispatching has been disabled by the user.SKIMAGE_NO_DISPATCHINGF1T)osenvironget)no_dispatchings    Y/var/www/html/Carbon-Document/venv/lib/python3.11/site-packages/skimage/util/_backends.pydispatching_disabledr      s-    Z^^$<eDDNtu    c                    | j         dg}fd|D             }t          |          dk    r`                    d          }t          |          dk    rd| j         d}t          |          d                    |dd                   }n2t          |          d	k    r	|d         }n| d
|}t          |          |S )zGet the name of the public module for a scikit-image function.

    This computes the name of the public submodule in which the function can
    be found.
    zskimage.filters.rankc                 >    g | ]}                     |          |S  )
startswith).0name	full_names     r   
<listcomp>z%public_api_module.<locals>.<listcomp>   s,    PPP4Y5I5I$5O5OP$PPPr   r   .   zexpected func.__module__=z% with more than 2 dot-delimited partsN   z& matches more than one sub-submodule: )
__module__lensplit
ValueErrorjoin)funcsub_submodules
candidatespartsmsgpublic_namer   s         @r   public_api_moduler%      s     I --NPPPP>PPPJ
:!$$u::??UdoUUUCS//!hhuRaRy))	ZA		 mMMzMMoo r   c                      i } t          d          }t          d          }|D ]V}d|i| |j        <   	 ||j                 } |                                            | |j                 d<   G# t          $ r Y Sw xY w| S )z7List all installed backends and information about them.skimage_backends)groupskimage_backend_infosimplementationinfo)r   r   loadKeyError)backends	backends_backend_infosbackendr+   s        r   all_backendsr2   6   s     H#5666I '>???M  "2G!<	 .D-8TYY[[]]HW\"6** 	 	 	D	 Os   7A,,
A98A9c                       j         t                     t                      st                      s S t	          j                    fd            }|S )zMark a function as dispatchable.

    When a decorated function is called, the installed backends are
    searched for an implementation. If no backend implements the function
    then the scikit-image implementation is used.
    c            
         t          t                                D ]}t                      |         } d	 |d         j        vr+|d                                         } |j         d	 g| R i |}|s^|                     d	           }t          j        d d	 d| dt          d            || i |c S  | i |S )	N:r+   r*   z	Call to 'z' was dispatched to the 'z8' backend. Set SKIMAGE_NO_DISPATCHING=1 to disable this.r   )
stacklevel)	sortedr2   supported_functionsr,   can_hasget_implementationwarningswarnDispatchNotification)
argskwargsr   r1   backend_implwants_it	func_implr   func_module	func_names
          r   wrapperzdispatchable.<locals>.wrapperY   s_    <>>**  	)  	)D"nnT*G ++	++76?3VVV"#3499;;L ,|+,,,,/3  7= H  $77;8T8T8T8TUUIM!K ! !) ! !! ! ! %
 
 
 
 
 9d-f----- 4((((r   )__name__r%   r   r2   	functoolswraps)r   rE   rC   rD   s   ` @@r   dispatchablerI   I   s{     I#D))K
  \^^ _T%) %) %) %) %) %) %)N Nr   c                       e Zd ZdZd ZdS )BackendInformationzInformation about a backend

    A backend that wants to provide additional information about itself
    should return an instance of this from its information entry point.
    c                     || _         d S )N)r8   )selfr8   s     r   __init__zBackendInformation.__init__   s    #6   r   N)rF   r   __qualname____doc__rN   r   r   r   rK   rK      s-         7 7 7 7 7r   rK   c                       e Zd ZdZdS )r=   z?Notification issued when a function is dispatched to a backend.N)rF   r   rO   rP   r   r   r   r=   r=      s        IIDr   r=   )rG   importlib.metadatar   r   r   r;   r   r%   r2   rI   rK   RuntimeWarningr=   r   r   r   <module>rT      s        + + + + + +       				   " " "J   $8 8 8v7 7 7 7 7 7 7 7	 	 	 	 	> 	 	 	 	 	r   