
    7Th'                        S SK r S SKrS SKrS SKrS SKrS SKrS SKJrJr  S SK	J
r
JrJrJr  S SKJr  S SKJr  \R$                  " S5      r " S S\5      rS	S
S
\4S jrS r\S:X  a  S SKr\" \R2                  SS 5        gg)    N)EIOENOENT)FUSEFuseOSErrorLoggingMixIn
Operations)__version__)	url_to_fsfsspec.fusec                   r    \ rS rSrSS jrSS jrS rS rS rS r	S	 r
SS
 jrS rSS jrS rS rS rSrg)FUSEr   c                     Xl         0 U l        UR                  S5      S-   U l        SU l        [
        R                  SU5        X0l        g )N/r   zStarting FUSE at %s)fscacherstriprootcounterloggerinfo_ready_file)selfr   path
ready_files       C/var/www/auris/envauris/lib/python3.13/site-packages/fsspec/fuse.py__init__FUSEr.__init__   s?    
KK$s*	)40%    Nc                 @   [         R                  SU5        U R                  (       a  US;   a  SSS.$ SR                  U R                  UR                  S5      /5      R                  S5      n U R                  R                  U5      nUR                  SS	5      UR                  S
S	5      S.nUR                  SS5      nUS   S:w  a!  [        R                  U-  US'   SUS'   SUS'   O([        R                  U-  US'   US   US'   SUS'   SUS'   SU;   a  US   O[         R                   " 5       US'   SU;   a  US   O[         R                   " 5       US'   SU;   a  US   O[         R                   " 5       US'   U$ ! [         a  n[        [        5      UeS nAff = f)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   getattrFUSEr.getattr   s|   \4((G G"q11ww		4;;s#345<<SA	/77<<%D ((5$/488E4;PQxx&<6!"llT1DODO!"D"llT1DO"6lDO!*D D,3tO4=Z,3tO4=Z,3tO4=Z% ! 	/f%3.	/s   /E> >
FFFc                 R   [         R                  SU5        SR                  U R                  UR	                  S5      /5      nU R
                  R                  US5      nU Vs/ s H1  n[        R                  R                  UR                  S5      5      PM3     nnSS/U-   $ s  snf )Nz
readdir %sr&   r   F.z..)r   r7   r8   r   r9   r   lsosr   basenamer   )r   r   r@   filesfs        r   readdirFUSEr.readdir6   s    \4(ww		4;;s#345

4':?@%Q!!!((3-0%@T{U"" As   #8B$c                     SR                  U R                  UR                  S5      /5      nU R                  R	                  U5        gNr&   r   r   )r8   r   r9   r   mkdirr   r   r+   s      r   rQ   FUSEr.mkdir=   5    ww		4;;s#345dr   c                     SR                  U R                  UR                  S5      /5      nU R                  R	                  U5        grP   )r8   r   r9   r   rmdir)r   r   s     r   rV   FUSEr.rmdirB   rT   r   c                     [         R                  SXU45        U R                  (       a  US;   a  gU R                  U   nUR	                  U5        UR                  U5      nU$ )Nzread %sr!   s   ready)r   r7   r   r   seekread)r   r   r.   offsetr@   rL   outs          r   rZ   
FUSEr.readG   sS    YV 45(G GJJrN	vffTl
r   c                     [         R                  SX45        U R                  U   nUR                  U5        UR	                  U5        [        U5      $ )Nzwrite %s)r   r7   r   rY   writelen)r   r   rB   r[   r@   rL   s         r   r_   FUSEr.writeR   s?    Z$0JJrN	v	4yr   c                 n   [         R                  SX45        SR                  U R                  UR	                  S5      /5      nU R
                  R                  U5        U R
                  R                  US5      nXPR                  U R                  '   U =R                  S-  sl	        U R                  S-
  $ )Nz	create %sr&   r   wbr/   )
r   r7   r8   r   r9   r   touchopenr   r   )r   r   flagsfifnrL   s         r   createFUSEr.createY   s    [4-0WWdiiS!123bGGLLT"#$

4<< ||ar   c                 P   [         R                  SX45        SR                  U R                  UR	                  S5      /5      nUS-  S:X  a  SnOSnU R
                  R                  X45      U R                  U R                  '   U =R                  S-  sl        U R                  S-
  $ )	Nzopen %sr&   r      r   rbrc   r/   )	r   r7   r8   r   r9   r   re   r   r   )r   r   rf   rh   r+   s        r   re   
FUSEr.openb   s    Y.WWdiiS!12319>D D#'77<<#9

4<< ||ar   c                     SR                  U R                  UR                  S5      /5      nUS:w  a  [        eU R                  R                  U5        g rP   )r8   r   r9   NotImplementedErrorr   rd   )r   r   lengthr@   rh   s        r   truncateFUSEr.truncateo   s?    WWdiiS!123Q;%%br   c                     SR                  U R                  UR                  S5      /5      n U R                  R	                  US5        g ! [
        [        4 a  n[        [        5      UeS nAff = f)Nr&   r   F)	r8   r   r9   r   rmOSErrorr:   r   r   )r   r   rh   rA   s       r   unlinkFUSEr.unlinkv   s\    WWdiiS!123	,GGJJr5!*+ 	,c"+	,s   A A0A++A0c                      X R                   ;   a:  U R                   U   nUR                  5         U R                   R                  U5        g! [         a  n[	        U5         S nAgS nAff = f)Nr   )r   closepop	Exceptionprint)r   r   r@   rL   es        r   releaseFUSEr.release}   sZ    	ZZJJrN	

r"   	!HH	s   A	A 
A+A&&A+c                     [        U R                  S5      (       aG  SR                  U R                  UR	                  S5      /5      nU R                  R                  X5      $ [        e)Nchmodr&   r   )hasattrr   r8   r   r9   r   rp   rR   s      r   r   FUSEr.chmod   sL    477G$$77DIIt{{3'789D77==,,!!r   )r   r   r   r   r   )F)N)__name__
__module____qualname____firstlineno__r   rD   rM   rQ   rV   rZ   r_   ri   re   rr   rw   r   r   __static_attributes__ r   r   r   r      sC    &8#

	  ,"r   r   TFc                    ^ ^^^^^^ UU UUUUU4S jnT(       d-  [         R                  " US9nSUl        UR                  5         U$  U" 5         g! [         a     gf = f)a  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                  2   > [        T" TTTS9TT(       + T S9$ )N)r   )	nothreads
foreground)r   )r   r   mount_point	ops_classr   r   threadss   r   <lambda>run.<locals>.<lambda>   s!    4"dz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           
      p    " S S[         R                  5      nU" S[        R                  S9nUR	                  SS[
        S9  UR	                  S[        S	S
9  UR	                  S[        SS
9  UR	                  S[        SS
9  UR	                  SSSSS9  UR	                  SS[        SS
9  UR	                  SSSSS9  UR	                  SSSSS9  UR	                  SSSS S9  UR                  U 5      n 0 nU R                  =(       d    /  H  nUR                  S!5      u  pVnU(       d  UR                  S"U< 3S#9  UR                  5       nUR                  S$5      (       a  [        US%[        S$5      *  5      nO(UR                  S&5      (       a  US%[        S&5      *  S';   nS(U;   a)  UR                  S(S)5      u  pX;   a	  XsU	   U
'   M  X0X9'   M  XsU'   M     U R                   (       aE  ["        R$                  " ["        R&                  U R                   S*S+9   " S, S-[(        [*        5      nUnO[(        n[-        U R.                  40 UD6u  p[0        R3                  S.U[        U R4                  5      5        [7        UU R8                  U R4                  U R:                  U R<                  U R>                  US/9  g%)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                   (   ^  \ rS rSrU 4S jrSrU =r$ )*main.<locals>.RawDescriptionArgumentParser   c                    > [         TU ]  5       nUR                  S5      nU R                  R	                  5       US'   SR                  U5      $ )Nz

r/   )superformat_helpsplitdescriptionr   r8   )r   usageparts	__class__s      r   r   6main.<locals>.RawDescriptionArgumentParser.format_help   sE    G')EKK'E''..0E!H;;u%%r   r   )r   r   r   r   r   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                       \ rS rSrSrg)main.<locals>.LoggingFUSEri-  r   N)r   r   r   r   r   r   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intr`   r   log_fileloggingbasicConfigDEBUGr   r   r
   r   r   r7   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'>'> & *}$,,WF
I{K
Ch7
C6NO
C6GH
B	   l+R   <	   <	   .	   T"DF!r!..-%LL>$!:L;kkm<<  oW./E\\(##(3x=.)-AAE#:$'IIc1$5!G 05w-#/"73K# "& }}--]],	
	5, 	 TXX00LB
LL$hD4D4D0EF
????r   __main__r/   )r   r   rI   r<   r   r?   errnor   r   fuser   r   r   r   fsspecr	   fsspec.corer
   	getLoggerr   r   r   r   r   sysargvr   r   r   <module>r      s      	     < <  !			=	)z"J z"B ;|rj z!" r   