o
    iJ                     @   s   d dl mZmZ d dlmZ d dlmZ ddlmZ ddl	m
Z
mZmZ ede
d	d
dedddddfdedee fddZdededeeef fddZdS )    )OptionalTuple)RegistryError)msg   )registry   )ArgOptappzfind-function.z Name of the registered function.)helpNz
--registryz-rzName of the catalogue registry.	func_nameregistry_namec                 C   s^   |st  }|D ]}t || r|} nq|s"tjd|  ddd |dus(J t| | dS )a   
    Find the module, path and line number to the file the registered
    function is defined in, if available.

    func_name (str): Name of the registered function.
    registry_name (Optional[str]): Name of the catalogue registry.

    DOCS: https://spacy.io/api/cli#find-function
    $Couldn't find registered function: ''r   exitsN)r   get_registry_nameshasr   failfind_function)r   r   registry_namesname r   K/home/ubuntu/.local/lib/python3.10/site-packages/spacy/cli/find_function.pyfind_function_cli
   s   
r   returnc              
   C   s   d }zt || }W n& ty0 } ztd|  d| d tj| dd W Y d }~nd }~ww |d us7J d }d }|d rG|d }|d }|rK|sYtjd|  d| ddd |d us_J |d useJ td	|  d
| d|  t|t|fS )Nr   z' in registry 'r   r   r   fileline_noz,Couldn't find path to registered function: 'zFound registered function 'z' at :)r   findr   r   r   goodstrint)r   r   registry_desceregistry_pathr   r   r   r   r   +   s2   r   )typingr   r   	cataloguer   wasabir   utilr   _utilr	   r
   r   commandr"   r   r#   r   r   r   r   r   <module>   s    
" 