o
    im	                  
   @   s   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
mZ dd	 Zed
krMze  W dS  e
yL Z zeee W Y dZ[dS dZ[ww dS )a  
Utility for locating the module (or package's __init__.py)
associated with a given console_script name
and verifying it contains the PYTHON_ARGCOMPLETE_OK marker.

Such scripts are automatically generated and cannot contain
the marker themselves, so we defer to the containing module or package.

For more information on setuptools console_scripts, see
https://setuptools.readthedocs.io/en/latest/setuptools.html#automatic-script-creation

Intended to be invoked by argcomplete's global completion function.
    N)
EntryPoint)entry_points)Iterable   )ArgcompleteMarkerNotFoundfindc                     s  t jd } tj|  t }t jdk r|d } fdd|D }|s&td|d }|j	dd\}}t
| }| }W d    n1 sFw   Y  d	|||vrWtd
d||vrbtd
t
t|dd}|d}W d    n1 szw   Y  d|vrtdd S )Nr   )      console_scriptsc                    s$   g | ]}|j  kr|jd kr|qS )r
   )namegroup).0epr    g/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/argcomplete/_check_console_script.py
<listcomp>'   s   $ zmain.<locals>.<listcomp>z$no entry point found matching scriptr   :zfrom {} import {}z&does not appear to be a console scriptzsys.exit({}())T)return_packagei   PYTHON_ARGCOMPLETE_OKzmarker not found)sysargvospathbasenameimportlib_entry_pointsversion_infor   valuesplitopenreadformatr   )script_pathr   entry_pointmodule_namefunction_namefscriptheadr   r   r   main   s.   



r)   __main__)__doc__r   r   importlib.metadatar   r   r   typingr   _check_moduler   r   r)   __name__eexitstrr   r   r   r   <module>   s     %