§
    dŠtj—   ã                   óž   — d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlm	Z	  ej
        d¦  «        Z G d„ de¦  «        Zd„ Z	 	 	 	 	 dd„ZdS )é    N)ÚMutableMapping)Úcached_property)Ú	url_to_fszfsspec.mappingc                   óŠ   — e Zd ZdZdd„Zed„ ¦   «         Zd„ Zdd„Zd	„ Z	d
„ Z
d„ Zd„ Zdd„Zdd„Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ ZdS )Ú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'
    FNc                 óJ  — || _         |                     |¦  «        | _        |                     t          j        |d¦  «        ¦  «        d d…         | _        |€t          t          t          f}|| _	        || _
        || _        |r4| j                              |¦  «        s| j                              |¦  «         |ri| j                              |¦  «        st          d|› d�¦  «        ‚| j                              |dz   ¦  «         | j                              |dz   ¦  «         d S d S )NÚxéÿÿÿÿzPath 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         úL/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/fsspec/mapping.pyÚ__init__zFSMap.__init__)   s2  € ØˆŒØ×&Ò& tÑ,Ô,ˆŒ	Ø "× 2Ò 2µ9´>À$ÈÑ3LÔ3LÑ MÔ MÈcÈrÈcÔ RˆÔØÐ%å!Ý!Ý"ð"Ðð
 #5ˆÔØˆŒ
ØˆŒØð 	$Ø”7—>’> $Ñ'Ô'ð $Ø”—’˜dÑ#Ô#Ð#Øð 	$Ø”7—>’> $Ñ'Ô'ð Ý ð9˜Dð 9ð 9ð 9ñô ð ð ŒG�MŠM˜$ ™+Ñ&Ô&Ð&ØŒG�JŠJ�t˜d‘{Ñ#Ô#Ð#Ð#Ð#ð	$ð 	$ó    c                 ó<   — ddl m}  || j        | j        ¬¦  «        S )z@dirfs instance that can be used with the same keys as the mapperé   )ÚDirFileSystem)Úpathr   )Úimplementations.dirfsr"   r   r   )r   r"   s     r   ÚdirfszFSMap.dirfsB   s0   € ð 	9Ð8Ð8Ð8Ð8Ð8àˆ} $Ô"7¸D¼GÐDÑDÔDÐDr   c                 óÖ   — t                                d| j        ¦  «         	 | j                             | j        d¦  «         | j                             | j        ¦  «         dS #  Y dS xY w)z0Remove all keys below root - empties out mappingzClear mapping at %sTN)ÚloggerÚinfor   r   r   r   ©r   s    r   ÚclearzFSMap.clearI   sb   € å�ŠÐ)¨4¬9Ñ5Ô5Ð5ð	ØŒG�JŠJ�t”y $Ñ'Ô'Ð'ØŒG�MŠM˜$œ)Ñ$Ô$Ð$Ð$Ð$øð	ØˆDˆDøøøs   ¢?A# Á#A(Úraisec                 ó`  ‡ ‡‡— ˆ fd„|D ¦   «         }‰dk    r‰nd}	 ‰ j                              ||¬¦  «        Št          ‰t          ¦  «        r
|d         ‰iŠn# ‰ j        $ r}t
          |‚d}~ww xY wˆ fd„‰                     ¦   «         D ¦   «         Šˆˆfd„t          ||¦  «        D ¦   «         S )	a§  Fetch multiple items from the store

        If the backend is async-able, this might proceed concurrently

        Parameters
        ----------
        keys: list(str)
            They keys to be fetched
        on_error : "raise", "omit", "return"
            If raise, an underlying exception will be raised (converted to KeyError
            if the type is in self.missing_exceptions); if omit, keys with exception
            will simply not be included in the output; if "return", all keys are
            included in the output, but the value will be bytes or an exception
            instance.

        Returns
        -------
        dict(key, bytes|exception)
        c                 ó:   •— g | ]}‰                      |¦  «        ‘ŒS © ©Ú_key_to_str©Ú.0Úkr   s     €r   ú
