o
    QDi                     @  st   d dl mZ d dlZ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 dd	lmZ G d
d deZdS )    )annotationsN)AnyOptional   )helpers)FrictionlessException)Package)Resource)Adapterc                   @  s$   e Zd ZdddddZd	d
 ZdS )LocalAdapterNbasepathsourcer   r   Optional[str]c                C  s   || _ || _d S )N)r   r   )selfr   r    r   [/var/www/Datamplify/venv/lib/python3.10/site-packages/frictionless/schemes/local/adapter.py__init__   s   
zLocalAdapter.__init__c                 C  s   t | jtr(tj| j| jd}t|r(d}tj	||}tj
|r(t|S t| jrJt| jd}tj| j| jdD ]
}|t|d q=|S d}t|)Nr   zdatapackage.json)pathzCannot read package)
isinstancer   strr   join_basepathr   is_directory_sourceosr   joinisfiler   from_descriptoris_expandable_sourceexpand_sourceadd_resourcer	   r   )r   
normsourcenamer   packagenoter   r   r   read_package   s   

zLocalAdapter.read_package)r   r   r   r   )__name__
__module____qualname__r   r$   r   r   r   r   r      s    r   )
__future__r   r   typingr   r    r   	exceptionr   r"   r   resourcer	   systemr
   r   r   r   r   r   <module>   s    