← back to Atmos Game

assets/gen/.venv/lib/python3.12/site-packages/fsspec/tests/abstract/__pycache__/put.cpython-312.pyc

100 lines

�

c�bj�R��D�ddlmZddlmZddlZddlmZGd�d�Zy)�)�md5)�productN)�GLOB_EDGE_CASES_TESTSc��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
ejjed	ed
�d��Zd�Zd
�Zd�Zd�Zd�Zy)�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	|
�sJ�y)N�dummy�file2�subfile1�subdir�/)�mkdir�touch�isdir�put�isfile�rm�exists)�self�fs�fs_join�	fs_target�
local_join� local_bulk_operations_scenario_0�supports_empty_directories�source�target�target_file2�target_subfile1s           �p/Users/macstudio3/Projects/atmos-game/assets/gen/.venv/lib/python3.12/site-packages/fsspec/tests/abstract/put.py�#test_put_file_to_existing_directoryz4AbstractPutTests.test_put_file_to_existing_directory
sQ��2����
�����)��H�H�W�V�W�-�.��x�x������v�w�/��!�&�*�5��	���z�&�'�*�F�3��y�y��&�&�&�	���z�&�(�J�7��@��y�y��)�)�)�	���|�_�-�.��9�9�\�*�*�*��9�9�_�-�-�-�	���z�&�'�*�F�S�L�9��x�x������y�y��&�&�&�
���z�&�(�J�7��#��F��y�y��)�)�)�c��|}|}|j|�|j||dd�||d��|j|�sJ�|j||d��sJ�|j||dd��sJ�y)Nrrznewdir/�newdir�rrrr�rrrrrrrrs        r �test_put_file_to_new_directoryz/AbstractPutTests.test_put_file_to_new_directory5s���2����
�����
����v�x��4�g�f�i�6P�	
��x�x������x�x����1�2�2�2��y�y����:�>�?�?�?r"c���|}|}|j|�|s|j||d��|j|�sJ�|j||dd�||d��|j	||d��sJ�y)Nr	rr�newfile)rrrrr)	rrrrrrrrrs	         r �+test_put_file_to_file_in_existing_directoryz<AbstractPutTests.test_put_file_to_file_in_existing_directoryEsy��2����
�����)��H�H�W�V�W�-�.��x�x�����
���z�&�(�J�7����9S�T��y�y����3�4�4�4r"c���|}|}|j|�|j||dd�||dd��|j||d��sJ�|j||dd��sJ�y)Nrrr$r)r%r&s        r �&test_put_file_to_file_in_new_directoryz7AbstractPutTests.test_put_file_to_file_in_new_directory[st��2����
�����
����v�x��4��F�H�i�0�	
��x�x����1�2�2�2��y�y����9�=�>�>�>r"c	���|}|}|j|�|s||d�}|j|�|j|�sJ�tddgddg�D�]\}	}
||d�}|	r|dz
}|
r|dzn|}|j	||�|j|d��|rgngk(sJ�|j	||d��|	r�|j
||d��sJ�|j
||d	��sJ�|j||d
��sJ�|j
||d
d��sJ�|j||d��rJ�|j||d�||d	�||d
�gd��n�|j||d��sJ�|j
||dd��sJ�|j
||dd	��sJ�|j||dd
��sJ�|j
||dd
d��sJ�|j||d�d��|j|d��|rgngk(sJ�|j	||dd�
�|	r�|j
||d��sJ�|j
||d	��sJ�|j||d
��rJ�|j||d��rJ�|j||d�||d	�gd��n�|j||d��sJ�|j
||dd��sJ�|j
||dd	��sJ�|j||dd
��rJ�|j||d�d��|j|d��|rgngk(r��J�y)Nr	FTrr
��detail��	recursiver�subfile2�	nesteddir�
nestedfile��r1�maxdepth)	rrr�zipr�lsrrr)
rrrrrrrrr	�source_slash�target_slash�s�ts
             r �(test_put_directory_to_existing_directoryz9AbstractPutTests.test_put_directory_to_existing_directoryks���2����
�����)��F�G�,�E��H�H�U�O��x�x�����*-�u�d�m�e�T�]�*K�&�L�,����)�A���S��� ,����&�A�
�F�F�1�a�L��5�5���5�.�0��u�g��
��

