
    XIg>'                     z    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y)    N)md5LocalFileSystem)AbstractCopyTests)AbstractGetTests)AbstractPutTestsc                      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y)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              #   `   K   | j                  |||      }| |j                  |d       yw)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        [/var/www/html/answerous/venv/lib/python3.12/site-packages/fsspec/tests/abstract/__init__.pyfs_bulk_operations_scenario_0z2BaseAbstractFixtures.fs_bulk_operations_scenario_0   s1      11"gwG
f%   ,.c              #   `   K   | j                  |||      }| |j                  |d       yw)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   s1      ,,R'B
f%r   c              #   `   K   | j                  |||      }| |j                  |d       yw)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)   s1      99"gwO
f%r   c              #   `   K   | j                  |||      }| |j                  |d       yw)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   s1      11"gwG
f%r   c              #   p   K    ||d      }| |j                  |      r|j                  |d       yyw)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)    46c              #   `   K   | j                  |||      }| |j                  |d       yw)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   s1      11(J
SFd+r   c              #   `   K   | j                  |||      }| |j                  |d       yw)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   s1      ,,Xz:NFd+r   c              #   `   K   | j                  |||      }| |j                  |d       yw)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   s6      99j*
 Fd+r   c              #   `   K   | j                  |||      }| |j                  |d       yw)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   s1      11(J
SFd+r   c              #   p   K    ||d      }| |j                  |      r|j                  |d       yyw)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/   r0   r'   s        r   local_targetz!BaseAbstractFixtures.local_target   s:      J1??6"KK$K/ #r+   c                 t    ||d      }|j                   ||d             |j                   ||d             t        d      D ]p  } ||d|       } ||d      }|j                  |       |j                   ||d             |j                   ||d             |j                   ||d	             r |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/i01i01( 	>Jv
|'<=F!&+6IY'MM)FJ78MM)FJ78MM)I|<=	>     c                 N    ||d      } ||d      } ||d      }|j                  |       |j                   ||d             |j                   ||d             |j                   ||d             |j                   ||d             |j                   ||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@   rA   rB   rE   rC   )r   rF   rG   rH   r   r>   r?   s          r   r   z0BaseAbstractFixtures._bulk_operations_scenario_0   s     9h/68,fk2	#i01i01i
34i
34i	<89rJ   c                      ||d      } ||d      } ||d      } ||d      }|j                  |       |j                  |       |j                  |       |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.txtrL   )r   rF   rG   rH   r   r>   filesubfiles           r   r    z8BaseAbstractFixtures._dir_and_file_with_same_name_prefix   s_     9h/68,.FM2 dgrJ   c                      ||d      }t        d      D ]b  }t        t        |      j                  d            j	                         } ||| d      }|j                  || j                  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)rD   r   strencode	hexdigestpipe)r   rF   rG   rH   r   ihashed_irR   s           r   r$   z0BaseAbstractFixtures._10_files_with_hashed_names   sz     9h/r 	BA3q6==12<<>HVz%67DLLdQC--*@LA	B rJ   N)__name__
__module____qualname____doc__pytestfixturer   r   r!   r%   r*   r1   r3   r5   r7   r9   r   r   r    r$    rJ   r   r
   r
      s    ^^& & ^^& & ^^	& 	& ^^	& 	& ^^	* 	* ^^, , ^^, , ^^, , ^^	, 	, ^^	0 	0B2&rJ   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y)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XrJ   c                 6    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.
        osrR   joinrg   s    r   r   zAbstractFixtures.fs_join   s     ww||rJ   c                     t        d      rd   re   rg   s    r   r   zAbstractFixtures.fs_path   rh   rJ   class)scopec                     t        d      S )NT)
auto_mkdirr   rg   s    r   r.   zAbstractFixtures.local_fs  s     $//rJ   c                 6    t         j                  j                  S )zs
        Return a function that joins its arguments together into a path, on
        the local filesystem.
        rj   rg   s    r   r/   zAbstractFixtures.local_join
  s     ww||rJ   c                     |S Nr`   )r   tmpdirs     r   r0   zAbstractFixtures.local_path  s    rJ   c                      y)zP
        Return whether this implementation supports empty directories.
        Tr`   rg   s    r   supports_empty_directoriesz+AbstractFixtures.supports_empty_directories  s    
 rJ   c                     d S )Nc                     | S rt   r`   )xs    r   <lambda>z3AbstractFixtures.fs_sanitize_path.<locals>.<lambda>  s     rJ   r`   rg   s    r   fs_sanitize_pathz!AbstractFixtures.fs_sanitize_path  s    rJ   N)rZ   r[   r\   r]   r^   r_   r   r   r   r.   r/   r0   rw   r|   r`   rJ   r   rb   rb      s     ^^Y Y ^^  ^^Y Y V^^'"0 #0
 ^^  ^^  ^^  ^^ rJ   rb   )rk   hashlibr   r^   fsspec.implementations.localr   fsspec.tests.abstract.copyr   fsspec.tests.abstract.getr   fsspec.tests.abstract.putr   r
   rb   r`   rJ   r   <module>r      s4    	   8 8 6 6Y Yx7+ 7rJ   