§
    dŠtjÁ'  ã                   ó  — d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZmZ d dl	m
Z
mZmZmZ d dlmZ d dlmZ  ej        d¦  «        Z G d„ de¦  «        Zd	d
d
efd„Zd„ Zedk    rd dlZ eej        dd…         ¦  «         dS dS )é    N)ÚEIOÚENOENT)ÚFUSEÚFuseOSErrorÚLoggingMixInÚ
Operations)Ú__version__)Ú	url_to_fsúfsspec.fusec                   ód   — e Zd Zdd„Zdd„Zd„ Zd„ Zd„ Zd„ Zd	„ Z	dd
„Z
d„ Zdd„Zd„ Zd„ Zd„ ZdS )ÚFUSErFc                 ó®   — || _         i | _        |                     d¦  «        dz   | _        d| _        t
                               d|¦  «         || _        d S )Nú/r   zStarting FUSE at %s)ÚfsÚcacheÚrstripÚrootÚcounterÚloggerÚinfoÚ_ready_file)Úselfr   ÚpathÚ
ready_files       úI/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/fsspec/fuse.pyÚ__init__zFUSEr.__init__   sR   € ØˆŒØˆŒ
Ø—K’K Ñ$Ô$ sÑ*ˆŒ	ØˆŒÝ�ŠÐ)¨4Ñ0Ô0Ð0Ø%ˆÔÐÐó    Nc                 óX  — t                                d|¦  «         | j        r	|dv rdddœS d                     | j        |                     d¦  «        g¦  «                             d¦  «        }	 | j                             |¦  «        }n'# t          $ r}t          t          ¦  «        |‚d }~ww xY w|                     dd	¦  «        |                     d
d	¦  «        dœ}|                     dd¦  «        }|d         dk    rt          j        |z  |d<   d|d<   d|d<   n't          j        |z  |d<   |d         |d<   d|d<   d|d<   d|v r|d         nt!          j        ¦   «         |d<   d|v r|d         nt!          j        ¦   «         |d<   d|v r|d         nt!          j        ¦   «         |d<   |S )Nz
getattr %s©z/.fuse_readyz.fuse_readyÚfileé   )ÚtypeÚst_sizeÚ r   Úuidiè  Úgid)Úst_uidÚst_gidÚmodeiÿ  r"   Úst_moder   r#   Ú
st_blksizeÚsizei  P é   Úst_nlinkÚatimeÚst_atimeÚctimeÚst_ctimeÚmtimeÚst_mtime)r   Údebugr   Újoinr   Úlstripr   r   r   ÚFileNotFoundErrorr   r   ÚgetÚstatÚS_IFDIRÚS_IFREGÚtime)r   r   Úfhr   ÚexcÚdataÚperms          r   ÚgetattrzFUSEr.getattr   s¾  € Ý�Š�\ 4Ñ(Ô(Ð(ØÔð 	2 Ð(GÐ GÐ GØ"¨qÐ1Ð1Ð1à�wŠw˜œ	 4§;¢;¨sÑ#3Ô#3Ð4Ñ5Ô5×<Ò<¸SÑAÔAˆð	/Ø”7—<’< Ñ%Ô%ˆDˆDøÝ ð 	/ð 	/ð 	/Ý�fÑ%Ô%¨3Ð.øøøøð	/øøøð Ÿ(š( 5¨$Ñ/Ô/¸4¿8º8ÀEÈ4Ñ;PÔ;PÐQÐQˆØ�xŠx˜ Ñ&Ô&ˆà�Œ<˜6Ò!Ð!Ý"œl¨TÑ1ˆD�‰OØˆD�‰OØ!"ˆD�ÑÐå"œl¨TÑ1ˆD�‰OØ" 6œlˆD�‰OØ!*ˆD�ÑØ ˆD�ÑØ,3°t¨O¨O˜4 œ=˜=ÅÄÁÄˆˆZÑØ,3°t¨O¨O˜4 œ=˜=ÅÄÁÄˆˆZÑØ,3°t¨O¨O˜4 œ=˜=ÅÄÁÄˆˆZÑØˆs   Á/B
 Â

B.ÂB)Â)B.c                 óò   — t                                d|¦  «         d                     | j        |                     d¦  «        g¦  «        }| j                             |d¦  «        }d„ |D ¦   «         }ddg|z   S )Nz
readdir %sr$   r   Fc                 ór   — g | ]4}t           j                             |                     d ¦  «        ¦  «        ‘Œ5S )r   )Úosr   Úbasenamer   )Ú.0Úfs     r   ú
<listcomp>z!FUSEr.readdir.<locals>.<listcomp>:   s2   € Ð@Ð@Ð@°Q•”×!Ò! !§(¢(¨3¡-¤-Ñ0Ô0Ð@Ð@Ð@r   ú.z..)r   r5   r6   r   r7   r   Úls)r   r   r>   Úfiless       r   ÚreaddirzFUSEr.readdir6   sq   € Ý�Š�\ 4Ñ(Ô(Ð(Ø�wŠw˜œ	 4§;¢;¨sÑ#3Ô#3Ð4Ñ5Ô5ˆØ”—
’
˜4 Ñ'Ô'ˆØ@Ð@¸%Ð@Ñ@Ô@ˆØ�Tˆ{˜UÑ"Ð"r   c                 ó˜   — d                      | j        |                     d¦  «        g¦  «        }| j                             |¦  «         dS ©Nr$   r   r   )r6   r   r7   r   Úmkdir©r   r   r)   s      r   rP   zFUSEr.mkdir=   ó?   € Ø�wŠw˜œ	 4§;¢;¨sÑ#3Ô#3Ð4Ñ5Ô5ˆØŒ�Š�dÑÔÐØˆqr   c                 ó˜   — d                      | j        |                     d¦  «        g¦  «        }| j                             |¦  «         dS rO   )r6   r   r7   r   Úrmdir)r   r   s     r   rT   zFUSEr.rmdirB   rR   r   c                 óÊ   — t                                d|||f¦  «         | j        r|dv rdS | j        |         }|                     |¦  «         |                     |¦  «        }|S )Nzread %sr   s   ready)r   r5   r   r   ÚseekÚread)r   r   r,   Úoffsetr>   rH   Úouts          r   rW   z
FUSEr.readG   sf   € Ý�Š�Y  t¨VÐ 4Ñ5Ô5Ð5ØÔð 	 Ð(GÐ GÐ Gà�8àŒJ�rŒNˆØ	�Šˆv‰ŒˆØ�fŠf�T‰lŒlˆØˆ
r   c                 óÈ   — t                                d||f¦  «         | j        |         }|                     |¦  «         |                     |¦  «         t          |¦  «        S )Nzwrite %s)r   r5   r   rV   ÚwriteÚlen)r   r   r@   rX   r>   rH   s         r   r[   zFUSEr.writeR   sO   € Ý�Š�Z $¨ Ñ0Ô0Ð0ØŒJ�rŒNˆØ	�Šˆv‰ŒˆØ	�Š�‰ŒˆÝ�4‰yŒyÐr   c                 óV  — t                                d||f¦  «         d                     | j        |                     d¦  «        g¦  «        }| j                             |¦  «         | j                             |d¦  «        }|| j        | j	        <   | xj	        dz  c_	        | j	        dz
  S )Nz	create %sr$   r   Úwbr-   )
