Ë
    ùÇ:jv  ã                   ó  — d dl Z d dlZd dlZd dlZd dlZd dlmZ d dlmZm	Z	 d dl
Z
d dlZ e
j                  «       d„ «       Z G d„ d«      Z e
j                  dd¬	«      d
eeddf   fd„«       Z e
j                  d¬«      d„ «       Zy)é    N)Údeque)Ú	GeneratorÚSequencec               #   ó$  K  — t        j                  d«      } | j                  j                  «        | j                  j                  «        | j                  j                  d«       	 | –— | j                  j                  «        | j                  j                  «        | j                  j                  d«       y# | j                  j                  «        | j                  j                  «        | j                  j                  d«       w xY w­w)z0
    Fixture providing a memory filesystem.
    ÚmemoryÚ N)ÚfsspecÚ
filesystemÚstoreÚclearÚpseudo_dirsÚappend)Úms    úd/home/mcse/projects/srt_converter/srt-converter-venv/lib/python3.12/site-packages/fsspec/conftest.pyr   r      s²   è ø€ ô
 	×Ñ˜(Ó#€AØ‡G�G‡M�M„OØ‡M�M×ÑÔØ‡M�M×Ñ˜Ôð!ØŠà	�‰�‰ŒØ	�‰×ÑÔØ	�‰×Ñ˜RÕ øð 	
�‰�‰ŒØ	�‰×ÑÔØ	�‰×Ñ˜RÕ üs    ‚A%DÁ(B< Á,ADÂ<ADÄDc                   ó8   — e Zd ZdZd	d„Zddœdedeeef   fd„Z	y)
ÚInstanceCacheInspectorzQ
    Helper class to inspect instance caches of filesystem classes in tests.
    ÚreturnNc                 óÖ   — t        t        j                  j                  g«      }|rC|j	                  «       }|j                  «        |j                  |j                  «       «       |rŒByy)zU
        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   zInstanceCacheInspector.clear$   sP   € ô œŸ™×7Ñ7Ð8Ó9ˆÙØ—/‘/Ó#ˆCØ×$Ñ$Ô&Ø�N‰N˜3×-Ñ-Ó/Ô0ô ó    T)Ú	omit_zeror   c                ó   — i }t        t        j                  j                  g«      }|r¥|j	                  «       }t        |j                  «      }t        |j                  t        t        f«      r>t        |j                  t        «      r|j                  n|j                  d   }|s|s|||<   |j                  |j                  «       «       |rŒ¥|S )a  
        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_countsz$InstanceCacheInspector.gather_counts.   s    € ð !ˆÜœŸ™×7Ñ7Ð8Ó9ˆÙØ—/‘/Ó#ˆCÜ˜Ÿ
™
“OˆEô ˜#Ÿ,™,¬´3¨Ô8Ü&0°·±¼sÔ&C�c—l’lÈÏÉÐVWÉ�Ù¡	Ø$�C˜‘HØ�N‰N˜3×-Ñ-Ó/Ô0ò ð ˆ
r   )r   N)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚboolÚdictr%   Úintr)   © r   r   r   r      s,   „ ñó1ð 26ò ¨$ð ¸$¸sÀC¸x¹.ô r   r   ÚfunctionT)ÚscopeÚautouser   c               #   ó”   K  — t        «       } | j                  «        	 | –— | j                  «        y# | j                  «        w xY w­w)as  
    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_cachesr7   G   s5   è ø€ ô. 
 Ó	!€Bà‡H�H„JðØŠà
�‰�
øˆ�‰�
üs   ‚Až3 ¢A³AÁA)r3   c              #   óž  K  — t        j                  d«       t        | «      }t        t        j
                  j                  |d«      d«      5 }|j                  ddz  «       ddd«       t        j                  t        j                  ddd|d	d
dddg
«      }	 t        j                  d«       d–— |j                  «        |j                  «        	 t!        j"                  | «       y# 1 sw Y   Œ‡xY w# t$        $ r Y yw xY w# |j                  «        |j                  «        	 t!        j"                  | «       w # t$        $ r Y w w xY wxY w­w)z6
    Fixture providing a writable FTP filesystem.
    Ú	pyftpdlibr&   Úwbs   helloi'  Nz-mz-dz-uÚuserz-PÚpassz-wé   )Ú	localhostiI  r;   r<   )ÚpytestÚimportorskipr%   ÚopenÚosÚpathÚjoinÚwriteÚ
subprocessÚPopenÚsysÚ
executableÚtimeÚsleepÚ	terminateÚwaitÚshutilÚrmtreeÚ	Exception)ÚtmpdirÚdÚfÚPs       r   Úftp_writablerU   g   s  è ø€ ô
 ×Ñ˜Ô$äˆF‹€AÜ	Œb�g‰g�l‰l˜1˜eÓ$ dÓ	+ð "¨qØ	�‰�˜5Ñ Ô!÷"ä×ÑÜ	�‰˜˜{¨D°!°T¸6À4ÈÐQUÐVó	€Að	Ü�
‰
�1ŒØ/Ò/à	�‰ŒØ	�‰Œð	Ü�M‰M˜&Õ!÷"ð "ûô ò 	Ùð	ûð	 	
�‰ŒØ	�‰Œð	Ü�M‰M˜&Õ!øÜò 	Ùð	ÿs~   ‚AEÁC(Á"5EÂD Â1 EÃC4 Ã'EÃ(C1Ã-EÃ4	D Ã=EÃ?D Ä EÄ!E
Ä%D;Ä:E
Ä;	EÅE
ÅEÅE
Å
E)rB   rN   rF   rH   rJ   Úcollectionsr   Úcollections.abcr   r   r?   r	   Úfixturer   r   r7   rU   r1   r   r   ú<module>rY      sœ   ðÛ 	Û Û Û 
Û Ý ß /ã ã ð €‡�Óñ!ó ð!÷ %ñ %ðP €‡��j¨$Ô/ð˜Ð#9¸4ÀÐ#EÑFò ó 0ðð> €‡��jÔ!ñó "ñr   