Ë
    F^(hÁ'  ã                   ó  — 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j2                  dd «       yy)é    N)ÚEIOÚENOENT)ÚFUSEÚFuseOSErrorÚLoggingMixInÚ
Operations)Ú__version__)Ú	url_to_fsúfsspec.fusec                   ób   — 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y)ÚFUSErc                 óš   — || _         i | _        |j                  d«      dz   | _        d| _        t
        j                  d|«       || _        y )Nú/r   zStarting FUSE at %s)ÚfsÚcacheÚrstripÚrootÚcounterÚloggerÚinfoÚ_ready_file)Úselfr   ÚpathÚ
ready_files       úI/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/fsspec/fuse.pyÚ__init__zFUSEr.__init__   sC   € ØˆŒØˆŒ
Ø—K‘K Ó$ sÑ*ˆŒ	ØˆŒÜ�‰Ð)¨4Ô0Ø%ˆÕó    Nc                 ó  — t         j                  d|«       | j                  r	|dv rdddœS dj                  | j                  |j                  d«      g«      j                  d«      }	 | j                  j                  |«      }|j                  dd	«      |j                  d
d	«      dœ}|j                  dd«      }|d   dk7  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 # t        $ r}t        t        «      |‚d }~ww xY w)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Ô(Ø×Ò Ð(GÑ GØ"¨qÑ1Ð1à�w‰w˜Ÿ	™	 4§;¡;¨sÓ#3Ð4Ó5×<Ñ<¸SÓAˆð	/Ø—7‘7—<‘< Ó%ˆDð Ÿ(™( 5¨$Ó/¸4¿8¹8ÀEÈ4Ó;PÑQˆØ�x‰x˜ Ó&ˆà�‰<˜6Ò!Ü"Ÿl™l¨TÑ1ˆD�‰OØˆD�‰OØ!"ˆD�Òä"Ÿl™l¨TÑ1ˆD�‰OØ" 6™lˆD�‰OØ!*ˆD�ÑØ ˆD�ÑØ,3°t©O˜4 š=ÄÇÁÃˆˆZÑØ,3°t©O˜4 š=ÄÇÁÃˆˆZÑØ,3°t©O˜4 š=ÄÇÁÃˆˆZÑØˆøô% !ò 	/ÜœfÓ%¨3Ð.ûð	/ús   Á(E- Å-	FÅ6FÆFc                 óL  — t         j                  d|«       dj                  | j                  |j	                  d«      g«      }| j
                  j                  |d«      }|D �cg c]0  }t        j                  j                  |j                  d«      «      ‘Œ2 }}ddg|z   S c c}w )Nz
