mapping.cpython-312.pyc•12.2 kB
�
lMga � � � d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlm Z ej d� Z G d� de� Zd� Z
d
d �Zy)� N)�MutableMapping)�cached_property)� url_to_fszfsspec.mappingc � � e Zd ZdZdd�Zed� � Zd� Zdd�Zd� Z d� Z
d � Zd
� Zdd�Z
dd�Zd
� Zd� Zd� Zd� Zd� Zd� Zy)�FSMapa� Wrap a FileSystem instance as a mutable wrapping.
The keys of the mapping become files under the given root, and the
values (which must be bytes) the contents of those files.
Parameters
----------
root: string
prefix for all the files
fs: FileSystem instance
check: bool (=True)
performs a touch at the location, to check for write access.
Examples
--------
>>> fs = FileSystem(**parameters) # doctest: +SKIP
>>> d = FSMap('my-data/path/', fs) # doctest: +SKIP
or, more likely
>>> d = fs.get_mapper('my-data/path/')
>>> d['loc1'] = b'Hello World' # doctest: +SKIP
>>> list(d.keys()) # doctest: +SKIP
['loc1']
>>> d['loc1'] # doctest: +SKIP
b'Hello World'
Nc �* � || _ |j |� | _ |j t j |d� � d d | _ |�t t t f}|| _ || _
|| _ |r6| j j |� s| j j |� |rg| j j |� st d|� d�� �| j j |dz � | j j! |dz � y y )N�x�����zPath z9 does not exist. Create with the ``create=True`` keywordz/a)�fs�_strip_protocol�root� posixpath�join�_root_key_to_str�FileNotFoundError�IsADirectoryError�NotADirectoryError�missing_exceptions�check�create�exists�mkdir�
ValueError�touch�rm)�selfr
r r r r s �ZC:\Users\noahv\Documents\GitHub\clickup-operator\.venv\Lib\site-packages\fsspec/mapping.py�__init__zFSMap.__init__) s� � �����&�&�t�,�� � "� 2� 2�9�>�>�$��3L� M�c�r� R����%�!�!�"�"��
#5�����
������7�7�>�>�$�'����
�
�d�#���7�7�>�>�$�'� ��D�6� "8� 9�� �
�G�G�M�M�$��+�&��G�G�J�J�t�d�{�#� � c �J � ddl m} || j | j �� S )z@dirfs instance that can be used with the same keys as the mapper� )�
DirFileSystem)�pathr )�implementations.dirfsr"