<listcomp>z"FSMap.getitems.<locals>.<listcomp>f   s'   ø€ Ð3Ð3Ð3¨�×!Ò! !Ñ$Ô$Ð3Ð3Ð3r   r+   Úreturn)Úon_errorr   Nc                 ób   •— i | ]+\  }}|t          |‰j        ¦  «        rt          ¦   «         n|“Œ,S r.   )Ú
isinstancer   ÚKeyError©r2   r3   Úvr   s      €r   ú
<dictcomp>z"FSMap.getitems.<locals>.<dictcomp>n   sI   ø€ ð 
ð 
ð 
á��1ð �j¨¨DÔ,CÑDÔDÐK•‘
”
�
È!ð
ð 
ð 
r   c           	      ó¼   •— i | ]X\  }}‰d k    st          ‰|         t          ¦  «        °&|‰dk    r‰|         n"‰                     |t          |¦  «        ¦  «        “ŒYS )r5   r+   )r8   ÚBaseExceptionÚgetr9   )r2   ÚkeyÚk2r6   Úouts      €€r   r<   z"FSMap.getitems.<locals>.<dictcomp>r   sm   ø€ ð 
ð 
ð 
á��RØ˜8Ò#Ð#­:°c¸"´g½}Ñ+MÔ+MÐ#ð ˜H¨Ò/Ð/��R”�°S·W²W¸RÅÈ"ÁÄÑ5NÔ5Nà#Ð#Ð#r   )r   Úcatr8   Úbytesr   r9   ÚitemsÚzip)r   Úkeysr6   Úkeys2ÚoeÚerB   s   ` `   @r   ÚgetitemszFSMap.getitemsR   s  øøø€ ð( 4Ð3Ð3Ð3¨dÐ3Ñ3Ô3ˆØ! WÒ,Ð,ˆXˆX°(ˆð	"Ø”'—+’+˜e¨b�+Ñ1Ô1ˆCÝ˜#�uÑ%Ô%ð &Ø˜Q”x �o�øøØÔ&ð 	"ð 	"ð 	"Ý Ð!øøøøð	"øøøð
ð 
ð 
ð 
àŸ	š	™œð
ñ 
ô 
ˆð
ð 
ð 
ð 
ð 
å˜t UÑ+Ô+ð
ñ 
ô 
ð 	
s   �;A Á
A0Á#A+Á+A0c                 ó|   ‡ — ˆ fd„|                      ¦   «         D ¦   «         }‰ j                             |¦  «         dS )zƒSet the values of multiple items in the store

        Parameters
        ----------
        values_dict: dict(str, bytes)
        c                 ó\   •— i | ](\  }}‰                      |¦  «        t          |¦  «        “Œ)S r.   )r0   Úmaybe_convertr:   s      €r   r<   z"FSMap.setitems.<locals>.<dictcomp>   s5   ø€ ÐXÐXÐX¹D¸A¸q�$×"Ò" 1Ñ%Ô%¥}°QÑ'7Ô'7ÐXÐXÐXr   N)rE   r   Úpipe)r   Úvalues_dictÚvaluess   `  r   ÚsetitemszFSMap.setitemsx   sE   ø€ ð YÐXÐXÐXÀK×DUÒDUÑDWÔDWÐXÑXÔXˆØŒ�Š�VÑÔÐÐÐr   c                 óT   ‡ — ‰ j                              ˆ fd„|D ¦   «         ¦  «         dS )z#Remove multiple keys from the storec                 ó:   •— g | ]}‰                      |¦  «        ‘ŒS r.   r/   r1   s     €r   r4   z"FSMap.delitems.<locals>.<listcomp>„   s'   ø€ Ð6Ð6Ð6¨A�D×$Ò$ QÑ'Ô'Ð6Ð6Ð6r   N)r   r   )r   rG   s   ` r   ÚdelitemszFSMap.delitems‚   s2   ø€ àŒ�
