L iMDddlmZddlmZddlZddlmZGddZy))md5)productN)GLOB_EDGE_CASES_TESTSceZdZdZdZdZdZdZdZdZ dZ e jjed ed d Zd Zd ZdZdZdZy)AbstractCopyTestsc|}|}|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/)mkdirtouchisdircpisfilermexists) selffsfs_joinfs_bulk_operations_scenario_0 fs_targetsupports_empty_directoriessourcetarget target_file2target_subfile1s `/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/fsspec/tests/abstract/copy.py$test_copy_file_to_existing_directoryz6AbstractCopyTests.test_copy_file_to_existing_directory sQ/ ) HHWVW- .xxvw/ !&*5 gfg&/yy&&& gfh 3V<yy))) |_-.99\***99_--- gfg& 5xxyy&&& gfh 3Vc\Byy)))c|}|}|j||j||dd||d|j|sJ|j||dsJ|j||ddsJy)Nr r znewdir/newdirrrrrrrrrrrrs rtest_copy_file_to_new_directoryz1AbstractCopyTests.test_copy_file_to_new_directory4s/   FHj 17693M xxxx1222yy:>???r!c|}|}|j||s|j||d|j|sJ|j||dd||d|j ||dsJy)Nr r r newfile)rrrrr)rrrrrrrrs r,test_copy_file_to_file_in_existing_directoryz>AbstractCopyTests.test_copy_file_to_file_in_existing_directoryDsy/ ) HHWVW- .xx gfh 3WVY5OPyy3444r!c|}|}|j||j||dd||dd|j||dsJ|j||ddsJy)Nr r r#r(r$r%s r'test_copy_file_to_file_in_new_directoryz9AbstractCopyTests.test_copy_file_to_file_in_new_directoryYss/   FHj 1768Y3W xx1222yy9=>>>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 nestedfiler0maxdepth) rrrziprlsrrr) rrrrrrrrr source_slash target_slashsts r)test_copy_directory_to_existing_directoryz;AbstractCopyTests.test_copy_directory_to_existing_directoryhs/ )FG,E HHUOxx*-udmeT]*KA  &L,)AS , &A EE!QK555.0ug  EE!Q$E 'yy!<===yy!<===xx <===yyl!KLLL99WVX%>??? 3 3 4 # xx 9:::yy:!FGGGyy:!FGGGxx+ FGGGyy; !UVVVgfh/4@555.0ug  EE!Q$E 3yy!<===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#r/r r1r2r3r4r5) rr7rr8pytestraisesFileNotFoundErrorrrrr) rrrrrrrrr9r:r;r<s r$test_copy_directory_to_new_directoryz6AbstractCopyTests.test_copy_directory_to_new_directorysp/ *-udmeT]*K% < &L,)AS)AS EE!QK)uuV}***]]#45"EE&M" EE!Q$E '88GFH56 6699WVXzBC CC99WVXzBC CC88GFHkBC CC99WVX{LQR RRyy!:; ;; EE'&(+tE <yy!:; ;; EE!Q$E 388GFH56 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 |rgngk(sJtddgd d gD]\} } |j||d| | | |j ||dsJ|j ||dsJ|j||dsJ|j ||dd sJ|j ||drJ|j ||d||d||dgd |j|d |rgngk(sJ|j||d| | | d|j ||dsJ|j ||dsJ|j ||drJ|j ||drJ|j ||d||dgd |j|d |rgngk(rJy)Nr FTr r *r r1r2r3Tr/Fr-**r4r5) rrrrrrrr8r7) rrrrrrrrr r:r<globr0s r$test_copy_glob_to_existing_directoryz6AbstractCopyTests.test_copy_glob_to_existing_directorysZ/ )FG,E HHUOxx)= L , &A EE'&(C0! 499WVZ89 9999WVZ89 99xx <= ==yyl!KL LLyy!:; ;; EEFJ/FJ/  555.0ug  $'T{T5M#B& igfh5qINyy!<===yy!<===xx <===yyl!KLLL99WVX%>??? 3 3 4 # uuVEu24B5' FHd3Q)VWyy!<===yy!<===99WV[%ABBB99WVX%>??? 3 3# uuVEu24B5'I& /= 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)NrDr#r r rEr r1r2r3Tr/rFFr4r5)rrrrrrr7) rrrrrrrr:r<rGr0s rtest_copy_glob_to_new_directoryz1AbstractCopyTests.test_copy_glob_to_new_directoryEsi/ ), @L)AS EE'&(C0! 488GFH56 6699WVXzBC CC99WVXzBC CCyy;!GH HHyy; !UV VVyy!:; ;;yy8!DE EE EE'&(+tE <yy!:; ;;$'T{T5M#B @igfh5qINxx 9:::yy:!FGGGyy:!FGGGxx+ FGGGyy; !UVVV99WVX%>???99WVXx%HIIIgfh/4@99WVX%>???FHd3Q)VWxx 9:::yy:!FGGGyy:!FGGG99WVX{%KLLL99WVX%>???99WVXx%HIIIgfh/4@99WVX%>???3 @', @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 r5r/)rrcopyfindsortedrrA)rpathr0r6expectedrrfs_glob_edge_cases_filesrfs_sanitize_pathrrnew_dirr:r<outputpprefixed_expecteds rtest_copy_glob_edge_casesz+AbstractCopyTests.test_copy_glob_edge_cases|s("*%,dE]T5M%J  !G\ HHV -4)&A'CQA GGGFD)1 HG UWWV_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 |rgngk(rJy) Nr file1r r r rDr Tr/Fr-)rrrrrrr8) rrrrrrrrr source_filesr:r<s r-test_copy_list_of_files_to_existing_directoryz?AbstractCopyTests.test_copy_list_of_files_to_existing_directorysI/ )FG,E HHUOxx FG $ FG $ FHj 1 * L , &A EE, "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$)rrrrrrrr\s r(test_copy_list_of_files_to_new_directoryz:AbstractCopyTests.test_copy_list_of_files_to_new_directorys/  FG $ FG $ FHj 1 lGFH5;<xx1222yy7;<<<yy7;<<<yy:>???r!c|}|}|j|rJ|j||d||dg||j|sJ|j||dsJ|j||dsJy)Nr[r )rrrrr%s r!test_copy_two_files_new_directoryz3AbstractCopyTests.test_copy_two_files_new_directorys /99V$$$ wvw')ABFKxxyy1222yy1222r!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 Tr/z subfile.txtz subdir.txtzsubdir*)rrrr8rr)rrrr%fs_dir_and_file_with_same_name_prefixrrrs r7test_copy_directory_without_files_with_same_name_prefixzIAbstractCopyTests.test_copy_directory_without_files_with_same_name_prefixs7 gfh'4@yy788899WV\:;;; wv}-./ %55=B& &&yy( (( gfi(&DAxx1222yy=ABBByy6777r!c|}|}g}g}tdD]i} tt| jdj } |j ||| d|j ||| dk|j ||tdD]5} |j|| jd} | t| k(r5Jy)N zutf-8z.txt)path1path2) rangerstrencode hexdigestappendrNcatdecode) rrrrfs_10_files_with_hashed_namesrrr\destination_filesihashed_i file_contents r-test_copy_with_source_and_destination_as_listz?AbstractCopyTests.test_copy_with_source_and_destination_as_lists/ r IA3q6==12<<>H   8*D0A B C  $ $WVz5F%G H I l*;<r *A66"3A"67>>wGL3q6) )) *r!N)__name__ __module__ __qualname__r r&r)r+r=rBrHrJr?mark parametrizerrYr]r_rardrur!rrr s(*T@ 5* ?Tl3*r!r)hashlibr itertoolsrr?fsspec.tests.abstract.commonrrr{r!rrs >d*d*r!