o
    QDi                     @  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 dd	lmZ d
dlmZmZ d
dlmZ ejdddejejejejejejejfdddZdS )    )annotations)ListN)Console   )FrictionlessException)platform)Resource)system   )commonhelpers)console	transformT)namehiddensource	List[str]pathstrpipelinestepsdebugbooltrusted	standardsc              
   C  s  t  }|r|t_|r|t_tj| |d} | s'|s'd}tj||d tjddtj	||d}	zt
| |d}
t|
tjjsGd|
j d}t||
|	}W n tyg } ztj|||d	 tjddd
}~ww | }|j }td t| td t| d
S )zTransform data using a provided pipeline.

    Please read more about Transform pipelines to write a pipeline
    that can be accepted by this function.
    )r   z(Providing "source" or "path" is required)note   )code)
descriptorr   zResource with data type "z" is not transformable)r   	exceptionNz
## Schema
z

## Table
)r   r	   r   r   r   create_sourceprint_errortyperExitcreate_pipeliner   
isinstancer   frictionless_resourcesTransformabledatatyper   r   	Exceptionprint_exceptionto_petlschema
to_summarysecho)r   r   r   r   r   r   r   r   r   pipeline_objresourceresultr   tabler,    r3   `/var/www/Datamplify/venv/lib/python3.10/site-packages/frictionless/console/commands/transform.pyconsole_transform   s>   



r5   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   )
__future__r   typingr   r"   rich.consoler   r   r   r   r0   r   r	    r   r   r   commandr   r   r   r   r   r   r   r5   r3   r3   r3   r4   <module>   s&    