Š
Ð6Ð6Ð6Ð6°Ð6Ñ6Ô6Ñ7Ô7Ð7Ð7Ð7r   c                 ó  — t          |t          ¦  «        sMt          j        dt          ¦  «         t          |t
          ¦  «        rt          |¦  «        }t          |¦  «        }| j        › |› �                     d¦  «        S )zGenerate full path for the keyzAfrom fsspec 2023.5 onward FSMap non-str keys will raise TypeErrorú/)	r8   ÚstrÚwarningsÚwarnÚDeprecationWarningÚlistÚtupler   Úrstrip)r   r@   s     r   r0   zFSMap._key_to_str†   sz   € å˜#�sÑ#Ô#ð 	åŒMØSÝ"ñô ð õ ˜#�tÑ$Ô$ð !Ý˜C‘j”j�Ý�c‘(”(ˆCØÔ'Ð.¨Ð.Ð.×5Ò5°cÑ:Ô:Ð:r   c                 ó`   — |t          | j        ¦  «        d…                              d¦  «        S )zStrip path of to leave key nameNrW   )Úlenr   Úlstrip)r   Úss     r   Ú_str_to_keyzFSMap._str_to_key“   s)   € à•�T”Y‘”Ð!Ð!Ô"×)Ò)¨#Ñ.Ô.Ð.r   c                 ó¾   — |                       |¦  «        }	 | j                             |¦  «        }n+# | j        $ r}|�|cY d}~S t	          |¦  «        |‚d}~ww xY w|S )zRetrieve dataN)r0   r   rC   r   r9   )r   r@   Údefaultr3   ÚresultÚexcs         r   Ú__getitem__zFSMap.__getitem__—   sy   € à×Ò˜SÑ!Ô!ˆð	)Ø”W—[’[ ‘^”^ˆFˆFøØÔ&ð 	)ð 	)ð 	)ØÐ"Ø������Ý˜3‘-”- SÐ(øøøøð	)øøøð ˆs   —2 ²
