
    9iv                        S SK r S SKrS SKrS SKrS SKrS SKJr  S SKJrJ	r	  S SK
r
S SKr\
R                  " 5       S 5       r " S S5      r\
R                  " SSS	9S
\\SS4   4S j5       r\
R                  " SS9S 5       rg)    N)deque)	GeneratorSequencec               #   &  #    [         R                  " S5      n U R                  R                  5         U R                  R                  5         U R                  R                  S5         U v   U R                  R                  5         U R                  R                  5         U R                  R                  S5        g! U R                  R                  5         U R                  R                  5         U R                  R                  S5        f = f7f)z(
Fixture providing a memory filesystem.
memory N)fsspec
filesystemstoreclearpseudo_dirsappend)ms    O/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/fsspec/conftest.pyr   r      s     
 	(#AGGMMOMMMM!			R  	
		R s    A&D)B= -AD=ADDc                   F    \ rS rSrSrSS jrSS.S\S\\\	4   4S	 jjr
S
rg)InstanceCacheInspector   zI
Helper class to inspect instance caches of filesystem classes in tests.
returnNc                     [        [        R                  R                  /5      nU(       aI  UR	                  5       nUR                  5         UR                  UR                  5       5        U(       a  MH  gg)zE
Clear instance caches of all currently imported filesystem classes.
N)r   r	   specAbstractFileSystempopleftclear_instance_cacheextend__subclasses__)selfclassesclss      r   r   InstanceCacheInspector.clear$   sR     7789//#C$$&NN3--/0 g    T)	omit_zeror!   c                   0 n[        [        R                  R                  /5      nU(       a  UR	                  5       n[        UR                  5      n[        UR                  [        [        45      (       aL  [        UR                  [        5      (       a  UR                  OUR                  S   nU(       d  U(       d  XRU'   UR                  UR                  5       5        U(       a  M  U$ )z
Gather counts of filesystem instances in the instance caches
of all currently imported filesystem classes.

Parameters
----------
omit_zero:
    Whether to omit instance types with no cached instances.
r   )r   r	   r   r   r   len_cache
isinstanceprotocolr   strr   r   )r   r!   outr   r   countkeys          r   gather_counts$InstanceCacheInspector.gather_counts.   s     !7789//#C

OE #,,388&0s&C&CcllVW	$HNN3--/0 g 
r     )r   N)__name__
__module____qualname____firstlineno____doc__r   booldictr'   intr+   __static_attributes__r-   r    r   r   r      s1    1 26 $ $sCx.  r    r   functionT)scopeautouser   c               #      #    [        5       n U R                  5          U v   U R                  5         g! U R                  5         f = f7f)a7  
Fixture to ensure empty filesystem instance caches before and after a test.

Used by default for all tests.
Clears caches of all imported filesystem classes.
Can be used to write test assertions about instance caches.

Usage:

    def test_something(instance_caches):
        # Test code here
        fsspec.open("file://abc")
        fsspec.open("memory://foo/bar")

        # Test assertion
        assert instance_caches.gather_counts() == {"file": 1, "memory": 1}

Returns
-------
instance_caches: An instance cache inspector for clearing and inspecting caches.
N)r   r   )ics    r   instance_cachesr<   G   s4     . 
 	!BHHJ


s   A3 AAA)r8   c              #     #    [         R                  " S5        [        U 5      n[        [        R
                  R                  US5      S5       nUR                  SS-  5        SSS5        [        R                  " [        R                  SSSUS	S
SSS/
5      n [        R                  " S5        Sv   UR                  5         UR                  5          [         R"                  " U 5        g! , (       d  f       N= f! [$         a     gf = f! UR                  5         UR                  5          [         R"                  " U 5        f ! [$         a     f f = f= f7f)z.
Fixture providing a writable FTP filesystem.
	pyftpdlibr(   wbs   helloi'  Nz-mz-dz-uuserz-Ppassz-w   )	localhostiI  r@   rA   )pytestimportorskipr'   openospathjoinwrite
subprocessPopensys
executabletimesleep	terminatewaitshutilrmtree	Exception)tmpdirdfPs       r   ftp_writablerZ   g   s    
 $FA	bggll1e$d	+q	5 ! 
,	{D!T64QUV	A	

1//			MM&! 
,	+  			 	
		MM&! 		s~   AEC,#6ED 4 EC= +E,
C:6E=
D
E	D

E!E/EE
EEEEE)rG   rS   rK   rM   rO   collectionsr   collections.abcr   r   rD   r	   fixturer   r   r<   rZ   r-   r    r   <module>r^      s    	   
   /   ! ! % %P j$/#94#EF  0> j! "r    