o
    QD©i¾  ã                   @  s|   d dl mZ d dlZd dlmZmZmZ ddlmZ ddlm	Z	 ddl
mZ dd	lmZ er4dd
lmZ G dd„ de	ƒZdS )é    )ÚannotationsN)ÚTYPE_CHECKINGÚAnyÚOptionalé   )ÚDetector)ÚPluginé   ©ÚInlineControl)ÚInlineParser)ÚResourcec                   @  s0   e Zd ZdZddd„Zddd„Zdddd„ZdS )ÚInlinePluginzPlugin for InlineÚresourcer   c                 C  s   |j dkr	t|ƒS d S ©NÚinline)Úformatr   )Úselfr   © r   ú[/var/www/Datamplify/venv/lib/python3.10/site-packages/frictionless/formats/inline/plugin.pyÚcreate_parser   s   
ÿzInlinePlugin.create_parserc                 C  sª   |j d urIt|j dƒsEttjtjf}t|j ƒst|j |ƒr+|jp!d|_|j	p'd|_	d S t|j t
ƒrG|jp5d|_|j	pAt |j ¡pAd|_	d S d S d S |jdkrSg |_ d S d S )NÚreadr   ÚtableÚjson)ÚdataÚhasattrÚlistÚtypingÚIteratorÚ	GeneratorÚcallableÚ
isinstancer   ÚdatatypeÚdictr   Údetect_metadata_type)r   r   Útypesr   r   r   Údetect_resource   s$   

ÿýù

ÿzInlinePlugin.detect_resourceNÚtypeúOptional[str]c                 C  s   |dkrt S d S r   r
   )r   r'   r   r   r   Úselect_control_class*   s   ÿz!InlinePlugin.select_control_class)r   r   )N)r'   r(   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r&   r)   r   r   r   r   r      s
    

r   )Ú
__future__r   r   r   r   r   Údetectorr   Úsystemr   Úcontrolr   Úparserr   r   r   r   r   r   r   r   Ú<module>   s    