
    gi'                         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 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)AbstractOpenTests)AbstractPipeTests)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        v/var/www/development/aibuddy-work/election-extract/venv/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_names7   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_targetC   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_0O   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_filesZ   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_prefixe   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_namesu   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/   r0   r1   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=   rA   rB   rC   rF   rD   )r   rG   rH   rI   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.txtrL   )r   rG   rH   rI   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                 6    ||d          }t          d          D ]|}t          t          |                              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)rE   r   strencode	hexdigestpipe)r   rG   rH   rI   r   ihashed_irR   s           r   r&   z0BaseAbstractFixtures._10_files_with_hashed_names   s     9h//r 	; 	;A3q66==1122<<>>H9V%6%6%677DLLdQ&--//L::::r   N)__name__
__module____qualname____doc__pytestfixturer   r   r#   r'   r,   r2   r4   r6   r8   r:   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.
        osrR   joinrg   s    r   r   zAbstractFixtures.fs_join   s     w|r   c                      t          d          rd   re   rg   s    r   r   zAbstractFixtures.fs_path  rh   r   class)scopec                 "    t          d          S )NT)
auto_mkdirr   rg   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.
        rj   rg   s    r   r0   zAbstractFixtures.local_join  s     w|r   c                     |S Nr`   )r   tmpdirs     r   r1   zAbstractFixtures.local_path  s    r   c                     dS )zP
        Return whether this implementation supports empty directories.
        Tr`   rg   s    r   supports_empty_directoriesz+AbstractFixtures.supports_empty_directories  s	    
 tr   c                     d S )Nc                     | S rt   r`   )xs    r   <lambda>z3AbstractFixtures.fs_sanitize_path.<locals>.<lambda>!  s     r   r`   rg   s    r   fs_sanitize_pathz!AbstractFixtures.fs_sanitize_path  s
    {r   N)rZ   r[   r\   r]   r^   r_   r   r   r   r/   r0   r1   rw   r|   r`   r   r   rb   rb      s         ^Y Y ^Y ^  ^ ^Y Y ^Y V^'"""0 0 #"0
 ^  ^ ^  ^ ^  ^ ^  ^  r   rb   )rk   hashlibr   r^   fsspec.implementations.localr   fsspec.tests.abstract.copyr   fsspec.tests.abstract.getr   fsspec.tests.abstract.openr   fsspec.tests.abstract.piper	   fsspec.tests.abstract.putr
   r   rb   r`   r   r   <module>r      s    				        8 8 8 8 8 8 8 8 8 8 8 8 6 6 6 6 6 6 8 8 8 8 8 8 8 8 8 8 8 8 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   