
    çg>'                         d dl Z d dlmZ d dlZd dlmZ d dlmZ d dlm	Z	 d dl
mZ  G d d          Z G d	 d
e          ZdS )    N)md5LocalFileSystem)AbstractCopyTests)AbstractGetTests)AbstractPutTestsc                   j   e Zd ZdZej        d             Zej        d             Zej        d             Zej        d             Z	ej        d             Z
ej        d             Zej        d             Zej        d	             Zej        d
             Zej        d             Zd Zd Zd Zd ZdS )BaseAbstractFixturesz
    Abstract base class containing fixtures that are used by but never need to
    be overridden in derived filesystem-specific classes to run the abstract
    tests on such filesystems.
    c              #   n   K   |                      |||          }|V  |                    |d           dS )z
        Scenario on remote filesystem that is used for many cp/get/put tests.

        Cleans up at the end of each test it which it is used.
        T	recursiveN_bulk_operations_scenario_0rmselffsfs_joinfs_pathsources        Z/var/www/html/ai-engine/env/lib/python3.11/site-packages/fsspec/tests/abstract/__init__.pyfs_bulk_operations_scenario_0z2BaseAbstractFixtures.fs_bulk_operations_scenario_0   sD       11"gwGG
f%%%%%    c              #   n   K   |                      |||          }|V  |                    |d           dS )z
        Scenario on remote filesystem that is used for glob edge cases cp/get/put tests.

        Cleans up at the end of each test it which it is used.
        Tr   N_glob_edge_cases_filesr   r   s        r   fs_glob_edge_cases_filesz-BaseAbstractFixtures.fs_glob_edge_cases_files   sD       ,,R'BB
f%%%%%r   c              #   n   K   |                      |||          }|V  |                    |d           dS )z
        Scenario on remote filesystem that is used to check cp/get/put on directory
        and file with the same name prefixes.

        Cleans up at the end of each test it which it is used.
        Tr   N#_dir_and_file_with_same_name_prefixr   r   s        r   %fs_dir_and_file_with_same_name_prefixz:BaseAbstractFixtures.fs_dir_and_file_with_same_name_prefix)   sD       99"gwOO
f%%%%%r   c              #   n   K   |                      |||          }|V  |                    |d           dS )z
        Scenario on remote filesystem that is used to check cp/get/put files order
        when source and destination are lists.

        Cleans up at the end of each test it which it is used.
        Tr   N_10_files_with_hashed_namesr   r   s        r   fs_10_files_with_hashed_namesz2BaseAbstractFixtures.fs_10_files_with_hashed_names5   sD       11"gwGG
f%%%%%r   c              #      K    ||d          }|V  |                     |          r|                    |d           dS dS )z
        Return name of remote directory that does not yet exist to copy into.

        Cleans up at the end of each test it which it is used.
        targetTr   Nexistsr   )r   r   r   r   r'   s        r   	fs_targetzBaseAbstractFixtures.fs_targetA   s\       (++99V 	*EE&DE)))))	* 	*r   c              #   n   K   |                      |||          }|V  |                    |d           dS )z
        Scenario on local filesystem that is used for many cp/get/put tests.

        Cleans up at the end of each test it which it is used.
        Tr   Nr   r   local_fs