r   r5   r6   r   r7   r   ÚtouchÚopenr   r   )r   r   ÚflagsÚfiÚfnrH   s         r   ÚcreatezFUSEr.createY   s’   € Ý�Š�[ 4¨ -Ñ0Ô0Ð0Ø�WŠW�d”i §¢¨SÑ!1Ô!1Ð2Ñ3Ô3ˆØŒ�Š�bÑÔÐØŒG�LŠL˜˜TÑ"Ô"ˆØ#$ˆŒ
�4”<Ñ ØˆŒ˜ÑˆŒØŒ|˜aÑÐr   c                 ó:  — t                                d||f¦  «         d                     | j        |                     d¦  «        g¦  «        }|dz  dk    rd}nd}| j                             ||¦  «        | j        | j        <   | xj        dz  c_        | j        dz
  S )	Nzopen %sr$   r   é   r   Úrbr^   r-   )	r   r5   r6   r   r7   r   r`   r   r   )r   r   ra   rc   r)   s        r   r`   z
FUSEr.openb   s”   € Ý�Š�Y  u Ñ.Ô.Ð.Ø�WŠW�d”i §¢¨SÑ!1Ô!1Ð2Ñ3Ô3ˆØ�1‰9˜Š>ˆ>àˆDˆDð ˆDØ#'¤7§<¢<°°DÑ#9Ô#9ˆŒ
�4”<Ñ ØˆŒ˜ÑˆŒØŒ|˜aÑÐr   c                 ó²   — d                      | j        |                     d¦  «        g¦  «        }|dk    rt          ‚| j                             |¦  «         d S rO   )r6   r   r7   ÚNotImplementedErrorr   r_   )r   r   Úlengthr>   rc   s        r   ÚtruncatezFUSEr.truncateo   sO   € Ø�WŠW�d”i §¢¨SÑ!1Ô!1Ð2Ñ3Ô3ˆØ�QŠ;ˆ;Ý%Ð%àŒ�Š�bÑÔÐÐÐr   c                 óø   — d                      | j        |                     d¦  «        g¦  «        }	 | j                             |d¦  «         d S # t
          t          f$ r}t          t          ¦  «        |‚d }~ww xY w)Nr$   r   F)	r6   r   r7   r   ÚrmÚOSErrorr8   r   r   )r   r   rc   r?   s       r   ÚunlinkzFUSEr.unlinkv   s|   € Ø�WŠW�d”i §¢¨SÑ!1Ô!1Ð2Ñ3Ô3ˆð	,ØŒG�JŠJ�r˜5Ñ!Ô!Ð!Ð!Ð!øÝÕ*Ð+ð 	,ð 	,ð 	,Ý�cÑ"Ô"¨Ð+øøøøð	,øøøs   ±A ÁA9ÁA4Á4A9c                 óÞ   — 	 || j         v r;| j         |         }|                     ¦   «          | j                              |¦  «         n&# t          $ r}t	          |¦  «         Y d }~nd }~ww xY wdS )Nr   )r   ÚcloseÚpopÚ	ExceptionÚprint)r   r   r>   rH   Úes        r   ÚreleasezFUSEr.release}   sz   € ð	Ø�T”ZÐÐØ”J˜r”N�Ø—’‘	”	�	Ø”