readdir %sr$   r   Fú.z..)r   r5   r6   r   r7   r   ÚlsÚosr   Úbasenamer   )r   r   r>   ÚfilesÚfs        r   ÚreaddirzFUSEr.readdir6   sƒ   € Ü�‰�\ 4Ô(Ø�w‰w˜Ÿ	™	 4§;¡;¨sÓ#3Ð4Ó5ˆØ—‘—
‘
˜4 Ó'ˆØ:?Ö@°Q”—‘×!Ñ! !§(¡(¨3£-Õ0Ð@ˆÐ@Ø�Tˆ{˜UÑ"Ð"ùò As   Á#5B!c                 ó’   — dj                  | j                  |j                  d«      g«      }| j                  j	                  |«       y©Nr$   r   r   )r6   r   r7   r   Úmkdir©r   r   r)   s      r   rM   zFUSEr.mkdir=   ó5   € Ø�w‰w˜Ÿ	™	 4§;¡;¨sÓ#3Ð4Ó5ˆØ�‰�‰�dÔØr   c                 ó’   — dj                  | j                  |j                  d«      g«      }| j                  j	                  |«       yrL   )r6   r   r7   r   Úrmdir)r   r   s     r   rQ   zFUSEr.rmdirB   rO   r   c                 ó¼   — t         j                  d|||f«       | j                  r|dv ry| j                  |   }|j	                  |«       |j                  |«      }|S )Nzread %sr   s   ready)r   r5   r   r   ÚseekÚread)r   r   r,   Úoffsetr>   rI   Úouts          r   rT   z
FUSEr.readG   sU   € Ü�‰�Y  t¨VÐ 4Ô5Ø×Ò Ð(GÑ Gàà�J‰J�r‰NˆØ	�‰ˆvŒØ�f‰f�T‹lˆØˆ
r   c                 óª   — t         j                  d||f«       | j                  |   }|j                  |«       |j	                  |«       t        |«      S )Nzwrite %s)r   r5   r   rS   ÚwriteÚlen)r   r   r@   rU   r>   rI   s         r   rX   zFUSEr.writeR   sA   € Ü�‰�Z $¨ Ô0Ø�J‰J�r‰NˆØ	�‰ˆvŒØ	�‰�ŒÜ�4‹yÐr   c                 ór  — t         j                  d||f«       dj                  | j                  |j	                  d«      g«      }| j
                  j                  |«       | 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ÚfnrI   s         r   ÚcreatezFUSEr.createY   s‡   € Ü�‰�[ 4¨ -Ô0Ø�W‰W�d—i‘i §¡¨SÓ!1Ð2Ó3ˆØ�‰�‰�bÔØ�G‰G�L‰L˜˜TÓ"ˆØ#$ˆ�
‰
�4—<‘<Ñ Ø�Š˜Ñ�Ø�|‰|˜aÑÐr   c                 óR  — t         j                  d||f«       dj                  | j                  |j	                  d«      g«      }|dz  dk(  rd}nd}| j
                  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   r^   r`   r)   s        r   r]   z
FUSEr.openb   s‰   € Ü�‰�Y  u Ô.Ø�W‰W�d—i‘i §¡¨SÓ!1Ð2Ó3ˆØ�1‰9˜Š>à‰Dð ˆDØ#'§7¡7§<¡<°°DÓ#9ˆ�
‰
�4—<‘<Ñ Ø�Š˜Ñ�Ø�|‰|˜aÑÐr   c                 ó¨   — dj                  | j                  |j                  d«      g«      }|dk7  rt        ‚| j                  j                  |«       y rL   )r6   r   r7   ÚNotImplementedErrorr   r\   )r   r   Úlengthr>   r`   s        r   ÚtruncatezFUSEr.truncateo   s?   € Ø�W‰W�d—i‘i §¡¨SÓ!1Ð2Ó3ˆØ�QŠ;Ü%Ð%à�‰�‰�bÕr   c                 óä   — dj                  | j                  |j                  d«      g«      }	 | j                  j	                  |d«       y # 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   r`   r?   s       r   ÚunlinkzFUSEr.unlinkv   s\   € Ø�W‰W�d—i‘i §¡¨SÓ!1Ð2Ó3ˆð	,Ø�G‰G�J‰J�r˜5Õ!øÜÔ*Ð+ò 	,ÜœcÓ"¨Ð+ûð	,ús   ®A ÁA/ÁA*Á*A/c                 óØ   — 	 || j                   v r:| j                   |   }|j                  «        | j                   j                  |«       y# t        $ r}t	        |«       Y d }~yd }~ww xY w)Nr   )r   ÚcloseÚpopÚ	ExceptionÚprint)r   r   r>   rI   Úes        r   ÚreleasezFUSEr.release}   s\   € ð	Ø�T—Z‘ZÑØ—J‘J˜r‘N�Ø—‘”	Ø—
‘
—‘˜rÔ"ð øô ò 	Ü�!�HˆHØûð	ús   ‚AA Á	A)ÁA$Á$A)c                 óÊ   — t        | j                  d«      rHdj                  | j                  |j	                  d«      g«      }| j                  j                  ||«      S t        ‚)NÚchmodr$   r   )Úhasattrr   r6   r   r7   ru   rf   rN   s      r   ru   zFUSEr.chmod‡   sK   € Ü�4—7‘7˜GÔ$Ø—7‘7˜DŸI™I t§{¡{°3Ó'7Ð8Ó9ˆDØ—7‘7—=‘=  tÓ,Ð,Ü!Ð!r   )F)N)Ú__name__Ú
__module__Ú__qualname__r   rB   rJ   rM   rQ   rT   rX   ra   r]   rh   rl   rs   ru   © r   r   r   r      sC   „ ó&óò8#òò
ò
	òó ò óò,òó"r   r   TFc                 ó¸   ‡ ‡‡‡‡‡‡— ˆˆ ˆˆˆˆˆfd„}‰s/t        j                  |¬«      }d|_        |j                  «        |S 	  |«        y# t        $ r Y y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                  ó6   •— t         ‰‰‰‰¬«      ‰‰ ‰ ¬«      S )N)r   )Ú	nothreadsÚ
foreground)r   )r~   r   Úmount_pointÚ	ops_classr   r   Úthreadss   €€€€€€€r   ú<lambda>zrun.<locals>.<lambda>º   s#   ø€ ”4Ù�"�d zÔ2ØØ�+Øô	€ r   )ÚtargetTN)Ú	threadingÚThreadÚdaemonÚstartÚKeyboardInterrupt)	r   r   r   r~   r�   r   r€   ÚfuncÚths	   ```````  r   Úrunr‹   Ž   sV   þ€ ÷Xñ €Dñ Ü×Ñ TÔ*ˆØˆŒ	Ø
�‰Œ
Øˆ	ð	Ù�FøÜ ò 	Ùð	ús   ÁA Á	AÁAc           	      ó†  —  G d„ dt         j                  «      } |dt        j                  ¬«      }|j	                  ddt
        ¬«       |j	                  dt        d	¬
