�
lMg / � �2 � d dl mZ d dlmZ G d� de� Zy)� )�
filesystem)�AsyncFileSystemc � � � e Zd ZdZdZ dC� fd� Zd� Zd� Zed� � Z d� Z
d� Zd � Zd
� Z
d� Zd� Zd
� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z d� Z!d� Z"d � Z#d!� Z$d"� Z%d#� Z&d$� Z'd%� Z(d&� Z)d'� Z*d(� Z+d)� Z,dDd*�Z-dDd+�Z.d,� Z/d-� Z0d.� Z1d/� Z2d0� Z3d1� Z4d2� Z5d3� Z6d4� Z7d5� Z8d6� Z9d7� Z:d8� Z;d9� Z<d:� Z=d;� Z>d<� Z?d=� Z@d>� ZAd?� ZBd@� ZCdA� ZDdB� ZE� xZFS )E�
DirFileSystemz�Directory prefix filesystem
The DirFileSystem is a filesystem-wrapper. It assumes every path it is dealing with
is relative to the `path`. After performing the necessary paths operation it
delegates everything to the wrapped filesystem.
�dirc �b �� t �| � di |�� |�t dd|i|xs i ��}|du|duz du rt d� �|xs |}| j r|j
st d� �|j
r$| j |j k7 rt d� �|j
|� | _ || _ y)aS
Parameters
----------
path: str
Path to the directory.
fs: AbstractFileSystem
An instantiated filesystem to wrap.
target_protocol, target_options:
if fs is none, construct it from these
fo: str
Alternate for path; do not provide both
N�protocolFzProvide path or fo, not bothz(can't use asynchronous with non-async fsz7both dirfs and fs should be in the same sync/async mode� ) �super�__init__r �
ValueError�asynchronous�
async_impl�_strip_protocol�path�fs)�selfr r �fo�target_protocol�target_options�storage_options� __class__s ��hC:\Users\noahv\Documents\GitHub\clickup-operator\.venv\Lib\site-packages\fsspec/implementations/dirfs.pyr zDirFileSystem.__init__ s� �� �* ���+�?�+�
�:��O�_�O��9M�2�O�B�����4��0�E�9��;�<�<��z�r�����R�]�]��G�H�H�
�=�=�T�.�.�"�/�/�A��V�W�W��&�&�t�,�� ���� c � � t |t � r\| j s|S |s| j S | j j j | j | j
|� f� S t |t � r3|j � D ��ci c] \ }}| j |� |�� c}}S |D �cg c] }| j |� �� c}S c c}}w c c}w �N)
�
isinstance�strr r �sep�joinr �dict�items�_join)r r �_path�values r r# zDirFileSystem._join4 s� � ��d�C� ��9�9�����y�y� ��7�7�;�;�#�#�T�Y�Y��0D�0D�T�0J�$K�L�L��d�D�!�AE����N�����D�J�J�u�%�u�,��N�N�/3�4�t�e��
�
�5�!�t�4�4�� O��4s �C�4Cc �b � t |t � r�| j s|S || j k( sA| j j | j j
� r|| j dd k( ry| j | j j
z }| j j | j j
� r*|j | j j
� s|dd }|j |� sJ �|t
|� d S |D �cg c] }| j |� �� c}S c c}w )N� � )r r r �
startswithr r �len�_relpath)r r �prefixr$ s r r+ zDirFileSystem._relpath? s� � ��d�C� ��9�9��� �t�y�y� �� � �$�$�T�W�W�[�[�1�d�d�i�i���m�6K���Y�Y������,�F��y�y�#�#�D�G�G�K�K�0���������9U�������?�?�6�*�*�*���F��
�&�&�26�7�$���
�
�e�$�$�7�7��7s �D,c �. � | j j S r )r r �r s r r zDirFileSystem.sepR s � ��w�w�{�{�r c � �V K � | j j |i |��� d { ��� S 7 ��wr )r �set_session)r �args�kwargss r r0 zDirFileSystem.set_sessionV s( � �� �(�T�W�W�(�(�$�9�&�9�9�9�9�s � )�'�)c � �v K � | j j | j |� fi |��� d { ��� S 7 ��wr )r �_rm_filer# �r r r2 s r r4 zDirFileSystem._rm_fileY s1 � �� �%�T�W�W�%�%�d�j�j��&6�A�&�A�A�A�A�� �09�7�9c �Z � | j j | j |� fi |��S r )r �rm_filer# r5 s r r8 zDirFileSystem.rm_file\ s% � ��t�w�w���t�z�z�$�/�:�6�:�:r c � �| K � | j j | j |� g|��i |��� d { ��� S 7 ��wr )r �_rmr# �r r r1 r2 s r r: zDirFileSystem._rm_ s4 � �� � �T�W�W�[�[����D�!1�C�D�C�F�C�C�C�C�� �3<�:�<c �` � | j j | j |� g|��i |��S r )r �rmr# r; s r r>