L iQPddlmZddlmZddlZddlmZddlmZGddZ y))md5)productN)make_path_posix)GLOB_EDGE_CASES_TESTSceZdZdZdZdZdZdZdZdZ dZ e jjed ed d Zd Zd ZdZdZdZy)AbstractGetTestsc|}|}|j||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)Nfile2subfile1subdir/)mkdirisdirgetisfilermexists) selffsfs_joinfs_bulk_operations_scenario_0local_fs local_join local_targetsourcetarget target_file2target_subfile1s _/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/fsspec/tests/abstract/get.py#test_get_file_to_existing_directoryz4AbstractGetTests.test_get_file_to_existing_directory s;/v~~f%%%!&'2 $VZ8 wvw'0|,,, wvx4f=///  \?34??<000???333 wvw'#6~~f%%%|,,, wvx4fslC///c|}|}|j||j||dd||d|j|sJ|j||dsJ|j||ddsJy)Nr r znewdir/newdirrrrr rrrrrrrrrs rtest_get_file_to_new_directoryz/AbstractGetTests.test_get_file_to_new_directory3s/v  FHj 1:fi3P ~~f%%%~~j:;;;z&(JGHHHr!c|}|}|j||j||dd||d|j||dsJy)Nr r newfile)rrrr%s r+test_get_file_to_file_in_existing_directoryz>*VX">? ????:fh #KL LL??:fh #KL LL>>*VX{"KL LL??68[,G  z&('CD DD KK 684K E;;v&", ,, FF1a4!F 4>>*VX">? ????:fh #KL LL??:fh #KL LLz&(K'PQ QQz&('CD DD KK 684K Ez&('CD DDG# Er!c n|}|}|j|dD]} | r|dzn|} |j||dd| |j||dsJ|j||dsJ|j||drJ|j ||ddrJ|j ||drJ|j ||d||dgd |j |gk(sJtdd gd d gD]\} } |j||d| | | |j||dsJ|j||dsJ|j||dsJ|j||ddsJ|j ||drJ|j ||d||d||dgd |j |gk(sJ|j||d| | | d |j||dsJ|j||dsJ|j ||drJ|j ||drJ|j ||d||dgd |j |gk(rJy)NFTr r *r r/r0r1Tr-**Fr2r3)rrrrrrr6r5 rrrrrrrrrr9r;globr.s r#test_get_glob_to_existing_directoryz4AbstractGetTests.test_get_glob_to_existing_directorys/v)7 1L , &A FF768S11 5??:fj#AB BB??:fj#AB BB~~j&EF FFz&+|'TU UUz&('CD DD KKvz2vz2  ;;v&", ,,$'T{T5M#B" 1iwvx6YOz&*'EFFFz&*'EFFF~~j&EFFFz&+|'TUUU#??:fh+GHHH "6:6"6:6"6;7 #  {{6*b000FHd3Q)VW z&*'EFFFz&*'EFFF#??:fk+JKKK#??:fh+GHHH "6:6"6:6#  {{6*b000E" 1+7 1r!c |}|}|j|dD]:} ||d} | r| dz } |j||dd| |j||dsJ|j||ddsJ|j||ddsJ|j ||ddrJ|j ||ddd rJ|j ||drJ|j ||ddrJ|j ||dd |j |gk(sJtdd 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 |j |d d |j ||dsJ=y)Nr@r#r r rAr r/r0r1Tr-rBFr2r3)detail)rrrrrrr6r5rCs rtest_get_glob_to_new_directoryz/AbstractGetTests.test_get_glob_to_new_directory=s/v)0 IL)AS FF768S11 5>>*VX">? ????:fh #KL LL??:fh #KL LLz&(K'PQ QQ68[,G  z&('CD DDz&(H'MN NN KK 684K E;;v&", ,,$'T{T5M#B Iiwvx6YO~~j&BCCCz&(J'OPPPz&(J'OPPP~~j;&OPPPvxlK$??:fh+GHHH#??:fh+QRRR Jvx8D I#??:fh+GHHHFHd3Q)VW ~~j&BCCCz&(J'OPPPz&(J'OPPP#??:fh +TUUU#??:fh+GHHH#??:fh+QRRR HKKuK= N#??:fh+GHHH7 I+0 Ir!argnames argvaluesc |} | } tddgddgD]\} }|j| | r | | dn| }|r|dzn|}|j|| |||||j| }| r!|Dcgc]}t | | d|}}n|Dcgc]}t | | |}}t |t |k(sJ |j | dycc}wcc}w#t$rYwxYw)NTFr#r r3r-)rrrfindrsortedrFileNotFoundError)rpathr.r4expectedrrfs_glob_edge_cases_filesrrrrrnew_dirr9r;outputpprefixed_expecteds rtest_get_glob_edge_casesz)AbstractGetTests.test_get_glob_edge_cases~s'$*%,dE]T5M%J  !G\ NN6 "07 68,VA'CQA FF764(!y8F T]]6*FNV%IJOJvx$CD%!% EM%?@OJvq$9:%!%&>V,=%>> >>  Fd 3) %%%  s5C!C& C++ C76C7c |}|}|j|||d||d||ddg} dD]} | r|dzn|} |j| | |j||dsJ|j||dsJ|j||dsJ|j||d||d||dgd|j |gk(rJy) Nfile1r r r r@r Tr-)rrrrr6) rrrrrrrrr source_filesr9r;s r,test_get_list_of_files_to_existing_directoryz=AbstractGetTests.test_get_list_of_files_to_existing_directorys /v FG $ FG $ FHj 1 * -L , &A FF< #??:fg#>? ????:fg#>? ????:fj#AB BB KKvw/vw/vz2   ;;v&", ,,! -r!cr|}|}|j|||d||d||ddg} |j| ||ddz|j||dsJ|j||ddsJ|j||ddsJ|j||ddsJy)NrXr r r r#r r$) rrrrrrrrrrYs r'test_get_list_of_files_to_new_directoryz8AbstractGetTests.test_get_list_of_files_to_new_directorys/v FG $ FG $ FHj 1 |Z9C?@~~j:;;;z&(GDEEEz&(GDEEEz&(JGHHHr!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)NsrcfileTr-rr )rtouchrrangerrrr) rrrfs_pathrrrr^src_filerloops rtest_get_directory_recursivez-AbstractGetTests.test_get_directory_recursives gu%3'   ??6***!H JD FF3$F />>&) ))qyz&&'ABBB#??:fe+DEEEz&&'ABBB~~j&?@@@z&%'HIII J  Fd +??6***!H BD FF39fF 5>>&) ))??:ff#=> >>z&%'@A AA  Br!c|}|}|j||d|d|j||dsJ|j||drJ|j||dg|j|gk(sJ|j||d|d|j ||dsJ|j||ddsJ|j||dsJy)Nr Tr-z subfile.txtz subdir.txtzsubdir*)rrrr6r) rrrrrr%fs_dir_and_file_with_same_name_prefixrrs r6test_get_directory_without_files_with_same_name_prefixzGAbstractGetTests.test_get_directory_without_files_with_same_name_prefixs7 wvx(&DAz&-@AAA??:fl#CDDD Z 678{{6"b((( wvy)6TB~~j:;;;z&(MJKKKz&,?@@@r!c |}|}g} g} tdD]r} tt| jdj } | j ||| d| j t ||| dt|j| | tdD]5} |j| | jd} | t| k(r5Jy)N zutf-8z.txt)rpathlpath) rbrstrencode hexdigestappendrrcatdecode)rrrrrrfs_10_files_with_hashed_namesrrrYdestination_filesihashed_i file_contents r,test_get_with_source_and_destination_as_listz=AbstractGetTests.test_get_with_source_and_destination_as_list/s/ r A3q6==12<<>H   8*D0A B C  $ $ 6hZt3D EF   \):;r *A#<<(9!(<=DDWML3q6) )) *r!N)__name__ __module__ __qualname__r r&r)r+r<r>rErHpytestmark parametrizerrVrZr\rfriryr!rrr s&0PI.>$H,M-^2EhF1P?IB [[j)k*( (T%-NI6"BHA:*r!r) hashlibr itertoolsrr}fsspec.implementations.localrfsspec.tests.abstract.commonrrrr!rrs  8>A *A *r!