«       |j	                  dt        d¬
«       |j	                  dt        d¬
«       |j	                  dddd¬«       |j	                  ddt        d¬
«       |j	                  dddd¬«       |j	                  dddd¬«       |j	                  dddd ¬«       |j                  | «      } i }| j                  xs g D ]½  }|j                  d!«      \  }}}|s|j                  d"|›�¬#«       |j                  «       }|j                  d$«      rt        |d%t        d$«        «      }n"|j                  d&«      r|d%t        d&«        d'v }d(|v r*|j                  d(d)«      \  }	}
|	|v r	|||	   |
<   Œ±|
|i||	<   Œ¹|||<   Œ¿ | j                   rGt#        j$                  t"        j&                  | j                   d*¬+«        G d,„ d-t(        t*        «      }|}nt(        }t-        | j.                  fi |¤Ž\  }}t0        j3                  d.|t        | j4                  «      «       t7        || j8                  | j4                  | j:                  | j<                  | j>                  |¬/«       y%)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         ‰| �  «       }|j                  d«      }| j                  j	                  «       |d<   dj                  |«      S )Nz

r-   )ÚsuperÚformat_helpÚsplitÚdescriptionr   r6   )r   ÚusageÚpartsÚ	__class__s      €r   r‘   z6main.<locals>.RawDescriptionArgumentParser.format_helpé   sE   ø€ Ü‘GÑ'Ó)ˆEØ—K‘K Ó'ˆEØ×'Ñ'×.Ñ.Ó0ˆE�!‰HØ—;‘;˜uÓ%Ð%r   )rw   rx   ry   r‘   Ú__classcell__)r–   s   @r   ÚRawDescriptionArgumentParserrŽ   è   s   ø„ ÷	&ð 	&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y)úmain.<locals>.LoggingFUSErN)rw   rx   ry   rz   r   r   ÚLoggingFUSErr«   -  s   „ Ør   r¬   zMounting %s to %s)r~   r�   r   r€   ) ÚargparseÚArgumentParserÚmainÚ__doc__Úadd_argumentr	   ÚstrÚ
parse_argsÚoptionÚ	partitionÚerrorÚlowerÚendswithÚintrY   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€FØ
×Ñ˜¨I¼{ÐÔKØ
×Ñ˜¤C¨hÐÔ7Ø
×Ñ˜¬CÐ6NÐÔOØ
×Ñ˜¬CÐ6GÐÔHØ
×ÑØØØØBð	 ô ð ×ÑØˆl¤Ð+Rð ô ð ×ÑØØØØ<ð	 ô ð ×ÑØØØØ<ð	 ô ð ×ÑØØØð.ð	 ô ð ×Ñ˜TÓ"€Dà€FØ—‘Ò!˜rò  ˆØŸ.™.¨Ó-‰ˆˆS�%ÙØ�L‰L >°$°Ð!:ˆLÔ;Ø�k‰k‹mˆØ�<‰<˜Ô Ü˜˜o¤ W£ Ð.Ó/‰EØ�\‰\˜(Ô#ØÐ(œ3˜x›=˜.Ð)Ð-AÐAˆEà�#‰:Ø$'§I¡I¨c°1Ó$5Ñ!ˆG�\Ø˜&Ñ Ø05��w‘ Ò-à#/°Ð"7��w’àˆF�3ŠKð# ð& ‡}‚}Ü×ÑÜ—-‘-Ø—]‘]Ø,õ	
ô	œ5¤,ô 	ð ‰äˆä˜TŸX™XÑ0¨Ñ0�L€BˆÜ
‡L�LÐ$ h´°D×4DÑ4DÓ0EÔFÜØ
Ø×ÑØ×ÑØ—?‘?Ø—‘Ø—?‘?Øör   Ú__main__r-   )r­   r»   rF   r:   r„   r=   Úerrnor   r   Úfuser   r   r   r   Úfsspecr	   Úfsspec.corer
   Ú	getLoggerr   r   r‹   r¯   rw   ÚsysÚargvrz   r   r   ú<module>rÒ      s†   ðÛ Û Û 	Û Û Û ß ç <Ó <å Ý !à	ˆ×	Ñ	˜=Ó	)€ôz"ˆJô z"ðB ØØØó;ò|rðj ˆzÒÛáˆ�‰�!�"ˆÕð r   