�F�F�1�a�4�F�(���y�y����!<�=�=�=��y�y����!<�=�=�=��x�x���� <�=�=�=��y�y����l�!K�L�L�L��9�9�W�V�X�%>�?�?�?������
�3���
�3����4��
#�
���x�x���� 9�:�:�:��y�y����:�!F�G�G�G��y�y����:�!F�G�G�G��x�x����+� F�G�G�G��y�y����;��!U�V�V�V����g�f�h�/�4��@��5�5���5�.�0��u�g��
��

�F�F�1�a�4�!�F�4���y�y����!<�=�=�=��y�y����!<�=�=�=��9�9�W�V�[�%A�B�B�B��9�9�W�V�X�%>�?�?�?������
�3���
�3��#����x�x���� 9�:�:�:��y�y����:�!F�G�G�G��y�y����:�!F�G�G�G��9�9�W�V�X�{�%K�L�L�L����g�f�h�/�4��@��5�5���5�.�0��u�g��
��+Lr"c	���|}|}|j|�tddgddg�D�]:\}}	||d�}
|r|
dz
}
||d�}|	r|dz
}|j|
|�|r|j|�gk(s5J�t	j
t�5|j|�ddd�|j|
|d��|j||d��sJ�|j||dd��sJ�|j||dd��sJ�|j||dd	��sJ�|j||dd	d
��sJ�|j||d��rJ�|j||d�d��|j||d��rJ�|j|
|dd��|j||d��sJ�|j||dd��sJ�|j||dd��sJ�|j||dd	��rJ�|j||d��rJ�|j||d�d��|j||d��s��;J�y#1swY���xYw)
NFTrr
r$r0rr2r3r4r5r6)rr8rr9�pytest�raises�FileNotFoundErrorrrrr)rrrrrrrrr:r;r<r=s            r �#test_put_directory_to_new_directoryz4AbstractPutTests.test_put_directory_to_new_directory�se��2����
�����*-�u�d�m�e�T�]�*K�&�L�,����)�A���S������)�A���S���
�F�F�1�a�L�)��u�u�V�}��*�*�*��]�]�#4�5��E�E�&�M�6�
�F�F�1�a�4�F�(��8�8�G�F�H�5�6�6�6��9�9�W�V�X�z�B�C�C�C��9�9�W�V�X�z�B�C�C�C��8�8�G�F�H�k�B�C�C�C��9�9�W�V�X�{�L�Q�R�R�R��y�y����!:�;�;�;��E�E�'�&�(�+�t�E�<��y�y����!:�;�;�;�
�F�F�1�a�4�!�F�4��8�8�G�F�H�5�6�6�6��9�9�W�V�X�z�B�C�C�C��9�9�W�V�X�z�B�C�C�C��y�y����;�!G�H�H�H��y�y����!:�;�;�;��E�E�'�&�(�+�t�E�<��y�y����!:�;�;�;�K+L�6�5�s�I%�%I/	c
���|}|}|j|�|s||d�}	|j|	�|j|�sJ�dD�]�}
|
r|dzn|}|j||dd�|�|j	||d��sJ�|j	||d��sJ�|j||d��rJ�|j||dd	��rJ�|j||d��rJ�|j
||d�||d�gd
��|j|d�
�|rgn	gk(sJ�tddgd
dg�D�]�\}}
|j||d|�||
��|j	||d��sJ�|j	||d��sJ�|j||d��sJ�|j	||dd	��sJ�|j||d��rJ�|j
||d�||d�||d�gd
��|j|d�
�|rgn	gk(sJ�|j||d|�||
d��|j	||d��sJ�|j	||d��sJ�|j||d��rJ�|j||d��rJ�|j
||d�||d�gd
��|j|d�
�|rgn	gk(r���J����y)Nr	�FTr
r�*rr2r3r4Tr0Fr.�**r5r6)	rrrrrrrr9r8)rrrrrrrrrr	r;r=�globr1s              r �#test_put_glob_to_existing_directoryz4AbstractPutTests.test_put_glob_to_existing_directory�sS��2����
�����)��F�G�,�E��H�H�U�O��x�x�����)�L� ,����&�A�
�F�F�:�f�h��4�a�8��9�9�W�V�Z�8�9�9�9��9�9�W�V�Z�8�9�9�9��x�x���� <�=�=�=��y�y����l�!K�L�L�L��y�y����!:�;�;�;��E�E��F�J�/��F�J�/���
�
��5�5���5�.�0��u�g��
��
$'��T�{�T�5�M�#B���i����z�&�(�D�9�1�	��R��y�y����!<�=�=�=��y�y����!<�=�=�=��x�x���� <�=�=�=��y�y����l�!K�L�L�L��9�9�W�V�X�%>�?�?�?������
�3���
�3����4��
#�
���u�u�V�E�u�2�4�B�5�'����
����v�x��6��'��	���y�y����!<�=�=�=��y�y����!<�=�=�=��9�9�W�V�[�%A�B�B�B��9�9�W�V�X�%>�?�?�?������
�3���
�3��#����u�u�V�E�u�2�4�B�5�'����O$C�/*r"c
��|}|}|j|�dD�]4}||d�}	|r|	dz
}	|j||dd�|	�|j||d��sJ�|j||dd��sJ�|j||dd��sJ�|j	||dd��rJ�|j	||ddd	��rJ�|j	||d��rJ�|j	||dd��rJ�|j||d�d
��|j	||d��rJ�t
ddgd
d
g�D�]\}
}|j||d|
�|	|��|j||d��sJ�|j||dd��sJ�|j||dd��sJ�|j||dd��sJ�|j||ddd	��sJ�|j	||d��rJ�|j	||dd��rJ�|j||d�d
��|j	||d��rJ�|j||d|
�|	|d��|j||d��sJ�|j||dd��sJ�|j||dd��sJ�|j	||dd��rJ�|j	||d��rJ�|j	||dd��rJ�|j||d�d
��|j	||d��s��J���7y)NrEr$r
rrFrr2r3r4Tr0rGFr5r6)rrrrrrr8)rrrrrrrrr;r=rHr1s            r �test_put_glob_to_new_directoryz/AbstractPutTests.test_put_glob_to_new_directoryLs^��2����
�����)�L����)�A���S���
�F�F�:�f�h��4�a�8��8�8�G�F�H�5�6�6�6��9�9�W�V�X�z�B�C�C�C��9�9�W�V�X�z�B�C�C�C��y�y����;�!G�H�H�H��y�y����;��!U�V�V�V��y�y����!:�;�;�;��y�y����8�!D�E�E�E��E�E�'�&�(�+�t�E�<��y�y����!:�;�;�;�$'��T�{�T�5�M�#B���i����z�&�(�D�9�1�	��R��x�x���� 9�:�:�:��y�y����:�!F�G�G�G��y�y����:�!F�G�G�G��x�x����+� F�G�G�G��y�y����;��!U�V�V�V��9�9�W�V�X�%>�?�?�?��9�9�W�V�X�x�%H�I�I�I����g�f�h�/�4��@��9�9�W�V�X�%>�?�?�?�����v�x��6��'��	���x�x���� 9�:�:�:��y�y����:�!F�G�G�G��y�y����:�!F�G�G�G��9�9�W�V�X�{�%K�L�L�L��9�9�W�V�X�%>�?�?�?��9�9�W�V�X�x�%H�I�I�I����g�f�h�/�4��@��9�9�W�V�X�%>�?�?�?�9$C�'*r"�argnames�	argvaluesc���|}|}tddgddg�D]�\}
}|j|�|
r	||d�n|}|r|dzn|}|j|	||�|||��|j|�}|
r|D�cgc]}|
||d|����}}n|D�cgc]}|
|||����}}t	|�t	|�k(sJ�	|j|d����ycc}wcc}w#t$rY��wxYw)NTFr$r
r6r0)rrr�find�sortedrrB)r�pathr1r7�expectedrrr�local_glob_edge_cases_filesr�fs_sanitize_pathrr�new_dirr;r=�output�p�prefixed_expecteds                   r �test_put_glob_edge_casesz)AbstractPutTests.test_put_glob_edge_cases�s&��$-����%,�d�E�]�T�5�M�%J�!�G�\��H�H�V��-4����)�&�A�'��C��Q�A��F�F�:�f�d�+�Q�)�h�F�W��W�W�V�_�F��LT�%�LT�q�$�W�V�X�q�%A�B�H�"�%�
CK�%�BJ�Q�$�W�V�Q�%7�8�(�"�%��&�>�V�,=�%>�>�>�>�
����f���-�)&K��%��%��%�
��
�s�5C�C �C%�%	C1�0C1c	�2�|}|}|j|�|s||d�}	|j|	�|j|�sJ�||d�||d�||dd�g}
dD]�}|r|dzn|}|j|
|�|j	||d��sJ�|j	||d��sJ�|j	||d��sJ�|j||d�||d�||d�gd�	�|j
|d
��|rgn	gk(r��J�y)Nr	�file1r
rrrEr
Tr0Fr.)rrrrrrr9)
rrrrrrrrrr	�source_filesr;r=s
             r �,test_put_list_of_files_to_existing_directoryz=AbstractPutTests.test_put_list_of_files_to_existing_directory�sD��2����
�����)��F�G�,�E��H�H�U�O��x�x�����
�v�w�'��v�w�'��v�x��4�
��*�L� ,����&�A��F�F�<��#��9�9�W�V�W�5�6�6�6��9�9�W�V�W�5�6�6�6��9�9�W�V�Z�8�9�9�9��E�E��F�G�,��F�G�,��F�J�/��
�

�
��5�5���5�.�0��u�g��
��!*r"c�r�|}|}|j|�||d�||d�||dd�g}|j|||d�dz�|j||d��sJ�|j||dd��sJ�|j||dd��sJ�|j||dd��sJ�y)Nr[r
rrr$r
r%)	rrrrrrrrr\s	         r �'test_put_list_of_files_to_new_directoryz8AbstractPutTests.test_put_list_of_files_to_new_directory�s���2����
�����
�v�w�'��v�w�'��v�x��4�
��	���|�W�V�X�6��<�=��x�x����1�2�2�2��y�y����7�;�<�<�<��y�y����7�;�<�<�<��y�y����:�>�?�?�?r"c�>�||d�}||d�}|j|�|j|�|}	|j|	�rJ�td�D]�}
|j	||	d��|j|	�sJ�|
dk(r5|j
||	d��sJ�|j||	d��s�bJ�|j
||	d��sJ�|j||	d��sJ�|j
||	dd��r��J�|j|	d��|j|	�rJ�td�D]`}
|j	|dz|	d��|j|	�sJ�|j
||	d��sJ�|j||	d��s�`J�y)N�src�file�Tr0rr
)rrr�rangerrrr)rrrr�local_fsr�
local_pathra�src_filer�loops           r �test_put_directory_recursivez-AbstractPutTests.test_put_directory_recursive�s���
��U�+���c�6�*�����s�����x� ����9�9�V�$�$�$��!�H�D��F�F�3��$�F�/��8�8�F�#�#�#��q�y��y�y����!8�9�9�9��9�9�W�V�U�%;�<�<�<��y�y����!8�9�9�9��x�x���� 6�7�7�7��y�y�����!?�@�@�@��	���f���%��9�9�V�$�$�$��!�H�D��F�F�3��9�f��F�5��8�8�F�#�#�#��9�9�W�V�V�4�5�5�5��y�y����!7�8�8�8�	r"c��|}|}|j||d�|d��|j||d��sJ�|j||d��rJ�|j||d�g�|r|j|�gk(sJ�|j	|�rJ�|j||d�|d��|j||d��sJ�|j||dd��sJ�|j||d��sJ�y)NrTr0zsubfile.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�$��G��y�y���M�:�;�;�;��9�9�W�Y��=�>�>�>�
���w�v�}�-�.�/�%��5�5��=�B�&�&�&��y�y��(�(�(�	���z�&�)�,�i�4��H��x�x��	�8�4�5�5�5��y�y���H�m�D�E�E�E��y�y���L�9�:�:�:r"c��|}|}g}g}	td�D]i}
tt|
�jd��j	�}|j|||�d���|	j|||�d����k|j
||	��td�D]5}
|j|	|
�jd�}|t|
�k(r�5J�y)N�
zutf-8z.txt)�lpath�rpath)	rdr�str�encode�	hexdigest�appendr�cat�decode)
rrrrr� local_10_files_with_hashed_namesrrr\�destination_files�i�hashed_i�file_contents
             r �-test_copy_with_source_and_destination_as_listz>AbstractPutTests.test_copy_with_source_and_destination_as_list;s���2���������r��A��3�q�6�=�=��1�2�<�<�>�H����
�6�h�Z�t�3D� E�F��$�$�W�V��z��5F�%G�H��	���\�):��;��r��A��6�6�"3�A�"6�7�>�>�w�G�L��3�q�6�)�)�)�r"N)�__name__�
__module__�__qualname__r!r'r*r,r>rCrIrKr@�mark�parametrizerrYr]r_rirlr|�r"r rr	s���)*�V@� 5�,?� T�l3<�jT�l8@�t�[�[����j�)��k�*��(�	�(�T,�\@�*"9�H;�@*r"r)�hashlibr�	itertoolsrr@�fsspec.tests.abstract.commonrrr�r"r �<module>r�s����
�>�F	*�F	*r"