U
    -e^                     @   sb   d dl 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 dZ
G dd	 d	e
ZdS )
    NLocalFileSystem)AbstractCopyTests)AbstractGetTests)AbstractPutTestsc                   @   sP   e Zd ZdZejdd Zejdd Zejdd Zejdd	 Z	d
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                 c   s&   |  |||}|V  |j|d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source r   _/var/www/html/Darija-Ai-Train/env/lib/python3.8/site-packages/fsspec/tests/abstract/__init__.pyfs_bulk_operations_scenario_0   s    z2BaseAbstractFixtures.fs_bulk_operations_scenario_0c                 c   s,   ||d}|V  | |r(|j|dd 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   r   r   r   	fs_target   s    

zBaseAbstractFixtures.fs_targetc                 c   s&   |  |||}|V  |j|d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   r   r   r    local_bulk_operations_scenario_0)   s    z5BaseAbstractFixtures.local_bulk_operations_scenario_0c                 c   s,   ||d}|V  | |r(|j|dd 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   r   r   r   local_target4   s    

z!BaseAbstractFixtures.local_targetc                 C   s|   ||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   subdir	nesteddirZfile1Zfile2Zsubfile1Zsubfile2Z
nestedfile)makedirstouch)r   Zsome_fsZ	some_joinZ	some_pathr   r   r   r   r   r   r   @   s    



z0BaseAbstractFixtures._bulk_operations_scenario_0N)__name__
__module____qualname____doc__pytestfixturer   r   r   r   r   r   r   r   r   r      s   





r   c                   @   sr   e Zd ZdZejdd Zejdd Zejdd Zejdd	d
d Z	ejdd Z
ejdd Zd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                 C   s   t dd S Nz3This function must be overridden in derived classesNotImplementedErrorr   r   r   r   r   d   s    zAbstractFixtures.fsc                 C   s   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.
        ospathjoinr,   r   r   r   r   h   s    zAbstractFixtures.fs_joinc                 C   s   t dd S r)   r*   r,   r   r   r   r   r   s    zAbstractFixtures.fs_pathclass)scopec                 C   s
   t ddS )NT)Z
auto_mkdirr   r,   r   r   r   r   v   s    zAbstractFixtures.local_fsc                 C   s   t jjS )zs
        Return a function that joins its arguments together into a path, on
        the local filesystem.
        r-   r,   r   r   r   r   |   s    zAbstractFixtures.local_joinc                 C   s   |S )Nr   )r   Ztmpdirr   r   r   r      s    zAbstractFixtures.local_pathc                 C   s   dS )zP
        Return whether this implementation supports empty directories.
        Tr   r,   r   r   r   supports_empty_directories   s    z+AbstractFixtures.supports_empty_directoriesN)r"   r#   r$   r%   r&   r'   r   r   r   r   r   r   r3   r   r   r   r   r(   Z   s   	

	




r(   )r.   r&   Zfsspec.implementations.localr   Zfsspec.tests.abstract.copyr   Zfsspec.tests.abstract.getr   Zfsspec.tests.abstract.putr   r   r(   r   r   r   r   <module>   s   O