—’˜rÑ"Ô"Ð"øøÝð 	ð 	ð 	Ý�!‰HŒHˆHˆHˆHˆHˆHˆHøøøøð	øøøàˆqs   ‚AA Á
A*ÁA%Á%A*c                 óÎ   — t          | j        d¦  «        rJd                     | j        |                     d¦  «        g¦  «        }| j                             ||¦  «        S t          ‚)NÚchmodr$   r   )Úhasattrr   r6   r   r7   rx   ri   rQ   s      r   rx   zFUSEr.chmod‡   sV   € Ý�4”7˜GÑ$Ô$ð 	-Ø—7’7˜DœI t§{¢{°3Ñ'7Ô'7Ð8Ñ9Ô9ˆDØ”7—=’=  tÑ,Ô,Ð,Ý!Ð!r   )F)N)Ú__name__Ú
__module__Ú__qualname__r   rB   rM   rP   rT   rW   r[   rd   r`   rk   ro   rv   rx   © r   r   r   r      së   € € € € € ð&ð &ð &ð &ðð ð ð ð8#ð #ð #ðð ð ð
ð ð ð
	ð 	ð 	ðð ð ð ð  ð  ð  ð ð  ð  ðð ð ð ð,ð ,ð ,ðð ð ð"ð "ð "ð "ð "r   r   TFc                 óÊ   ‡ ‡‡‡‡‡‡— ˆˆ ˆˆˆˆˆfd„}‰s2t          j        |¬¦  «        }d|_        |                     ¦   «          |S 	  |¦   «          dS # t          $ r Y dS w xY w)am  Mount stuff in a local directory

    This uses fusepy to make it appear as if a given path on an fsspec
    instance is in fact resident within the local file-system.

    This requires that fusepy by installed, and that FUSE be available on
    the system (typically requiring a package to be installed with
    apt, yum, brew, etc.).

    Parameters
    ----------
    fs: file-system instance
        From one of the compatible implementations
    path: str
        Location on that file-system to regard as the root directory to
        mount. Note that you typically should include the terminating "/"
        character.
    mount_point: str
        An empty directory on the local file-system where the contents of
        the remote path will appear.
    foreground: bool
        Whether or not calling this function will block. Operation will
        typically be more stable if True.
    threads: bool
        Whether or not to create threads when responding to file operations
        within the mounter directory. Operation will typically be more
        stable if False.
    ready_file: bool
        Whether the FUSE process is ready. The ``.fuse_ready`` file will
        exist in the ``mount_point`` directory if True. Debugging purpose.
    ops_class: FUSEr or Subclass of FUSEr
        To override the default behavior of FUSEr. For Example, logging
        to file.

    c                  óD   •— t           ‰‰‰‰¬¦  «        ‰‰ ‰ ¬¦  «        S )N)r   )Ú	nothreadsÚ
foreground)r   )r�   r   Úmount_pointÚ	ops_classr   r   Úthreadss   €€€€€€€r   ú<lambda>zrun.<locals>.<lambda>º   s5   ø€ •4Øˆ	�"�d zÐ2Ñ2Ô2ØØ�+Øð	ñ ô € r   )ÚtargetTN)Ú	threadingÚThreadÚdaemonÚstartÚKeyboardInterrupt)	r   r   r‚   r�   r„   r   rƒ   ÚfuncÚths	   ```````  r   ÚrunrŽ   Ž   sª   øøøøøøø€ ðXð ð ð ð ð ð ð ð ð €Dð ð 	ÝÔ TÐ*Ñ*Ô*ˆØˆŒ	Ø
�Š‰
Œ
ˆ
Øˆ	ð	ØˆD‰FŒFˆFˆFˆFøÝ ð 	ð 	ð 	ØˆDˆDð	øøøs   Á
A Á
A"Á!A"c           	      óò  —  G d„ dt           j        ¦  «        } |dt          j        ¬¦  «        }|                     ddt
          ¬¦  «         |                     dt          d	¬
