o
    QDij                     @  s   d dl mZ d dlm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
lmZ ejddejejejejejejejejejejejfdddZdS )    )annotations)ListN)Console   )Resource)system   )commonhelpers)consoleindex)namesource	List[str]r   strtypepathdatabasefastboolfallbackqsvdebugtrusted	standardsc                 C  s   t  }|	r|	t_|
r|
t_tj| |d} | s'|s'd}tj||d tjdd|	d z't
t| |||d}g }| }|D ]}|tj|||||||d q@W n tym } ztj|||d	 tjddd
}~ww |	d |dt| d d
S )zIndex a tabular data resource)r   z(Providing "source" or "path" is required)note   )codez[bold]Index)r   r   r   datatype)resourcer   r   use_fallbackqsv_pathr   )r   	exceptionNz[bold]ResultzSuccesefully indexed [bold]z
[/] tables)r   r   r   r   r
   create_sourceprint_errortyperExitruler   listextendindex_resource	Exceptionprint_exceptionprintlen)r   r   r   r   r   r   r   r   r   r   r   r   r   r   names	resourcesr"    r1   \/var/www/Datamplify/venv/lib/python3.10/site-packages/frictionless/console/commands/index.pyconsole_index   sP   

r3   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )
__future__r   typingr   r%   rich.consoler   r   r   r    r	   r
   r   commandr   resource_namer   r   required_databaser   r   r   r   r   r   r3   r1   r1   r1   r2   <module>   s*    
