L iRDddlmZddlmZddlZddlmZGddZy))md5)productN)GLOB_EDGE_CASES_TESTSceZdZdZdZdZdZdZdZdZ dZ e jjed ed d Zd Zd ZdZdZdZy)AbstractPutTestsc|}|}|j||s|j||d|j|sJ||d} ||d} |j||d||j | sJ|j||dd||j | sJ|j | | g|j | rJ|j | rJ|j||d|dz|j|sJ|j | sJ|j||dd|dz|j | sJy)Ndummyfile2subfile1subdir/)mkdirtouchisdirputisfilermexists) selffsfs_join fs_target local_join local_bulk_operations_scenario_0supports_empty_directoriessourcetarget target_file2target_subfile1s _/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/fsspec/tests/abstract/put.py#test_put_file_to_existing_directoryz4AbstractPutTests.test_put_file_to_existing_directory sQ2 ) HHWVW- .xxvw/ !&*5 z&'*F3yy&&& z&(J7@yy))) |_-.99\***99_--- z&'*FSL9xxyy&&& z&(J7#Fyy)))c|}|}|j||j||dd||d|j|sJ|j||dsJ|j||ddsJy)Nr r znewdir/newdirrrrrrrrrrrrrs r test_put_file_to_new_directoryz/AbstractPutTests.test_put_file_to_new_directory5s2   vx 4gfi6P xxxx1222yy:>???r"c|}|}|j||s|j||d|j|sJ|j||dd||d|j ||dsJy)Nr r r newfile)rrrrr) rrrrrrrrrs r +test_put_file_to_file_in_existing_directoryz>>r"c |}|}|j||s||d}|j||j|sJtddgddgD]\} } ||d} | r| dz } | r|dzn|} |j | | |j |d|rgngk(sJ|j | | d| r|j ||dsJ|j ||d sJ|j||d sJ|j ||d d sJ|j||drJ|j||d||d ||d gdn|j||dsJ|j ||ddsJ|j ||dd sJ|j||dd sJ|j ||dd d sJ|j||dd|j |d|rgngk(sJ|j | | dd | r|j ||dsJ|j ||d sJ|j||d rJ|j||drJ|j||d||d gdn|j||dsJ|j ||ddsJ|j ||dd sJ|j||dd rJ|j||dd|j |d|rgngk(rJy)Nr FTr r detail recursiver subfile2 nesteddir nestedfiler1maxdepth) rrrziprlsrrr) rrrrrrrrr source_slash target_slashsts r (test_put_directory_to_existing_directoryz9AbstractPutTests.test_put_directory_to_existing_directoryks2 )FG,E HHUOxx*-udmeT]*KA  &L,)AS , &A FF1aL555.0ug  FF1a4F (yy!<===yy!<===xx <===yyl!KLLL99WVX%>??? 3 3 4 # xx 9:::yy:!FGGGyy:!FGGGxx+ FGGGyy; !UVVVgfh/4@555.0ug  FF1a4!F 4yy!<===yy!<===99WV[%ABBB99WVX%>??? 3 3# xx 9:::yy:!FGGGyy:!FGGG99WVX{%KLLLgfh/4@555.0ug A r"c |}|}|j|tddgddgD]:\}} ||d} |r| dz } ||d} | r| dz } |j| | |r|j|gk(s5Jt j t 5|j|ddd|j| | d|j||dsJ|j||ddsJ|j||ddsJ|j||dd sJ|j||dd d sJ|j||drJ|j||dd|j||drJ|j| | dd |j||dsJ|j||ddsJ|j||ddsJ|j||dd rJ|j||drJ|j||dd|j||ds;Jy#1swYxYw) NFTr r r$r0r r2r3r4r5r6) rr8rr9pytestraisesFileNotFoundErrorrrrr) rrrrrrrrr:r;r<r=s r #test_put_directory_to_new_directoryz4AbstractPutTests.test_put_directory_to_new_directorysp2 *-udmeT]*K% < &L,)AS)AS FF1aL)uuV}***]]#45"EE&M" FF1a4F (88GFH56 6699WVXzBC CC99WVXzBC CC88GFHkBC CC99WVX{LQR RRyy!:; ;; EE'&(+tE <yy!:; ;; FF1a4!F 488GFH56 6699WVXzBC CC99WVXzBC CCyy;!GH HHyy!:; ;; EE'&(+tE <yy!:; ;;K% <""s I%%I/ c |}|}|j||s||d} |j| |j|sJdD]} | r|dzn|} |j||dd| |j ||dsJ|j ||dsJ|j||drJ|j ||dd rJ|j ||drJ|j ||d||dgd |j|d |rgn gk(sJtddgd d gD]\} } |j||d| | | |j ||dsJ|j ||dsJ|j||dsJ|j ||dd sJ|j ||drJ|j ||d||d||dgd |j|d |rgn gk(sJ|j||d| | | d|j ||dsJ|j ||dsJ|j ||drJ|j ||drJ|j ||d||dgd |j|d |rgn gk(rJy)Nr FTr r *r r2r3r4Tr0Fr.**r5r6) rrrrrrrr9r8)rrrrrrrrrr r;r=globr1s r #test_put_glob_to_existing_directoryz4AbstractPutTests.test_put_glob_to_existing_directorys^2 )FG,E HHUOxx)@ L , &A FF:fh4a 899WVZ89 9999WVZ89 99xx <= ==yyl!KL LLyy!:; ;; EEFJ/FJ/  555.0ug  $'T{T5M#B) iz&(D91 Ryy!<===yy!<===xx <===yyl!KLLL99WVX%>??? 3 3 4 # uuVEu24B5' vx6'  yy!<===yy!<===99WV[%ABBB99WVX%>??? 3 3# uuVEu24B5'O) /@ r"c |}|}|j|dD]4}||d} |r| dz } |j||dd| |j||dsJ|j||ddsJ|j||ddsJ|j ||ddrJ|j ||ddd rJ|j ||drJ|j ||ddrJ|j ||dd |j ||drJt dd gd d gD]\} } |j||d| | | |j||dsJ|j||ddsJ|j||ddsJ|j||ddsJ|j||ddd sJ|j ||drJ|j ||ddrJ|j ||dd |j ||drJ|j||d| | | d|j||dsJ|j||ddsJ|j||ddsJ|j ||ddrJ|j ||drJ|j ||ddrJ|j ||dd |j ||dsJ7y)NrEr$r r rFr r2r3r4Tr0rGFr5r6)rrrrrrr8) rrrrrrrrr;r=rHr1s r test_put_glob_to_new_directoryz/AbstractPutTests.test_put_glob_to_new_directoryLsk2 )/ @L)AS FF:fh4a 888GFH56 6699WVXzBC CC99WVXzBC CCyy;!GH HHyy; !UV VVyy!:; ;;yy8!DE EE EE'&(+tE <yy!:; ;;$'T{T5M#B @iz&(D91 Rxx 9:::yy:!FGGGyy:!FGGGxx+ FGGGyy; !UVVV99WVX%>???99WVXx%HIIIgfh/4@99WVX%>???vx6'  xx 9:::yy:!FGGGyy:!FGGG99WVX{%KLLL99WVX%>???99WVXx%HIIIgfh/4@99WVX%>???9 @'/ @r"argnames argvaluesc |} |} tddgddgD]\} }|j| | r || dn| }|r|dzn|}|j| | |||||j| }| r|Dcgc]}| || d|}}n|Dcgc]}| || |}}t |t |k(sJ |j | dycc}wcc}w#t $rYwxYw)NTFr$r r6r0)rrrfindsortedrrB)rpathr1r7expectedrrrlocal_glob_edge_cases_filesrfs_sanitize_pathrrnew_dirr;r=outputpprefixed_expecteds r test_put_glob_edge_casesz)AbstractPutTests.test_put_glob_edge_casess($-%,dE]T5M%J  !G\ HHV -4)&A'CQA FF:fd+Q)hF WWWV_FLT%GH$WVXq%AB%!% CK%=>$WVQ%78%!%&>V,=%>> >> f-) %%%  s5CC C%% C10C1c 2|}|}|j||s||d} |j| |j|sJ||d||d||ddg} dD]} | r|dzn|} |j| | |j ||dsJ|j ||dsJ|j ||dsJ|j ||d||d||dgd |j |d |rgn gk(rJy) Nr file1r r r rEr Tr0Fr.)rrrrrrr9) rrrrrrrrrr source_filesr;r=s r ,test_put_list_of_files_to_existing_directoryz=AbstractPutTests.test_put_list_of_files_to_existing_directorysI2 )FG,E HHUOxx vw ' vw ' vx 4 * L , &A FF< #99WVW56 6699WVW56 6699WVZ89 99 EEFG,FG,FJ/   555.0ug ! r"cr|}|}|j|||d||d||ddg}|j|||ddz|j||dsJ|j||ddsJ|j||ddsJ|j||ddsJy)Nr[r r r r$r r%) rrrrrrrrr\s r 'test_put_list_of_files_to_new_directoryz8AbstractPutTests.test_put_list_of_files_to_new_directorys2  vw ' vw ' vx 4 |WVX6<=xx1222yy7;<<<yy7;<<<yy:>???r"c>||d}||d}|j||j||} |j| rJtdD]} |j || d|j | sJ| dk(r5|j || dsJ|j|| dsbJ|j || dsJ|j || dsJ|j || ddrJ|j| d|j| rJtdD]`} |j |dz| d|j | sJ|j || dsJ|j|| ds`Jy)NsrcfileTr0rr )rrrrangerrrr) rrrrlocal_fsr local_pathrasrc_filerloops r test_put_directory_recursivez-AbstractPutTests.test_put_directory_recursives U+c6*sx 99V$$$!H AD FF3$F /88F# ##qyyy!899999WVU%;<<<yy!8999xx 6777yy!?@@@ A f%99V$$$!H 9D FF39fF 588F# ##99WVV45 55yy!78 88  9r"c|}|}|j||d|d|j||dsJ|j||drJ|j||dg|r|j|gk(sJ|j |rJ|j||d|d|j ||dsJ|j||ddsJ|j||dsJy)Nr Tr0z subfile.txtz subdir.txtzsubdir*)rrrr9rr) rrrrr(local_dir_and_file_with_same_name_prefixrrrs r 6test_put_directory_without_files_with_same_name_prefixzGAbstractPutTests.test_put_directory_without_files_with_same_name_prefixs: z&(+Y$GyyM:;;;99WY =>>> wv}-./ %55=B& &&yy( (( z&),i4Hxx 84555yyHmDEEEyyL9:::r"c|}|}g}g} tdD]i} tt| jdj } |j ||| d| j ||| dk|j || tdD]5} |j| | jd} | t| k(r5Jy)N zutf-8z.txt)lpathrpath) rdrstrencode hexdigestappendrcatdecode) rrrrr local_10_files_with_hashed_namesrrr\destination_filesihashed_i file_contents r -test_copy_with_source_and_destination_as_listz>AbstractPutTests.test_copy_with_source_and_destination_as_list;s2 r IA3q6==12<<>H    6hZt3D E F  $ $WVz5F%G H I \):;r *A66"3A"67>>wGL3q6) )) *r"N)__name__ __module__ __qualname__r!r'r*r,r>rCrIrKr@mark parametrizerrYr]r_rirlr|r"r rr s)*V@ 5,? Tl3rs >F *F *r"