¦  «         |                     dt          d¬
¦  «         |                     dt          d¬
¦  «         |                     dddd¬¦  «         |                     ddt          d¬
¦  «         |                     dddd¬¦  «         |                     dddd¬¦  «         |                     dddd ¬¦  «         |                     | ¦  «        } i }| j        pg D ]î}| 	                    d!¦  «        \  }}}|s| 
                    d"|›�¬#¦  «         |                     ¦   «         }|                     d$¦  «        r&t          |d%t          d$¦  «         …         ¦  «        }n/|                     d&¦  «        r|d%t          d&¦  «         …         d'v }d(|v r1|                     d(d)¦  «        \  }	}
|	|v r|||	         |
<   Œá|
|i||	<   Œé|||<   Œï| j        rBt#          j        t"          j        | j        d*¬+¦  «          G d,„ d-t(          t*          ¦  «        }|}nt(          }t-          | j        fi |¤Ž\  }}t0                               d.|t          | j        ¦  «        ¦  «         t7          || j        | j        | j        | j        | j        |¬/¦  «         d%S )0a¥  Mount filesystem from chained URL to MOUNT_POINT.

    Examples:

    python3 -m fsspec.fuse memory /usr/share /tmp/mem

    python3 -m fsspec.fuse local /tmp/source /tmp/local \
            -l /tmp/fsspecfuse.log

    You can also mount chained-URLs and use special settings:

    python3 -m fsspec.fuse 'filecache::zip::file://data.zip' \
            / /tmp/zip \
            -o 'filecache-cache_storage=/tmp/simplecache'

    You can specify the type of the setting by using `[int]` or `[bool]`,
    (`true`, `yes`, `1` represents the Boolean value `True`):

    python3 -m fsspec.fuse 'simplecache::ftp://ftp1.at.proftpd.org' \
            /historic/packages/RPMS /tmp/ftp \
            -o 'simplecache-cache_storage=/tmp/simplecache' \
            -o 'simplecache-check_files=false[bool]' \
            -o 'ftp-listings_expiry_time=60[int]' \
            -o 'ftp-username=anonymous' \
            -o 'ftp-password=xieyanbo'
    c                   ó   ‡ — e Zd Zˆ fd„Zˆ xZS )ú*main.<locals>.RawDescriptionArgumentParserc                 óÐ   •— t          ¦   «                              ¦   «         }|                     d¦  «        }| j                             ¦   «         |d<   d                     |¦  «        S )Nz