A¼A¿AÁAÁAc                 ó\   — |                       ||¦  «        }	 | |= n# t          $ r Y nw xY w|S )zPop data)rh   r9   )r   r@   re   rf   s       r   Úpopz	FSMap.pop¢   sJ   € à×!Ò! # wÑ/Ô/ˆð	Ø�S�	�	øÝð 	ð 	ð 	ØˆDð	øøøàˆs   ˜ œ
)¨)c                 óè   — |                       |¦  «        }| j                             | j                             |¦  «        d¬¦  «         | j                             |t          |¦  «        ¦  «         dS )zStore value in keyT)Úexist_okN)r0   r   ÚmkdirsÚ_parentÚ	pipe_filerN   )r   r@   Úvalues      r   Ú__setitem__zFSMap.__setitem__«   sa   € à×Ò˜sÑ#Ô#ˆØŒ�Š�t”w—’ sÑ+Ô+°dˆÑ;Ô;Ð;ØŒ×Ò˜#�}¨UÑ3Ô3Ñ4Ô4Ð4Ð4Ð4r   c                 óZ   ‡ — ˆ fd„‰ j                              ‰ j        ¦  «        D ¦   «         S )Nc              3   óB   •K  — | ]}‰                      |¦  «        V — Œd S ©N)rc   )r2   r	   r   s     €r   ú	<genexpr>z!FSMap.__iter__.<locals>.<genexpr>²   s1   øè è € ÐEÐE¨�× Ò  Ñ#Ô#ÐEÐEÐEÐEÐEÐEr   )r   Úfindr   r)   s   `r   Ú__iter__zFSMap.__iter__±   s-   ø€ ØEÐEÐEÐE¨T¬W¯\ª\¸$¼)Ñ-DÔ-DÐEÑEÔEÐEr   c                 óZ   — t          | j                             | j        ¦  «        ¦  «        S rt   )r`   r   rv   r   r)   s    r   Ú__len__zFSMap.__len__´   s    € Ý�4”7—<’< ¤	Ñ*Ô*Ñ+Ô+Ð+r   c                 ó–   — 	 | j                              |                      |¦  «        ¦  «         dS # t          $ r}t          |‚d}~ww xY w)z
Remove keyN)r   r   r0   Ú	Exceptionr9   )r   r@   rg   s      r   Ú__delitem__zFSMap.__delitem__·   sV   € ð	$ØŒG�JŠJ�t×'Ò'¨Ñ,Ô,Ñ-Ô-Ð-Ð-Ð-øÝð 	$ð 	$ð 	$Ý Ð#øøøøð	$øøøs   ‚-1 ±
A»AÁAc                 ó`   — |                       |¦  «        }| j                             |¦  «        S )zDoes key exist in mapping?)r0   r   Úisfile)r   r@   r#   s      r   Ú__contains__zFSMap.__contains__¾   s)   € à×Ò Ñ$Ô$ˆØŒw�~Š~˜dÑ#Ô#Ð#r   c                 ó<   — t           | j        | j        dd| j        ffS )NF)r   r   r   r   r)   s    r   Ú
__reduce__zFSMap.__reduce__Ã   s   € Ý�t”y $¤'¨5°%¸Ô9PÐQÐQÐQr   )FFN)r+   rt   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r%   r*   rK   rR   rU   r0   rc   rh   rj   rq   rw   ry   r|   r   r�   r.   r   r   r   r      s:  € € € € € ðð ð6$ð $ð $ð $ð2 ðEð Eñ „_ðEðð ð ð$
ð $
ð $
ð $
ðLð ð ð8ð 8ð 8ð;ð ;ð ;ð/ð /ð /ð	ð 	ð 	ð 	ðð ð ð ð5ð 5ð 5ðFð Fð Fð,ð ,ð ,ð$ð $ð $ð$ð $ð $ð
Rð Rð Rð Rð Rr   r   c                 óø   — t          | t          j        ¦  «        st          | d¦  «        rOt          | d¦  «        r#| j        j        dv r|                      d¦  «        } t          t          | ¦  «        ¦  «        } | S )NÚ	__array__ÚdtypeÚMmÚint64)r8   ÚarrayÚhasattrrˆ   ÚkindÚviewrD   Ú
memoryview)rp   s    r   rN   rN   Ç   su   € Ý�%�œÑ%Ô%ð )­°¸Ñ)DÔ)Dð )å�5˜'Ñ"Ô"ð 	( u¤{Ô'7¸4Ð'?Ð'?ð —J’J˜wÑ'Ô'ˆEÝ•j Ñ'Ô'Ñ(Ô(ˆØ€Lr   Ú Fc                 óV   — t          | fi |¤Ž\  }}|�|n|}t          |||||¬¦  «        S )a‡  Create key-value interface for given URL and options

    The URL will be of the form "protocol://location" and point to the root
    of the mapper required. All keys will be file-names below this location,
    and their values the contents of each key.

    Also accepts compound URLs like zip::s3://bucket/file.zip , see ``fsspec.open``.

    Parameters
    ----------
    url: str
        Root URL of mapping
    check: bool
        Whether to attempt to read from the location before instantiation, to
        check that the mapping does exist
    create: bool
        Whether to make the directory corresponding to the root before
        instantiating
    missing_exceptions: None or tuple
        If given, these exception types will be regarded as missing keys and
        return KeyError when trying to read data. By default, you get
        (FileNotFoundError, IsADirectoryError, NotADirectoryError)
    alternate_root: None or str
        In cases of complex URLs, the parser may fail to pick the correct part
        for the mapper root, so this arg can override

    Returns
    -------
    ``FSMap`` instance, the dict-like key-value store.
    N)r   )r   r   )	Úurlr   r   r   Úalternate_rootÚkwargsr   Úurlpathr   s	            r   Ú
get_mapperr–   Ò   sF   € õN ˜CÐ*Ð* 6Ð*Ð*�K€BˆØ+Ð7ˆ>ˆ>¸W€DÝ��r˜5 &Ð=OÐPÑPÔPÐPr   )r�   FFNN)r‹   Úloggingr   rY   Úcollections.abcr   Ú	functoolsr   Úfsspec.corer   Ú	getLoggerr'   r   rN   r–   r.   r   r   ú<module>rœ      sô   ðØ €€€Ø €€€Ø Ð Ð Ð Ø €€€Ø *Ð *Ð *Ð *Ð *Ð *Ø %Ð %Ð %Ð %Ð %Ð %à !Ð !Ð !Ð !Ð !Ð !à	ˆÔ	Ð+Ñ	,Ô	,€ðwRð wRð wRð wRð wRˆNñ wRô wRð wRðtð ð ð 	Ø
ØØØð)Qð )Qð )Qð )Qð )Qð )Qr   