local_join
local_pathr   s        r    local_bulk_operations_scenario_0z5BaseAbstractFixtures.local_bulk_operations_scenario_0M   sD       11(J
SSFd+++++r   c              #   n   K   |                      |||          }|V  |                    |d           dS )z
        Scenario on local filesystem that is used for glob edge cases cp/get/put tests.

        Cleans up at the end of each test it which it is used.
        Tr   Nr   r,   s        r   local_glob_edge_cases_filesz0BaseAbstractFixtures.local_glob_edge_cases_filesX   sD       ,,Xz:NNFd+++++r   c              #   n   K   |                      |||          }|V  |                    |d           dS )z
        Scenario on local filesystem that is used to check cp/get/put on directory
        and file with the same name prefixes.

        Cleans up at the end of each test it which it is used.
        Tr   Nr   r,   s        r   (local_dir_and_file_with_same_name_prefixz=BaseAbstractFixtures.local_dir_and_file_with_same_name_prefixc   sK       99j*
 
 Fd+++++r   c              #   n   K   |                      |||          }|V  |                    |d           dS )z
        Scenario on local filesystem that is used to check cp/get/put files order
        when source and destination are lists.

        Cleans up at the end of each test it which it is used.
        Tr   Nr#   r,   s        r    local_10_files_with_hashed_namesz5BaseAbstractFixtures.local_10_files_with_hashed_namess   sD       11(J
SSFd+++++r   c              #      K    ||d          }|V  |                     |          r|                    |d           dS dS )z
        Return name of local directory that does not yet exist to copy into.

        Cleans up at the end of each test it which it is used.
        r'   Tr   Nr(   )r   r-   r.   r/   r'   s        r   local_targetz!BaseAbstractFixtures.local_target   s\       J11??6"" 	0KK$K/////	0 	0r   c                     ||d          }|                      ||d                     |                      ||d                     t          d          D ]} ||d|           } ||d          }|                    |           |                      ||d                     |                      ||d                     |                      ||d	                     |S )
uL  
        Scenario that is used for glob edge cases cp/get/put tests.
        Creates the following directory and file structure:

        📁 source
        ├── 📄 file1
        ├── 📄 file2
        ├── 📁 subdir0
        │   ├── 📄 subfile1
        │   ├── 📄 subfile2
        │   └── 📁 nesteddir
        │       └── 📄 nestedfile
        └── 📁 subdir1
            ├── 📄 subfile1
            ├── 📄 subfile2
            └── 📁 nesteddir
                └── 📄 nestedfile
        r   file1file2   subdir	nesteddirsubfile1subfile2
nestedfile)touchrangemakedirs)r   some_fs	some_join	some_pathr   
subdir_idxr=   r>   s           r   r   z+BaseAbstractFixtures._glob_edge_cases_files   s   & 9h//ii00111ii00111(( 	> 	>JYv'<
'<'<==F!	&+66IY'''MM))FJ77888MM))FJ77888MM))I|<<====r   c                     ||d          } ||d          } ||d          }|                     |           |                     ||d                     |                     ||d                     |                     ||d                     |                     ||d                     |                     ||d                     |S )	u  
        Scenario that is used for many cp/get/put tests. Creates the following
        directory and file structure:

        📁 source
        ├── 📄 file1
        ├── 📄 file2
        └── 📁 subdir
            ├── 📄 subfile1
            ├── 📄 subfile2
            └── 📁 nesteddir
                └── 📄 nestedfile
        r   r=   r>   r:   r;   r?   r@   rA   rD   rB   )r   rE   rF   rG   r   r=   r>   s          r   r   z0BaseAbstractFixtures._bulk_operations_scenario_0   s     9h//68,,Ifk22	###ii00111ii00111ii
33444ii
33444ii	<88999r   c                      ||d          } ||d          } ||d          } ||d          }|                     |           |                    |           |                    |           |S )u&  
        Scenario that is used to check cp/get/put on directory and file with
        the same name prefixes. Creates the following directory and file structure:

        📁 source
        ├── 📄 subdir.txt
        └── 📁 subdir
            └── 📄 subfile.txt
        r   r=   z
subdir.txtzsubfile.txtrJ   )r   rE   rF   rG   r   r=   filesubfiles           r   r    z8BaseAbstractFixtures._dir_and_file_with_same_name_prefix   s     9h//68,,y..)FM22   dgr   c                 8    ||d          }t          d          D ]}}t          t          |                              d                                                    } ||| d          }|                    ||                     d                     ~|S )u   
        Scenario that is used to check cp/get/put files order when source and
        destination are lists. Creates the following directory and file structure:

        📁 source
        └── 📄 {hashed([0-9])}.txt
        r   
   zutf-8z.txt)pathvalue)rC   r   strencode	hexdigestpipe)r   rE   rF   rG   r   ihashed_irP   s           r   r$   z0BaseAbstractFixtures._10_files_with_hashed_names   s     9h//r 	B 	BA3q66==1122<<>>H9V%6%6%677DLLdQ&--*@*@LAAAAr   N)__name__
__module____qualname____doc__pytestfixturer   r   r!   r%   r*   r0   r2   r4   r6   r8   r   r   r    r$    r   r   r
   r
      s}         ^& & ^& ^& & ^& ^	& 	& ^	& ^	& 	& ^	& ^	* 	* ^	* ^, , ^, ^, , ^, ^, , ^, ^	, 	, ^	, ^	0 	0 ^	0  B  2  &    r   r
   c                   &   e Zd ZdZej        d             Zej        d             Zej        d             Z ej        d          d             Z	ej        d             Z
ej        d	             Zej        d
             Zej        d             ZdS )AbstractFixturesa}  
    Abstract base class containing fixtures that may be overridden in derived
    filesystem-specific classes to run the abstract tests on such filesystems.

    For any particular filesystem some of these fixtures must be overridden,
    such as ``fs`` and ``fs_path``, and others may be overridden if the
    default functions here are not appropriate, such as ``fs_join``.
    c                      t          d          Nz3This function must be overridden in derived classesNotImplementedErrorr   s    r   r   zAbstractFixtures.fs       !"WXXXr   c                 $    t           j        j        S )z
        Return a function that joins its arguments together into a path.

        Most fsspec implementations join paths in a platform-dependent way,
        but some will override this to always use a forward slash.
        osrP   joinre   s    r   r   zAbstractFixtures.fs_join   s     w|r   c                      t          d          rb   rc   re   s    r   r   zAbstractFixtures.fs_path   rf   r   class)scopec                 "    t          d          S )NT)
auto_mkdirr   re   s    r   r-   zAbstractFixtures.local_fs  s     $////r   c                 $    t           j        j        S )zs
        Return a function that joins its arguments together into a path, on
        the local filesystem.
        rh   re   s    r   r.   zAbstractFixtures.local_join
  s     w|r   c                     |S Nr^   )r   tmpdirs     r   r/   zAbstractFixtures.local_path  s    r   c                     dS )zP
        Return whether this implementation supports empty directories.
        Tr^   re   s    r   supports_empty_directoriesz+AbstractFixtures.supports_empty_directories  s	    
 tr   c                     d S )Nc                     | S rr   r^   )xs    r   <lambda>z3AbstractFixtures.fs_sanitize_path.<locals>.<lambda>  s     r   r^   re   s    r   fs_sanitize_pathz!AbstractFixtures.fs_sanitize_path  s
    {r   N)rX   rY   rZ   r[   r\   r]   r   r   r   r-   r.   r/   ru   rz   r^   r   r   r`   r`      s         ^Y Y ^Y ^  ^ ^Y Y ^Y V^'"""0 0 #"0
 ^  ^ ^  ^ ^  ^ ^  ^  r   r`   )ri   hashlibr   r\   fsspec.implementations.localr   fsspec.tests.abstract.copyr   fsspec.tests.abstract.getr   fsspec.tests.abstract.putr   r
   r`   r^   r   r   <module>r      s    				        8 8 8 8 8 8 8 8 8 8 8 8 6 6 6 6 6 6 6 6 6 6 6 6Y Y Y Y Y Y Y Yx7 7 7 7 7+ 7 7 7 7 7r   