r-   )ÚsuperÚformat_helpÚsplitÚdescriptionr   r6   )r   ÚusageÚpartsÚ	__class__s      €r   r”   z6main.<locals>.RawDescriptionArgumentParser.format_helpé   sS   ø€ Ý‘G”G×'Ò'Ñ)Ô)ˆEØ—K’K Ñ'Ô'ˆEØÔ'×.Ò.Ñ0Ô0ˆE�!‰HØ—;’;˜uÑ%Ô%Ð%r   )rz   r{   r|   r”   Ú__classcell__)r™   s   @r   ÚRawDescriptionArgumentParserr‘   è   s8   ø€ € € € € ð	&ð 	&ð 	&ð 	&ð 	&ð 	&ð 	&ð 	&ð 	&r   r›   r   )Úprogr–   z	--versionÚversion)Úactionr�   Úurlzfs url)r"   ÚhelpÚsource_pathzsource directory in fsr‚   zlocal directoryz-oz--optionÚappendz3Any options of protocol included in the chained URL)rž   r    z-lz
--log-filez%Logging FUSE debug info (Default: '')z-fz--foregroundÚstore_falsez-Running in foreground or not (Default: False)z-tz	--threadsz-Running with threads support (Default: False)z-rz--ready-filezZThe `.fuse_ready` file will exist after FUSE is ready. (Debugging purpose, Default: False)ú=zWrong option: )Úmessagez[int]Nz[bool])Ú1ÚyesÚtrueú-r-   z%(asctime)s %(message)s)ÚlevelÚfilenameÚformatc                   ó   — e Zd ZdS )úmain.<locals>.LoggingFUSErN)rz   r{   r|   r}   r   r   ÚLoggingFUSErr®   -  s   € € € € € ØˆDr   r¯   zMounting %s to %s)r�   r„   r   rƒ   ) ÚargparseÚArgumentParserÚmainÚ__doc__Úadd_argumentr	   ÚstrÚ
parse_argsÚoptionÚ	partitionÚerrorÚlowerÚendswithÚintr\   r•   Úlog_fileÚloggingÚbasicConfigÚDEBUGr   r   r
   rŸ   r   r5   r‚   rŽ   r¡   r�   r„   r   )Úargsr›   ÚparserÚkwargsÚitemÚkeyÚsepÚvalueÚvalÚfs_nameÚsetting_namer¯   Úfuserr   Úurl_paths                  r   r²   r²   Ì   s®  € ð8&ð &ð &ð &ð &¥xÔ'>ñ &ô &ð &ð *Ð)¨}Í$Ì,ÐWÑWÔW€FØ
×Ò˜¨I½{ÐÑKÔKÐKØ
×Ò˜¥C¨hÐÑ7Ô7Ð7Ø
×Ò˜­CÐ6NÐÑOÔOÐOØ
×Ò˜­CÐ6GÐÑHÔHÐHØ
×ÒØØØØBð	 ñ ô ð ð ×ÒØˆl¥Ð+Rð ñ ô ð ð ×ÒØØØØ<ð	 ñ ô ð ð ×ÒØØØØ<ð	 ñ ô ð ð ×ÒØØØð.ð	 ñ ô ð ð ×Ò˜TÑ"Ô"€Dà€FØ”Ð!˜rð  ð  ˆØŸ.š.¨Ñ-Ô-‰ˆˆS�%Øð 	<Ø�LŠLÐ!:°$Ð!:Ð!:ˆLÑ;Ô;Ð;Ø�kŠk‰mŒmˆØ�<Š<˜Ñ Ô ð 	BÝ˜˜o¥ W¡¤ ˜oÔ.Ñ/Ô/ˆEˆEØ�\Š\˜(Ñ#Ô#ð 	BØÐ(�3˜x™=œ=˜.Ð(Ô)Ð-AÐAˆEà�#ˆ:ˆ:Ø$'§I¢I¨c°1Ñ$5Ô$5Ñ!ˆG�\Ø˜&Ð Ð Ø05��w” Ñ-Ð-à#/°Ð"7��w‘�àˆF�3‰KˆKà„}ð ÝÔÝ”-Ø”]Ø,ð	
ñ 	
ô 	
ð 	
ð	ð 	ð 	ð 	ð 	�5¥,ñ 	ô 	ð 	ð ˆˆåˆå˜TœXÐ0Ð0¨Ð0Ð0�L€BˆÝ
‡L‚LÐ$ hµ°DÔ4DÑ0EÔ0EÑFÔFÐFÝØ
ØÔØÔØ”?Ø”Ø”?Øðñ ô ð ð ð r   Ú__main__r-   )r°   r¾   rE   r:   r‡   r=   Úerrnor   r   Úfuser   r   r   r   Úfsspecr	   Úfsspec.corer
   Ú	getLoggerr   r   rŽ   r²   rz   ÚsysÚargvr}   r   r   ú<module>rÕ      sW  ðØ €€€Ø €€€Ø 	€	€	€	Ø €€€Ø Ð Ð Ð Ø €€€Ø Ð Ð Ð Ð Ð Ð Ð à <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ð <à Ð Ð Ð Ð Ð Ø !Ð !Ð !Ð !Ð !Ð !à	ˆÔ	˜=Ñ	)Ô	)€ðz"ð z"ð z"ð z"ð z"ˆJñ z"ô z"ð z"ðB ØØØð;ð ;ð ;ð ;ð|rð rð rðj ˆzÒÐØ€J€J€Jà€DˆŒ�!�"�"ŒÑÔÐÐÐð Ðr   