L iL/2ddlmZddlmZGddeZy)) filesystem)AsyncFileSystemceZdZdZdZ dCfd ZdZdZedZ dZ dZ d Z d Z d Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"d Z#d!Z$d"Z%d#Z&d$Z'd%Z(d&Z)d'Z*d(Z+d)Z,dDd*Z-dDd+Z.d,Z/d-Z0d.Z1d/Z2d0Z3d1Z4d2Z5d3Z6d4Z7d5Z8d6Z9d7Z:d8Z;d9Zd<Z?d=Z@d>ZAd?ZBd@ZCdAZDdBZExZFS)E DirFileSystemzDirectory prefix filesystem The DirFileSystem is a filesystem-wrapper. It assumes every path it is dealing with is relative to the `path`. After performing the necessary paths operation it delegates everything to the wrapped filesystem. dirc 6t|di||tdd|i|xsi}|xs|}|jr|js t d|jr$|j|jk7r t d|j ||_||_y)aS Parameters ---------- path: str Path to the directory. fs: AbstractFileSystem An instantiated filesystem to wrap. target_protocol, target_options: if fs is none, construct it from these fo: str Alternate for path; do not provide both Nprotocolz(can't use asynchronous with non-async fsz7both dirfs and fs should be in the same sync/async mode) super__init__r asynchronous async_impl ValueError_strip_protocolpathfs)selfrrfotarget_protocoltarget_optionsstorage_options __class__s b/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/fsspec/implementations/dirfs.pyr zDirFileSystem.__init__s* +?+ :O_O9M2OBzr   R]]GH H ==T.."//AVW W&&t, ct|tr\|js|S|s |jS|jjj |j|j |fSt|tr3|jDcic]\}}|j||c}}S|Dcgc]}|j|c}Scc}}wcc}wN) isinstancestrrrsepjoinrdictitems_join)rr_pathvalues rr#zDirFileSystem._join2s dC 99 yy 77;;##TYY0D0DT0J$KL L dD !AENDJJu%u,N N/34e 5!44O4s C4Ccbt|tr|js|S||jk(sA|jj|jj r||jddk(ry|j|jj z}|jj|jj r*|j|jj s|dd}|j|sJ|t |dS|Dcgc]}|j|c}Scc}w)N)rrr startswithrrlen_relpath)rrprefixr$s rr+zDirFileSystem._relpath=s dC 99 tyy  $$TWW[[1ddiim6KYY,Fyy##DGGKK09U??6* **F & &267 e$777sD,c.|jjSr)rrrs rrzDirFileSystem.sepPsww{{rcVK|jj|i|d{S7wr)r set_session)rargskwargss rr0zDirFileSystem.set_sessionTs((TWW(($9&9999s )')cvK|jj|j|fi|d{S7wr)r_rm_filer#rrr2s rr4zDirFileSystem._rm_fileWs1%TWW%%djj&6A&AAAAs 0979c Z|jj|j|fi|Sr)rrm_filer#r5s rr7zDirFileSystem.rm_fileZs%twwtzz$/:6::rc|K|jj|j|g|i|d{S7wr)r_rmr#rrr1r2s rr9zDirFileSystem._rm]s4 TWW[[D!1CDCFCCCC 3<:<c`|jj|j|g|i|Sr)rrmr#r:s rr=zDirFileSystem.rm`s*twwzz$**T*t>v>>rc|K|jj|j|g|i|d{S7wr)r _pipe_filer#r:s rrPzDirFileSystem._pipe_files6'TWW'' 4(8J4J6JJJJr;c`|jj|j|g|i|Sr)r pipe_filer#r:s rrRzDirFileSystem.pipe_files, tww  D!1CDCFCCrc|K|jj|j|g|i|d{S7wr)r _cat_filer#r:s rrTzDirFileSystem._cat_file6&TWW&&tzz$'7I$I&IIIIr;c`|jj|j|g|i|Sr)rcat_filer#r:s rrWzDirFileSystem.cat_file,tww 4 0B4B6BBrcK|jj|j|g|i|d{}t|tr3|j Dcic]\}}|j ||c}}S|S7Icc}}wwr)r_catr#rr!r"r+rrr1r2retkeyr%s rrZzDirFileSystem._cats DGGLL JJt      c4 @C L*#uDMM#&-L L  Ms!3BA?'BB9BBc|jj|j|g|i|}t|tr3|j Dcic]\}}|j ||c}}S|Scc}}wr)rcatr#rr!r"r+r[s rr_zDirFileSystem.catstdggkk JJt     c4 @C L*#uDMM#&-L L MsA5cxK|jj||j|fi|d{S7wr)r _put_filer#rlpathrpathr2s rrazDirFileSystem._put_files3&TWW&&udjj.?J6JJJJ 1:8:c \|jj||j|fi|Sr)rput_filer#rbs rrgzDirFileSystem.put_files)twwtzz%'8CFCCrc~K|jj||j|g|i|d{S7wr)r_putr#rrcrdr1r2s rrizDirFileSystem._putsL"TWW\\  JJu        s 4=;=cb|jj||j|g|i|Sr)rputr#rjs rrlzDirFileSystem.puts<tww{{  JJu      rcxK|jj|j||fi|d{S7wr)r _get_filer#rrdrcr2s rrnzDirFileSystem._get_files3&TWW&&tzz%'8%J6JJJJrec \|jj|j||fi|Sr)rget_filer#ros rrqzDirFileSystem.get_files)tww 5 15CFCCrc|K|jj|j|g|i|d{S7wr)r_getr#rrdr1r2s rrszDirFileSystem._gets4!TWW\\$**U"3EdEfEEEEr;c`|jj|j|g|i|Sr)rgetr#rts rrvzDirFileSystem.gets*tww{{4::e,>t>v>>rcrK|jj|j|d{S7wr)r_isfiler#rrs rrxzDirFileSystem._isfile(WW__TZZ%56666 .757cV|jj|j|Sr)risfiler#rys rr}zDirFileSystem.isfileww~~djj.//rcrK|jj|j|d{S7wr)r_isdirr#rys rrzDirFileSystem._isdirs(WW^^DJJt$45555r{cV|jj|j|Sr)risdirr#rys rrzDirFileSystem.isdirww}}TZZ-..rcrK|jj|j|d{S7wr)r_sizer#rys rrzDirFileSystem._sizes(WW]]4::d#34444r{cV|jj|j|Sr)rsizer#rys rrzDirFileSystem.sizesww||DJJt,--rcrK|jj|j|d{S7wr)r_existsr#rys rrzDirFileSystem._existsrzr{cV|jj|j|Sr)rexistsr#rys rrzDirFileSystem.existsr~rcK|jj|j|fi|d{}|j}|j |d|d<|S7-wNname)r_infor#rIr+rrr2infos rrzDirFileSystem._infosV"TWW]]4::d#3>v>>yy{}}T&\2V  ?s0A"A .A"c |jj|j|fi|}|j}|j |d|d<|Sr)rrr#rIr+rs rrzDirFileSystem.infosJtww||DJJt,77yy{}}T&\2V  rcBK|jj|j|fd|i|d{j}|rCg}|D]:}|j}|j |d|d<|j |<|S|j |S7hwNdetailr)r_lsr#rIr+appendrrrr2r\outentrys rrzDirFileSystem._lss TWW[[D!1K&KFKKQQS C "  $ eFm <f  5! "J}}S!!Ls2BBA)Bc &|jj|j|fd|i|j}|rCg}|D]:}|j}|j |d|d<|j |<|S|j |Sr)rlsr#rIr+rrs rrzDirFileSystem.lssdggjjD)C&CFCHHJ C "  $ eFm <f  5! "J}}S!!rcK|jj|j|g|i|23d{\}}}|j|||f%7 6ywr)r_walkr#r+rrr1r2rootdirsfiless rrzDirFileSystem._walk s^'4tww}}TZZ5E'W'WPV'W 3 3#$e--%tU2 2 3'Ws%0AAAAAAAc/K|jj|j|g|i|D]\}}}|j|||fywr)rwalkr#r+rs rrzDirFileSystem.walksT!-djj.>!P!P!P 3 D$--%tU2 2 3sAAc2K|jdd}|jj|j|fi|d{}|r3|j Dcic]\}}|j ||c}}S|j |S7Jcc}}wwNrF)rvr_globr#r"r+rrr2rr\rs rrzDirFileSystem._globs~He,!DGGMM$**T"2=f== @C L*$DMM$'-L L}}S!!>Ls$ABBBB:BBc |jdd}|jj|j|fi|}|r3|j Dcic]\}}|j ||c}}S|j |Scc}}wr)rvrglobr#r"r+rs rrzDirFileSystem.globsuHe,dggll4::d+6v6 @C L*$DMM$'-L L}}S!!MsBcK|jdd}|jj|j|g|i|d{}|r|S|j Dcic]\}}|j ||c}}S7;cc}}wwNtotalT)rvr_dur#r"r+rrr1r2rr\rs rrzDirFileSystem._du#s} 7D)DGGKK 4 0B4B6BB JA A  A c~|j|jj|j|g|i|Sr)r+r expand_pathr#r:s rrzDirFileSystem.expand_pathFs6}}0TWW00D1ASDSFSTTrc|K|jj|j|g|i|d{S7wr)r_mkdirr#r:s rrzDirFileSystem._mkdirIs4#TWW^^DJJt$4FtFvFFFFr;c`|jj|j|g|i|Sr)rmkdirr#r:s rrzDirFileSystem.mkdirLs*tww}}TZZ-????rc|K|jj|j|g|i|d{S7wr)r _makedirsr#r:s rrzDirFileSystem._makedirsOrUr;c`|jj|j|g|i|Sr)rmakedirsr#r:s rrzDirFileSystem.makedirsRrXrcV|jj|j|Sr)rrmdirr#rys rrzDirFileSystem.rmdirUrrc z|jj|j||j|fi|Sr)rmvr#r@s rrzDirFileSystem.mvXs;twwzz JJu  JJu    rc Z|jj|j|fi|Sr)rtouchr#r5s rrzDirFileSystem.touch_s%tww}}TZZ-888rcV|jj|j|Sr)rcreatedr#rys rrzDirFileSystem.createdbswwtzz$/00rcV|jj|j|Sr)rmodifiedr#rys rrzDirFileSystem.modifiedes ww 4 011rc`|jj|j|g|i|Sr)rsignr#r:s rrzDirFileSystem.signhrNrch|jjd|jd|jdS)Nz(path='z', fs=))r __qualname__rrr.s r__repr__zDirFileSystem.__repr__ks...--.gdii[twwiqQQrc`|jj|j|g|i|Sr)ropenr#r:s rrzDirFileSystem.openns9 tww|| JJt     rc|K|jj|j|g|i|d{S7wr)r open_asyncr#r:s rrzDirFileSystem.open_asynczsI (TWW'' JJt       r;)NNNNN)T)G__name__ __module__r__doc__r r r#r+propertyrr0r4r7r9r=r?rDrFrIrKrMrPrRrTrWrZr_rargrirlrnrqrsrvrxr}rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr __classcell__)rs@rrrsH   !F 58&:B;D=VO   F?KDJC  KD   KDF?706/5.70  " "33""II"" UG@JC/ 912?R    rrN)r(rasynrrr rrrs" O r